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


PHP Zend_Db_Select::getPart方法代码示例

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


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

示例1: _renderOrders

 /**
  * Render sql select orders
  *
  * @return  Varien_Data_Collection_Db
  */
 protected function _renderOrders()
 {
     $ordersInSelect = $this->_select->getPart(Zend_Db_Select::ORDER);
     foreach ($this->_orders as $orderExpr) {
         if (!in_array($orderExpr, $ordersInSelect)) {
             $this->_select->order($orderExpr);
         }
     }
     return $this;
 }
开发者ID:par-orillonsoft,项目名称:magento_work,代码行数:15,代码来源:Db.php

示例2: setDefaultHeaderdata

 /**
  * Setzt die Headerdaten einsprachig entsprechend des 
  * internen Select-Objekts
  *
  */
 public function setDefaultHeaderdata()
 {
     $selectpart = $this->select->getPart(Zend_DB_Select::COLUMNS);
     for ($i = 0; $i < count($selectpart); $i++) {
         if (($columnname = $selectpart[$i][1]) != '*') {
             $defaultHeaderData[] = array('raw' => $columnname, 'lang_xx' => $columnname, 'lang_de' => $columnname, 'lang_en' => $columnname);
         } else {
             throw new Exception('Das Select-Objekt enthält keine Spaltennamen. Es kann kein Default-Header gesetzt werden.');
         }
     }
     $this->header = $defaultHeaderData;
 }
开发者ID:blackskaarj,项目名称:webgr,代码行数:17,代码来源:Extended.php

示例3: __construct

 /**
  *
  * @param \Zend_Db_Select $select
  * @param string $name Optiona name
  */
 public function __construct(\Zend_Db_Select $select, $name = null)
 {
     $this->_select = $select;
     // Make sure the columns are known to the model
     foreach ($select->getPart(\Zend_Db_Select::COLUMNS) as $column) {
         if (isset($column[2])) {
             $this->set($column[2]);
         } elseif (is_string($column[1])) {
             $this->set($column[1]);
         }
     }
     if (null === $name) {
         $name = 'rnd' . rand(10000, 999999);
     }
     parent::__construct($name);
 }
开发者ID:GemsTracker,项目名称:MUtil,代码行数:21,代码来源:SelectModel.php

示例4: offsetGet

 /**
  * Returns a specific record given it's offset/index
  * @param integer $offset Offset of record to fetch
  */
 public function offsetGet($offset)
 {
     // PDO does not support scrollable cursor for MySQL, so we can't use the cursor
     // and offset parameters of _statement->fetch().
     // Therefore, our only real option is to put a limit on the list temporarily and
     // then reset it.
     $previousLimitCount = $this->_select->getPart(Zend_Db_Select::LIMIT_COUNT);
     $previousLimitOffset = $this->_select->getPart(Zend_Db_Select::LIMIT_OFFSET);
     $this->limit(1, $offset);
     $this->_execute();
     $item = $this->_statement->fetch();
     $this->reset(Zend_Db_Select::LIMIT_COUNT);
     $this->reset(Zend_Db_Select::LIMIT_OFFSET);
     $this->limit($previousLimitCount, $previousLimitOffset);
     if ($item) {
         $class = $this->_class;
         return new $class($item, $this->tableName(), $this->_db);
     }
     return false;
 }
开发者ID:jfro,项目名称:php-simpledb,代码行数:24,代码来源:List.php

示例5: appendFilterSql

 /**
  * appends sql to given select statement
  * 
  * @param  Zend_Db_Select                    $_select
  * @param  Tinebase_Backend_Sql_Abstract     $_backend
  * @throws Tinebase_Exception_AccessDenied
  */
 public function appendFilterSql($_select, $_backend)
 {
     $db = $_backend->getAdapter();
     if ($this->_requiredGrants === NULL) {
         throw new Tinebase_Exception_AccessDenied('No grants have been defined.');
     }
     // it searches select columns
     // return an array where each element has 3 items: 0 - table, 1 - field/expression, 2 - alias
     $columns = $_select->getPart(Zend_Db_Select::COLUMNS);
     // it gets an array with expressions used in having clause
     $grants = array();
     foreach ($columns as $column) {
         if (!empty($column[2])) {
             $grants[$column[2]] = $column[1];
         }
     }
     // it uses into having clause expressions instead of aliases
     foreach ($this->_requiredGrants as $grant) {
         $_select->orHaving($db->quoteInto($db->quoteIdentifier($grants[$grant]) . ' = ?', 1, Zend_Db::INT_TYPE));
     }
 }
开发者ID:rodrigofns,项目名称:ExpressoLivre3,代码行数:28,代码来源:GrantFilter.php

示例6: __construct

 /**
  * Constructor.
  *
  * @param Zend_Db_Select $select The select query
  */
 public function __construct(Zend_Db_Select $select, $sphinxQuery, $sphinxTableName = null)
 {
     $this->_select = $select;
     $this->_sphinxQuery = $sphinxQuery;
     $from = $select->getPart(Zend_Db_Select::FROM);
     if (null !== $sphinxTableName) {
         $this->_sphinxTableName = $sphinxTableName;
     } else {
         foreach ($from as $table => $opts) {
             if (strpos($table, 'sphinx') !== false) {
                 $this->_sphinxTableName = $table;
                 break;
             }
         }
         if (null === $this->_sphinxTableName) {
             throw new Zend_Paginator_Exception('Could not detect sphinx table name in select');
         }
     }
     if (!array_key_exists($this->_sphinxTableName, $from)) {
         throw new Zend_Paginator_Exception('Select must contain a table/alias "' . $this->_sphinxTableName . '"');
     }
 }
开发者ID:jsor,项目名称:sphinx-and-zend-framework,代码行数:27,代码来源:DbSelectSphinxSe.php

示例7: _addGroupsCatalogFilterToSelect

 /**
  * Join the specified groupscatalog index table to the passed select instance
  *
  * @param Zend_Db_Select $select
  * @param string $table The groupscatalog index table
  * @param int $groupId
  * @param int $storeId
  * @param string $entityField The entity table column where the product or category id is stored
  * @return void
  */
 protected function _addGroupsCatalogFilterToSelect(Zend_Db_Select $select, $table, $groupId, $storeId, $entityField = 'e.entity_id')
 {
     // NOTE to self:
     // Using joinTable() seems to trigger an exception for some users that I can't reproduce (so far).
     // It is related to the flat catalog (Mage_Catalog_Model_Resource_Category_Flat_Collection missing
     // joinTable()). Using getSelect()->joinInner() to work around this issue.
     /*
     $collection->joinTable(
         $helper->getIndexTableByEntityType($entityType), // table
         "catalog_entity_id=entity_id", // primary bind
         array('group_id' => 'group_id', 'store_id' => 'store_id'), // alias to field mappings for the bind cond.
         array( // additional bind conditions (see mappings above)
             'group_id' => $groupId,
             'store_id' => $collection->getStoreId(),
         ),
         'inner' // join type
     );
     */
     // Avoid double joins for the wishlist collection.
     // They clone and clear() the collection each time, but the joins on the
     // collections select objects persist. This is more reliable then setting
     // a flag on the collection object.
     foreach ($select->getPart(Zend_Db_Select::FROM) as $joinedTable) {
         if ($joinedTable['tableName'] == $table) {
             // filter join already applied
             return;
         }
     }
     $select->joinInner($table, "{$table}.catalog_entity_id={$entityField} AND " . $this->_getReadAdapter()->quoteInto("{$table}.group_id=? AND ", $groupId) . $this->_getReadAdapter()->quoteInto("{$table}.store_id=?", $storeId), array());
 }
开发者ID:aniljaiswal,项目名称:order-confirmation,代码行数:40,代码来源:Filter.php

示例8:

 protected static final function _buildPerPageCacheKey(Zend_Db_Select $select)
 {
     $cacheKey = sha1(serialize(array($select->getPart(Zend_Db_Select::COLUMNS), $select->getPart(Zend_Db_Select::FROM), $select->getPart(Zend_Db_Select::WHERE), $select->getPart(Zend_Db_Select::GROUP), $select->getPart(Zend_Db_Select::HAVING), $select->getPart(Zend_Db_Select::ORDER))));
     return $cacheKey;
 }
开发者ID:hartum,项目名称:basezf,代码行数:5,代码来源:DbCollection.php

示例9: _prepareSelect

 protected function _prepareSelect(Zend_Db_Select $select)
 {
     $fromPart = $select->getPart(Zend_Db_Select::FROM);
     // the recipient table is required!
     if (!isset($fromPart['recipient'])) {
         return false;
     }
     foreach ($this->_where as $where) {
         $select->where($where);
     }
     $select->columns($this->_columns, 'recipient');
     return true;
 }
开发者ID:jsiefer,项目名称:emarketing,代码行数:13,代码来源:Binder.php

示例10: GetSelectForSort

 /**
  * Get Select object (Zend_Db_Select) for sorting table records
  *
  * @param Zend_Db_Select $select
  * @param string $order         
  *
  * @return Zend_Db_Select
  */
 public static function GetSelectForSort($select, $options)
 {
     $aliasTable = '';
     $order = $options['order'];
     //--------------------------
     $arrOrder = explode('.', $order);
     // Если в параметре сортировки не задан псевдоним таблицы
     // то определим его, и если нужно присоединим,
     // соответствующую таблицу
     if (count($arrOrder) == 1) {
         $joinTableForSort = $options['joinTableForSort'];
         if ($joinTableForSort) {
             // Определим какие таблицы уже присоединены
             $fromTables = $select->getPart(Zend_Db_Select::FROM);
             foreach ($fromTables as $alias => $joinParams) {
                 // Если таблица -> $joinTableForSort уже присоединена
                 // то получим ее псевдоним
                 if ($joinParams['tableName'] == $joinTableForSort) {
                     $aliasTable = $alias;
                 }
             }
             if ($aliasTable) {
                 $order = $aliasTable . '.' . $order;
             } else {
                 // Получим поле сортировки
                 $arrOrder = explode(' ', trim($order));
                 $field = $arrOrder[0];
                 $order = 'l.' . $field . ' ' . $arrOrder[1];
             }
         } else {
             $order = 'l.' . $order;
         }
     }
     $select->order($order);
     return $select;
 }
开发者ID:bsa-git,项目名称:zf-myblog,代码行数:44,代码来源:BlogLog.php

示例11: joinFrom

 /**
  * WARNING: Only columns copying supported.
  * @param Lib_Model_Db_Mysql $model
  * @param string|null $thisKeyCol may contain table prefix or not
  * @param string|null $thatKeyCol may contain table prefix or not
  * @param string $conditions
  * @return $this
  */
 public function joinFrom($model, $thisKeyCol, $thatKeyCol = null, $conditions = '')
 {
     if ($thatKeyCol === null) {
         debug_assert($thisKeyCol !== null);
         $thatKeyCol = $model->getPrimaryKey();
     } elseif ($thisKeyCol === null) {
         debug_assert($thatKeyCol !== null);
         $thisKeyCol = $this->getPrimaryKey();
     }
     $this->prefixColumn($model, $thatKeyCol);
     $this->prefixColumn($this, $thisKeyCol);
     $conditions = str_replace('{that}', $model->getAlias(), $conditions);
     $conditions = str_replace('{this}', $this->getAlias(), $conditions);
     $this->mapPartWhere($this->addAliasToConditionDg());
     $model->mapPartWhere($model->addAliasToConditionDg());
     $thisFrom = $this->_select->getPart(Zend_Db_Select::FROM);
     $modelColumns = array_chain($model->_select->getPart(Zend_Db_Select::COLUMNS), array_group_dg(array_get_dg(return_dg(0))), array_map_val_dg(array_chain_dg(array_map_val_dg(function ($descriptor) {
         return null === $descriptor[2] ? $descriptor[1] : [$descriptor[2] => $descriptor[1]];
     }), function ($columns) {
         $outArray = [];
         array_map_val($columns, function ($column) use(&$outArray) {
             if (is_array($column)) {
                 array_map_val($column, function ($column, $alias) use(&$outArray) {
                     $outArray[$alias] = $column;
                 });
             } else {
                 $outArray[] = $column;
             }
         });
         return $outArray;
     })));
     array_each($model->_select->getPart(Zend_Db_Select::FROM), function ($descriptor, $alias) use($modelColumns, $thisFrom, $model, $thisKeyCol, $thatKeyCol, $conditions) {
         debug_enforce(!array_key_exists($alias, $thisFrom), "Alias `{$alias}` already used for table `{$descriptor['tableName']}`");
         switch ($descriptor['joinType']) {
             case Zend_Db_Select::FROM:
                 $this->_select->joinLeft([$model->getAlias() => $model->getTable()], "{$thisKeyCol}={$thatKeyCol} " . $conditions, array_key_exists($alias, $modelColumns) ? $modelColumns[$alias] : [], $descriptor['schema']);
                 break;
             case Zend_Db_Select::INNER_JOIN:
                 $this->_select->joinInner([$alias => $descriptor['tableName']], $descriptor['joinCondition'], array_key_exists($alias, $modelColumns) ? $modelColumns[$alias] : [], $descriptor['schema']);
                 break;
             case Zend_Db_Select::LEFT_JOIN:
                 $this->_select->joinLeft([$alias => $descriptor['tableName']], $descriptor['joinCondition'], array_key_exists($alias, $modelColumns) ? $modelColumns[$alias] : [], $descriptor['schema']);
                 break;
             case Zend_Db_Select::RIGHT_JOIN:
                 $this->_select->joinRight([$alias => $descriptor['tableName']], $descriptor['joinCondition'], array_key_exists($alias, $modelColumns) ? $modelColumns[$alias] : [], $descriptor['schema']);
                 break;
             case Zend_Db_Select::FULL_JOIN:
                 $this->_select->joinFull([$alias => $descriptor['tableName']], $descriptor['joinCondition'], array_key_exists($alias, $modelColumns) ? $modelColumns[$alias] : [], $descriptor['schema']);
                 break;
             case Zend_Db_Select::CROSS_JOIN:
                 $this->_select->joinCross([$alias => $descriptor['tableName']], $descriptor['joinCondition'], array_key_exists($alias, $modelColumns) ? $modelColumns[$alias] : [], $descriptor['schema']);
                 break;
             case Zend_Db_Select::NATURAL_JOIN:
                 $this->_select->joinNatural([$alias => $descriptor['tableName']], $descriptor['joinCondition'], array_key_exists($alias, $modelColumns) ? $modelColumns[$alias] : [], $descriptor['schema']);
                 break;
             default:
                 debug_assert(false, "Unknown join type " . var_dump_human_compact($descriptor['joinType']));
                 break;
         }
     });
     $this->settingsJoin($model);
     return $this;
 }
开发者ID:tapiau,项目名称:muyo,代码行数:71,代码来源:mysql.php

示例12: _modifySearchQuery

 protected function _modifySearchQuery(Zend_Db_Select &$select, $model)
 {
     $where = $select->getPart(Zend_Db_Select::WHERE);
     if (!$where) {
         return;
     }
     $select->reset(Zend_Db_Select::WHERE);
     foreach ($where as $clause) {
         // Check if it's a search query
         if (stripos($clause, 'like') !== false) {
             preg_match('/%.*?%/', $clause, $matches);
             if (!empty($matches[0])) {
                 $clause = $this->_cleanClause($clause);
                 $clause .= ' OR ' . $this->_joinCmsSearchQuery($model, $select, $matches[0]);
             }
         }
         // re-attach clause
         $whereBoolType = $this->_determineAndOrOr($clause);
         $clause = preg_replace('/(^OR|^AND)/', '', $clause);
         $clause = $this->_cleanClause($clause);
         if ($whereBoolType === 'OR') {
             $select->orWhere($clause);
             continue;
         }
         $select->where($clause);
     }
 }
开发者ID:grrr-amsterdam,项目名称:garp3,代码行数:27,代码来源:Translatable.php

示例13: _extractTableAlias

 /**
  * Extracts the current table's alias from a composed
  * query.
  * 
  * @param Zend_Db_Select $select 
  * @access protected
  * @return string
  */
 protected function _extractTableAlias($select)
 {
     $parts = $select->getPart('from');
     foreach ($parts as $alias => $part) {
         if ($part['tableName'] == $this->_name) {
             return $alias;
         }
     }
     return $this->_name;
 }
开发者ID:omusico,项目名称:logica,代码行数:18,代码来源:Model.php

示例14: 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

示例15: _getMainTableAliasFromSelect

 /**
  * @param Zend_Db_Select $select
  * @return string
  */
 protected function _getMainTableAliasFromSelect(Zend_Db_Select $select)
 {
     $tables = $select->getPart(Zend_Db_Select::FROM);
     return array_key_exists('main_table', $tables) ? 'main_table' : 'e';
 }
开发者ID:gewaechshaus,项目名称:groupscatalog2,代码行数:9,代码来源:Filter.php


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