当前位置: 首页>>代码示例>>PHP>>正文


PHP Zend_Db_Select::orWhere方法代码示例

本文整理汇总了PHP中Zend_Db_Select::orWhere方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Db_Select::orWhere方法的具体用法?PHP Zend_Db_Select::orWhere怎么用?PHP Zend_Db_Select::orWhere使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Zend_Db_Select的用法示例。


在下文中一共展示了Zend_Db_Select::orWhere方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: _renderFilters

 /**
  * Render sql select conditions
  *
  * @return  Varien_Data_Collection_Db
  */
 protected function _renderFilters()
 {
     if ($this->_isFiltersRendered) {
         return $this;
     }
     $this->_renderFiltersBefore();
     foreach ($this->_filters as $filter) {
         switch ($filter['type']) {
             case 'or':
                 $condition = $this->_conn->quoteInto($filter['field'] . '=?', $filter['value']);
                 $this->_select->orWhere($condition);
                 break;
             case 'string':
                 $this->_select->where($filter['value']);
                 break;
             case 'public':
                 $field = $this->_getMappedField($filter['field']);
                 $condition = $filter['value'];
                 $this->_select->where($this->_getConditionSql($field, $condition), null, Varien_Db_Select::TYPE_CONDITION);
                 break;
             default:
                 $condition = $this->_conn->quoteInto($filter['field'] . '=?', $filter['value']);
                 $this->_select->where($condition);
         }
     }
     $this->_isFiltersRendered = true;
     return $this;
 }
开发者ID:natxetee,项目名称:magento2,代码行数:33,代码来源:Db.php

示例2: appendFilterSql

 /**
  * appends sql to given select statement
  *
  * @param Zend_Db_Select                $_select
  * @param Tinebase_Backend_Sql_Abstract $_backend
  */
 public function appendFilterSql($_select, $_backend)
 {
     // quote field identifier, set action and replace wildcards
     $field = $this->_getQuotedFieldName($_backend);
     $action = $this->_opSqlMap[$this->_operator];
     $value = $this->_replaceWildcards($this->_value);
     if (in_array($this->_operator, array('in', 'notin')) && !is_array($value)) {
         $value = explode(' ', $this->_value);
     }
     if (in_array($this->_operator, array('equals', 'greater', 'less', 'in', 'notin'))) {
         $value = str_replace(array('%', '\\_'), '', $value);
         if (is_array($value) && empty($value)) {
             $_select->where('1=' . (substr($this->_operator, 0, 3) == 'not' ? '1/* empty query */' : '0/* impossible query */'));
         } elseif ($this->_operator == 'equals' && ($value === '' || $value === NULL || $value === false)) {
             $_select->where($field . 'IS NULL');
         } else {
             // finally append query to select object
             $_select->where($field . $action['sqlop'], $value, $this->valueType);
         }
     } else {
         // finally append query to select object
         $_select->where($field . $action['sqlop'], $value);
     }
     if (in_array($this->_operator, array('not', 'notin')) && $value !== '') {
         $_select->orWhere($field . ' IS NULL');
     }
 }
开发者ID:ingoratsdorf,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:33,代码来源:Int.php

示例3: appendFilterSql

 /**
  * appends sql to given select statement
  * 
  * @param  Zend_Db_Select                    $_select
  * @param  Tinebase_Backend_Sql_Abstract     $_backend
  * @throws Tinebase_Exception_NotFound
  */
 public function appendFilterSql($_select, $_backend)
 {
     $this->_options['ignoreAcl'] = TRUE;
     $this->_resolve();
     $quotedDisplayContainerIdentifier = $_backend->getAdapter()->quoteIdentifier('attendee.displaycontainer_id');
     $_select->where($this->_getQuotedFieldName($_backend) . ' IN (?)', empty($this->_containerIds) ? " " : $this->_containerIds);
     $_select->orWhere($quotedDisplayContainerIdentifier . ' IN (?)', empty($this->_containerIds) ? " " : $this->_containerIds);
 }
开发者ID:bitExpert,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:15,代码来源:CalendarFilter.php

示例4: orWhere

 /**
  * see where
  * @return WeFlex_Db_Model
  */
 public function orWhere($conditions)
 {
     if (is_array($conditions)) {
         $conditions = $this->_translateToZendWhere($conditions);
     }
     $this->_selector->orWhere($conditions);
     return $this;
 }
开发者ID:rocknoon,项目名称:TCVM,代码行数:12,代码来源:Model.php

示例5: appendFilterSql

 /**
  * appends sql to given select statement
  * 
  * @param  Zend_Db_Select                    $_select
  * @param  Tinebase_Backend_Sql_Abstract     $_backend
  * @throws Tinebase_Exception_NotFound
  */
 public function appendFilterSql($_select, $_backend)
 {
     $this->_options['ignoreAcl'] = TRUE;
     $this->_resolve();
     $quotedDisplayContainerIdentifier = $_backend->getAdapter()->quoteIdentifier('attendee.displaycontainer_id');
     $where = empty($this->_containerIds) ? Tinebase_Backend_Sql_Command::getFalseValue($_backend->getAdapter()) : $_select->getAdapter()->quoteInto($this->_getQuotedFieldName($_backend) . ' IN (?)', $this->_containerIds);
     $orWhere = empty($this->_containerIds) ? Tinebase_Backend_Sql_Command::getFalseValue($_backend->getAdapter()) : $_select->getAdapter()->quoteInto($quotedDisplayContainerIdentifier . ' IN (?)', $this->_containerIds);
     $_select->where($where);
     $_select->orWhere($orWhere);
 }
开发者ID:rodrigofns,项目名称:ExpressoLivre3,代码行数:17,代码来源:CalendarFilter.php

示例6: selectQueryList

 /**
  * Retorna uma query com informações do empreendimentos cadastrados
  * 
  * @param number $filter            
  * @throws Zend_Db_Exception
  * @return mixed|boolean
  */
 public function selectQueryList($filter = 1, $like = NULL)
 {
     try {
         $select = new Zend_Db_Select($this->db);
         $select->from($this->name);
         $select->where('state=?', $filter);
         if (!is_null($like)) {
             $columns = array('nome', 'categoria', 'logradouro', 'incorporadora');
             $select->where($columns[0] . ' LIKE ?', '%' . $like . '%');
             $select->orWhere($columns[1] . ' LIKE ?', '%' . $like . '%');
             $select->orWhere($columns[2] . ' LIKE ?', '%' . $like . '%');
             $select->orWhere($columns[3] . ' LIKE ?', '%' . $like . '%');
         }
         $select->order('id DESC');
         return $select;
     } catch (Zend_Db_Exception $e) {
         throw new Zend_Db_Exception($e->getMessage());
         return false;
     }
 }
开发者ID:Dinookys,项目名称:zend_app,代码行数:27,代码来源:Empreendimentos.php

示例7: appendFilterSql

 /**
  * appends sql to given select statement
  *
  * @param Zend_Db_Select                $_select
  * @param Tinebase_Backend_Sql_Abstract $_backend
  * 
  * @todo to be removed once we split filter model / backend
  */
 public function appendFilterSql($_select, $_backend)
 {
     $now = new Tinebase_DateTime();
     $now->setHour(0)->setMinute(0)->setSecond(0);
     $db = Tinebase_Core::getDb();
     if ($this->_value == 1) {
         $_select->where($db->quoteInto('(' . $db->quoteIdentifier('employment_end') . ' >= ? ', $now, 'datetime') . ' OR ' . $db->quoteIdentifier('employment_end') . ' IS NULL )');
         $_select->where($db->quoteInto('( ' . $db->quoteIdentifier('employment_begin') . ' <= ? ', $now, 'datetime') . ' OR ( ' . $db->quoteIdentifier('employment_begin') . ' IS NULL ))');
     } else {
         $_select->where($db->quoteInto($db->quoteIdentifier('employment_end') . ' < ? ', $now, 'datetime'));
         $_select->orWhere($db->quoteInto($db->quoteIdentifier('employment_begin') . ' > ? ', $now, 'datetime'));
     }
 }
开发者ID:ingoratsdorf,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:21,代码来源:EmployeeEmployedFilter.php

示例8: selectByUsersIds

 /**
  * @param number $filterState            
  * @param string $userIds            
  * @throws Zend_Exception
  */
 public function selectByUsersIds($filterState = 1, $ids, $like = NULL)
 {
     try {
         $select = new Zend_Db_Select($this->db);
         $select->from('' . $this->name . '');
         $select->where('state=?', $filterState);
         $select->where('created_user_id IN ( ' . $ids . ' )');
         if (!is_null($like)) {
             $columns = array('cpf', 'dados_cliente');
             $select->where($columns[0] . ' LIKE ?', '%' . $like . '%');
             $select->orWhere($columns[1] . ' LIKE ?', '%' . $like . '%');
         }
         $select->order('id DESC');
         return $select;
     } catch (Zend_Exception $e) {
         throw new Zend_Exception($e->getMessage());
         return false;
     }
 }
开发者ID:Dinookys,项目名称:zend_app,代码行数:24,代码来源:Clientes.php

示例9: _renderFilters

 /**
  * Render sql select conditions
  *
  * @return  Varien_Data_Collection_Db
  */
 protected function _renderFilters()
 {
     if ($this->_isFiltersRendered) {
         return $this;
     }
     foreach ($this->_filters as $filter) {
         switch ($filter['type']) {
             case 'or':
                 $condition = $this->_conn->quoteInto($filter['field'] . '=?', $filter['value']);
                 $this->_select->orWhere($condition);
                 break;
             case 'string':
                 $this->_select->where($filter['value']);
                 break;
             default:
                 $condition = $this->_conn->quoteInto($filter['field'] . '=?', $filter['value']);
                 $this->_select->where($condition);
         }
     }
     $this->_isFiltersRendered = true;
     return $this;
 }
开发者ID:HelioFreitas,项目名称:magento-pt_br,代码行数:27,代码来源:Db.php

示例10: selectAll

 /**
  * Recupera dados da tabela #__clientes
  *
  * @param Zend_DB::FETCH $mode            
  * @return array
  */
 public function selectAll($filterState = 1, $like = NULL)
 {
     try {
         $select = new Zend_Db_Select($this->db);
         $select->from(array('u' => $this->name), array('id', 'nome', 'email', 'id_perfil', 'acesso', 'state'));
         $select->joinLeft(array('p' => $this->namePerfis), 'u.id_perfil = p.id', 'role');
         $select->where('u.state = ?', $filterState);
         if (!is_null($like)) {
             $columns = array('u.nome', 'u.email', 'p.role');
             $select->where($columns[0] . ' LIKE ?', '%' . $like . '%');
             $select->orWhere($columns[1] . ' LIKE ?', '%' . $like . '%');
             $select->orWhere($columns[2] . ' LIKE ?', '%' . $like . '%');
         }
         $select->order('u.id DESC');
         return $select;
         //return $result;
     } catch (Zend_Db_Adapter_Exception $e) {
         throw new Zend_Exception($e->getMessage());
     }
 }
开发者ID:Dinookys,项目名称:zend_app,代码行数:26,代码来源:Usuarios.php

示例11: combineSubSelectIfWhereIsNotEmpty

 function combineSubSelectIfWhereIsNotEmpty(Zend_Db_Select $select, Zend_Db_Select $subSelect)
 {
     $whereArray = $subSelect->getPart(Zend_Db_Select::WHERE);
     if (count($whereArray)) {
         return $select->orWhere(implode(' ', $whereArray));
     }
     return $select;
 }
开发者ID:vehiclefits,项目名称:library,代码行数:8,代码来源:FlexibleSearch.php

示例12: applyWheres

 protected function applyWheres(Zend_Db_Select $select, $wheres)
 {
     foreach ($wheres as $where) {
         @(list($condition, $value, $type) = $where);
         if ($type == 'or') {
             $select->orWhere($condition, $value);
         } else {
             $select->where($condition, $value);
         }
     }
     return $select;
 }
开发者ID:jakubmalusevic,项目名称:Zend-website1,代码行数:12,代码来源:Row.php

示例13: getVolumesNeedReplacement

 /**
  * List Volumes likely to need replacement from age or errors
  * bconsole -> query -> 16
  * @return rows
  */
 function getVolumesNeedReplacement()
 {
     $db = Zend_Registry::get('db_bacula');
     // make select from multiple tables
     $select = new Zend_Db_Select($db);
     $select->from('Media', array("MediaId", 'PoolId', 'StorageId', 'VolumeName', 'VolStatus', 'VolJobs', 'MediaType', 'VolMounts', 'VolErrors', 'VolWrites', 'VolBytes'));
     $select->orWhere("VolErrors > 0");
     $select->orWhere("VolStatus = 'Error'");
     $select->orWhere("VolMounts > 50");
     // Number of time media mounted
     $select->orWhere("VolStatus = 'Disabled'");
     $select->orWhere("VolWrites > 3999999");
     // Number of writes to media
     $select->order(array('VolStatus ASC', 'VolErrors', 'VolMounts', 'VolumeName DESC'));
     //$sql = $select->__toString(); echo "<pre>$sql</pre>"; exit; // for !!!debug!!!
     $stmt = $select->query();
     return $stmt->fetchAll();
 }
开发者ID:staser,项目名称:webacula,代码行数:23,代码来源:Media.php

示例14: addCondition

 /**
  * Add's a new condition to the curretn query
  *
  * @param string $filter        Filter to apply
  * @param string $op            Condition option
  * @param array  $completeField All fields options
  *
  * @return void
  */
 public function addCondition($filter, $op, $completeField)
 {
     $op = strtolower($op);
     $explode = explode('.', $completeField['field']);
     $field = end($explode);
     $simpleField = false;
     $columns = $this->getColumns();
     foreach ($columns as $value) {
         if ($field == $value[2]) {
             if (is_object($value[1])) {
                 $field = $value[1]->__toString();
                 $simpleField = true;
             } else {
                 $field = $value[0] . '.' . $value[1];
             }
             break;
         } elseif ($field == $value[0]) {
             $field = $value[0] . '.' . $value[1];
             break;
         }
     }
     if (strpos($field, '.') === false && $simpleField === false) {
         $field = $completeField['field'];
     }
     /**
      * Reserved words from myslq dont contain any special charaters.
      * But select expressions may.
      *
      * SELECT IF(City.Population>500000,1,0)....
      *
      * We can not quoteIdentifier this fields...
      *
      */
     if (strpos($field, '(') !== false) {
         $field = $this->_getDb()->quoteIdentifier($field);
     }
     $func = 'where';
     if (strpos($field, '(') !== false) {
         $func = 'having';
     }
     switch ($op) {
         case 'sqlexp':
             $this->_select->{$func}(new Zend_Db_Expr($filter));
             break;
         case 'empty':
             $this->_select->{$func}($field . " = '' ");
             break;
         case 'isnull':
             $this->_select->{$func}(new Zend_Db_Expr($field . ' IS NULL '));
             break;
         case 'isnnotull':
             $this->_select->{$func}(new Zend_Db_Expr($field . ' IS NOT NULL '));
             break;
         case 'equal':
         case '=':
             $this->_select->{$func}($field . ' = ?', $filter);
             break;
         case 'rege':
             $this->_select->{$func}($field . " REGEXP " . $this->_getDb()->quote($filter));
             break;
         case 'rlike':
             $this->_select->{$func}($field . " LIKE " . $this->_getDb()->quote($filter . "%"));
             break;
         case 'llike':
             $this->_select->{$func}($field . " LIKE " . $this->_getDb()->quote("%" . $filter));
             break;
         case '>=':
             $this->_select->{$func}($field . " >= ?", $filter);
             break;
         case '>':
             $this->_select->{$func}($field . " > ?", $filter);
             break;
         case '<>':
         case '!=':
             $this->_select->{$func}($field . " <> ?", $filter);
             break;
         case '<=':
             $this->_select->{$func}($field . " <= ?", $filter);
             break;
         case '<':
             $this->_select->{$func}($field . " < ?", $filter);
             break;
         case 'in':
             $filter = explode(',', $filter);
             $this->_select->{$func}($field . " IN  (?)", $filter);
             break;
         case 'flag':
             $this->_select->{$func}($field . " & ? <> 0", $filter);
             break;
         case '||':
             $this->_select->orWhere($field . " LIKE " . $this->_getDb()->quote("%" . $filter . "%"));
//.........这里部分代码省略.........
开发者ID:robjacoby,项目名称:xlr8u,代码行数:101,代码来源:Select.php

示例15: find

 /**
  * Returns an array of objects queried from the given t41_Object_Collection instance parameters
  * 
  * The given collection is populated if it comes empty of members.
  * 
  * In any other case, this method doesn't directly populate the collection. This action is under the responsability of 
  * the caller. For example, the t41_Object_Collection::find() method takes care of it.
  * 
  * @param t41\ObjectModel\Collection $collection
  * @param boolean|array $returnCount true = counting, array = stats on listed properties
  * @param string $subOp complex operation like SUM or AVG
  * @return array
  */
 public function find(ObjectModel\Collection $collection, $returnCount = false, $subOp = null)
 {
     $this->_class = $class = $collection->getDataObject()->getClass();
     $table = $this->_getTableFromClass($class);
     if (!$table) {
         throw new Exception('MISSING_DBTABLE_PARAM');
     }
     // primary key is either part of the mapper configuration or 'id'
     $pkey = $this->_mapper ? $this->_mapper->getPrimaryKey($class) : \t41\Backend::DEFAULT_PKEY;
     if (is_array($pkey)) {
         $composite = array();
         /* @var $obj t41\Backend\Key */
         foreach ($pkey as $obj) {
             $composite[] = sprintf('TRIM(%s)', $table . '.' . $obj->getName());
             $composite[] = Backend\Mapper::VALUES_SEPARATOR;
         }
         $pkey = sprintf("CONCAT(%s) AS %s", implode(',', $composite), Backend::DEFAULT_PKEY);
     } else {
         $pkey = $table . '.' . $pkey;
     }
     $this->_connect();
     /* @var $select \Zend_Db_Select */
     $this->_select = $this->_ressource->select();
     // detect if query is of stat-kind
     if ($returnCount) {
         switch ($subOp) {
             case ObjectModel::CALC_SUM:
                 $expressions = array();
                 foreach ($returnCount as $propKey => $property) {
                     $prop = $this->_mapper ? $this->_mapper->propertyToDatastoreName($class, $propKey) : $propKey;
                     $expressions[] = sprintf('SUM(%s.%s)', $table, $prop);
                 }
                 $subOpExpr = implode('+', $expressions);
                 break;
             case ObjectModel::CALC_AVG:
                 $subOpExpr = sprintf('AVG(%s)', $returnCount);
                 break;
             default:
                 $subOpExpr = 'COUNT(*)';
                 break;
         }
         $this->_select->from($table, new \Zend_Db_Expr($subOpExpr . " AS " . \t41\Backend::MAX_ROWS_IDENTIFIER));
     } else {
         $this->_select->distinct();
         $this->_select->from($table, $pkey);
     }
     $this->_alreadyJoined = array();
     /* @var $condition t41\Backend\Condition */
     foreach ($collection->getConditions() as $conditionArray) {
         // combo conditions
         if ($conditionArray[0] instanceof Condition\Combo) {
             $statement = array();
             foreach ($conditionArray[0]->getConditions() as $condition) {
                 $statement[] = $this->_parseCondition($condition[0], $this->_select, $table);
             }
             $statement = implode(' OR ', $statement);
             switch ($conditionArray[1]) {
                 case Condition::MODE_OR:
                     $this->_select->orWhere($statement);
                     break;
                 case Condition::MODE_AND:
                 default:
                     $this->_select->where($statement);
                     break;
             }
             continue;
         }
         // optional table where the column may be
         $jtable = '';
         // condition object is in the first key
         $condition = $conditionArray[0];
         /* does condition contain another condition object ? */
         if ($condition->isRecursive()) {
             while ($condition->isRecursive()) {
                 $property = $condition->getProperty();
                 $parent = $property->getParent() ? $property->getParent()->getId() : $table;
                 $condition = $condition->getCondition();
                 if ($jtable) {
                     $parentTable = $jtable;
                 } else {
                     if ($parent) {
                         $parentTable = $this->_mapper ? $this->_mapper->getDatastore($parent) : $parent;
                     } else {
                         $parentTable = $table;
                     }
                 }
                 $jtable = $this->_mapper ? $this->_mapper->getDatastore($property->getParameter('instanceof')) : $this->_getTableFromClass($property->getParameter('instanceof'));
//.........这里部分代码省略.........
开发者ID:crapougnax,项目名称:t41,代码行数:101,代码来源:AbstractPdoAdapter.php


注:本文中的Zend_Db_Select::orWhere方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。