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


PHP Zend_Db_Table_Select::limit方法代码示例

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


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

示例1: _applySelectOptions

 protected function _applySelectOptions(Zend_Db_Table_Select $select, array $options = array())
 {
     if (isset($options[self::OPTION_WHERE])) {
         foreach ((array) $options[self::OPTION_WHERE] as $where) {
             $select->where($where);
         }
     }
     if (isset($options[self::OPTION_OR_WHERE])) {
         foreach ((array) $options[self::OPTION_OR_WHERE] as $orWhere) {
             $select->orWhere($orWhere);
         }
     }
     if (isset($options[self::OPTION_HAVING])) {
         foreach ((array) $options[self::OPTION_HAVING] as $having) {
             $select->having($having);
         }
     }
     if (isset($options[self::OPTION_ORDER])) {
         foreach ((array) $options[self::OPTION_ORDER] as $order) {
             $select->order($order);
         }
     }
     $limit = isset($options[self::OPTION_LIMIT]) ? $options[self::OPTION_LIMIT] : null;
     $offset = isset($options[self::OPTION_OFFSET]) ? $options[self::OPTION_OFFSET] : null;
     $select->limit($limit, $offset);
     return $select;
 }
开发者ID:sitengine,项目名称:sitengine,代码行数:27,代码来源:List.php

示例2: limit

 public function limit($count = null, $offset = null)
 {
     if (is_array($count)) {
         $offset = $count['start'];
         $count = $count['limit'];
     }
     return parent::limit($count, $offset);
 }
开发者ID:xiaoguizhidao,项目名称:koala-framework,代码行数:8,代码来源:Select.php

示例3: _buildSelectObjLimitExpr

 /**
  * Builds order expression
  *
  * @param array $limitArray
  * 
  * @return Zend_Db_Select
  */
 private function _buildSelectObjLimitExpr($limitArray)
 {
     if (isset($limitArray['offset'])) {
         $this->select->limit($limitArray['limit'], $limitArray['offset']);
     } else {
         $this->select->limit($limitArray['limit']);
     }
     return $this->select;
 }
开发者ID:laiello,项目名称:zend-db-select-dynamic-finder,代码行数:16,代码来源:DynamicFinder.php

示例4: intval

 function __construct(Zend_Controller_Request_Abstract $request, array $orderFields, array $searchFields, Zend_Db_Table_Select $select, Zend_Db_Table_Select $selectFiltered)
 {
     // Load the params
     $iDisplayStart = $request->getParam('iDisplayStart');
     $iDisplayLength = $request->getParam('iDisplayLength');
     $iSortingCols = intval($request->getParam('iSortingCols'));
     $sSearch = $request->getParam('sSearch');
     // Build sort array
     $order = array();
     if ($iSortingCols > 0) {
         for ($i = 0; $i < $iSortingCols; $i++) {
             if (array_key_exists($request->getParam('iSortCol_' . $i), $orderFields)) {
                 $order[] = $orderFields[$request->getParam('iSortCol_' . $i)] . ' ' . strtoupper($request->getParam('sSortDir_' . $i));
             }
         }
     }
     // Count the total rows
     $selectCount = clone $select;
     if (count($selectCount->getPart(Zend_Db_Table_Select::GROUP)) <= 0) {
         $selectCount->reset(Zend_Db_Table_Select::COLUMNS)->columns(array('count' => 'COUNT(*)'));
         $this->_totalCount = $selectCount->getTable()->fetchRow($selectCount)->count;
     } else {
         $this->_totalCount = $selectCount->getTable()->fetchAll($selectCount)->count();
     }
     // Append search
     if ($sSearch !== null && $sSearch != '') {
         $sSearch = '\'%' . $sSearch . '%\'';
         $selectFiltered->where('(' . implode(' LIKE ' . $sSearch . ') OR (', $searchFields) . ' LIKE ' . $sSearch . ')');
     }
     // Count the filtered rows
     $selectCount = clone $selectFiltered;
     if (count($selectCount->getPart(Zend_Db_Table_Select::GROUP)) <= 0) {
         $selectCount->reset(Zend_Db_Table_Select::COLUMNS)->columns(array('count' => 'COUNT(*)'));
         $this->_filteredCount = $selectCount->getTable()->fetchRow($selectCount)->count;
     } else {
         $this->_filteredCount = $selectCount->getTable()->fetchAll($selectCount)->count();
     }
     // Load the limited result
     $selectFiltered->limit($iDisplayLength, $iDisplayStart);
     if (count($order) > 0) {
         $selectFiltered->order($order);
     }
     $this->_data = $selectFiltered->getTable()->fetchAll($selectFiltered);
 }
开发者ID:hausdesign,项目名称:zf-library,代码行数:44,代码来源:Datatable.php


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