本文整理汇总了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;
}
示例2: limit
public function limit($count = null, $offset = null)
{
if (is_array($count)) {
$offset = $count['start'];
$count = $count['limit'];
}
return parent::limit($count, $offset);
}
示例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;
}
示例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);
}