本文整理汇总了PHP中QueryBuilder::setDistinct方法的典型用法代码示例。如果您正苦于以下问题:PHP QueryBuilder::setDistinct方法的具体用法?PHP QueryBuilder::setDistinct怎么用?PHP QueryBuilder::setDistinct使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QueryBuilder
的用法示例。
在下文中一共展示了QueryBuilder::setDistinct方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: load
function load($sh, $c_query = null)
{
$db = DB::Instance();
$qb = new QueryBuilder($db, $this->_doname);
if ($sh instanceof SearchHandler) {
if ($this->_templateobject->isAccessControlled()) {
if (isModuleAdmin()) {
$cc = new ConstraintChain();
$cc->add(new Constraint('usercompanyid', '=', EGS_COMPANY_ID));
$cc->add(new Constraint('id', '=', EGS_COMPANY_ID), 'OR');
$sh->addConstraintChain($cc);
$qb->setDistinct();
} else {
$cc = new ConstraintChain();
$cc->add(new Constraint('usernameaccess', '=', EGS_USERNAME));
$cc->add(new Constraint('owner', '=', EGS_USERNAME), 'OR');
$cc2 = new ConstraintChain();
$cc2->add(new Constraint('usercompanyid', '=', EGS_COMPANY_ID));
$sh->addConstraintChain($cc);
$sh->addConstraintChain($cc2);
$qb->setDistinct();
}
}
$this->sh = $sh;
}
$this->_load($sh, $qb, $c_query);
}
示例2: update
function update($fields, $values, $sh, $c_query = null)
{
if (!is_array($fields)) {
$fields = array($fields);
}
if (!is_array($values)) {
$values = array($values);
}
$db = DB::Instance();
$qb = new QueryBuilder($db, $this->_templateobject);
// Collection may be based on a view so need to get the base table
// of the DataObject model associated with this DataObjectCollection
$this->_tablename = $this->getModel()->getTableName();
$table_columns = $db->MetaColumnNames($this->_tablename);
if (in_array('lastupdated', $table_columns) && !in_array('lastupdated', $fields)) {
$fields[] = 'lastupdated';
$values[] = 'now()';
}
if (in_array('alteredby', $table_columns) && !in_array('alteredby', $fields)) {
$fields[] = 'alteredby';
$values[] = EGS_USERNAME;
}
if ($sh instanceof SearchHandler) {
if ($this->_templateobject->isAccessControlled()) {
if (isModuleAdmin()) {
$qb->setDistinct();
} else {
$sh->addConstraintChain($this->_templateobject->getAccessConstraint('write'));
}
}
$this->sh = $sh;
}
return $this->_update($fields, $values, $sh, $qb, $c_query);
}