本文整理汇总了PHP中Select::join方法的典型用法代码示例。如果您正苦于以下问题:PHP Select::join方法的具体用法?PHP Select::join怎么用?PHP Select::join使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Select
的用法示例。
在下文中一共展示了Select::join方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: rightJoin
/**
* @example database::Query::rightJoin
* <code>
* <?php
*
* # vide Query::factory
* $query = Query::factory(namespace\Foo);
*
* # vide Column::factory
* $joinConditional = Column::factory('bar', new Entity(namespace\bar), 'database');
* $joinConditional->equals( $query->column('bar') )
*
* # aplica o join
* $query->rightJoin($bar, $joinConditional);
* ?>
* </code>
* {@ineritdoc}
* */
public function rightJoin(Entity $entity, RelationalAbstract $conditional)
{
$this->_select->join(RightJoin::factory($entity, $conditional));
return $this;
}
示例2: _buildWhereClause
/**
* Builds where clause, for filtering on simple list mode
*
* @param Select $select Original select
*
* @return string SQL WHERE clause
*/
private function _buildWhereClause($select)
{
global $zdb, $login;
try {
if ($this->_filters->email_filter == self::FILTER_W_EMAIL) {
$select->where('email_adh != \'\'');
}
if ($this->_filters->email_filter == self::FILTER_WO_EMAIL) {
$select->where('(email_adh = \'\' OR email_adh IS NULL)');
}
if ($this->_filters->filter_str != '') {
$token = $zdb->platform->quoteValue('%' . strtolower($this->_filters->filter_str) . '%');
switch ($this->_filters->field_filter) {
case self::FILTER_NAME:
if (TYPE_DB === 'pgsql') {
$sep = " || ' ' || ";
$pre = '';
$post = '';
} else {
$sep = ', " ", ';
$pre = 'CONCAT(';
$post = ')';
}
//$sep = ( TYPE_DB === 'pgsql' ) ? " || ' ' || " : ', " ", ';
$select->where('(' . $pre . 'LOWER(nom_adh)' . $sep . 'LOWER(prenom_adh)' . $sep . 'LOWER(pseudo_adh)' . $post . ' LIKE ' . $token . ' OR ' . $pre . 'LOWER(prenom_adh)' . $sep . 'LOWER(nom_adh)' . $sep . 'LOWER(pseudo_adh)' . $post . ' LIKE ' . $token . ')');
break;
case self::FILTER_COMPANY_NAME:
$select->where('LOWER(societe_adh) LIKE ' . $token);
break;
case self::FILTER_ADDRESS:
$select->where('(' . 'LOWER(adresse_adh) LIKE ' . $token . ' OR ' . 'LOWER(adresse2_adh) LIKE ' . $token . ' OR ' . 'cp_adh LIKE ' . $token . ' OR ' . 'LOWER(ville_adh) LIKE ' . $token . ' OR ' . 'LOWER(pays_adh) LIKE ' . $token . ')');
break;
case self::FILTER_MAIL:
$select->where('(' . 'LOWER(email_adh) LIKE ' . $token . ' OR ' . 'LOWER(url_adh) LIKE ' . $token . ' OR ' . 'LOWER(msn_adh) LIKE ' . $token . ' OR ' . 'LOWER(icq_adh) LIKE ' . $token . ' OR ' . 'LOWER(jabber_adh) LIKE ' . $token . ')');
break;
case self::FILTER_JOB:
$select->where('LOWER(prof_adh) LIKE ' . $token);
break;
case self::FILTER_INFOS:
$more = '';
if ($login->isAdmin() || $login->isStaff()) {
$more = ' OR LOWER(info_adh) LIKE ' . $token;
}
$select->where('(LOWER(info_public_adh) LIKE ' . $token . $more . ')');
break;
case self::FILTER_NUMBER:
$select->where->equalTo('a.id_adh', $this->_filters->filter_str);
break;
}
}
if ($this->_filters->membership_filter) {
switch ($this->_filters->membership_filter) {
case self::MEMBERSHIP_NEARLY:
$now = new \DateTime();
$duedate = new \DateTime();
$duedate->modify('+1 month');
$select->where->greaterThan('date_echeance', $now->format('Y-m-d'))->lessThan('date_echeance', $duedate->format('Y-m-d'));
break;
case self::MEMBERSHIP_LATE:
$select->where->lessThan('date_echeance', date('Y-m-d', time()))->equalTo('bool_exempt_adh', new Expression('false'));
break;
case self::MEMBERSHIP_UP2DATE:
$select->where('(' . 'date_echeance > \'' . date('Y-m-d', time()) . '\' OR bool_exempt_adh=true)');
break;
case self::MEMBERSHIP_NEVER:
$select->where('date_echeance IS NULL')->where('bool_exempt_adh = false');
break;
case self::MEMBERSHIP_STAFF:
$select->where->lessThan('p.priorite_statut', self::NON_STAFF_MEMBERS);
break;
case self::MEMBERSHIP_ADMIN:
$select->where->equalTo('bool_admin_adh', true);
break;
case self::MEMBERSHIP_NONE:
$select->where->equalTo('a.id_statut', Status::DEFAULT_STATUS);
break;
}
}
if ($this->_filters->account_status_filter) {
switch ($this->_filters->account_status_filter) {
case self::ACTIVE_ACCOUNT:
$select->where('activite_adh=true');
break;
case self::INACTIVE_ACCOUNT:
$select->where('activite_adh=false');
break;
}
}
if ($this->_filters->group_filter) {
$select->join(array('g' => PREFIX_DB . Group::GROUPSUSERS_TABLE), 'a.' . Adherent::PK . '=g.' . Adherent::PK, array('*'), $select::JOIN_LEFT)->join(array('gs' => PREFIX_DB . Group::TABLE), 'gs.' . Group::PK . '=g.' . Group::PK, array('*'), $select::JOIN_LEFT)->where('(g.' . Group::PK . ' = ' . $this->_filters->group_filter . ' OR gs.parent_group = NULL OR gs.parent_group = ' . $this->_filters->group_filter . ')');
}
if ($this->_filters instanceof AdvancedMembersList) {
if ($this->_filters->rbirth_date_begin || $this->_filters->rbirth_date_end) {
//.........这里部分代码省略.........