Paginator/Adapter/DbSelect.php

Show: PublicProtectedPrivateinherited
Table of Contents
Zend Framework
LICENSE This source file is subject to the new BSD license that is bundled with this package in the file LICENSE.txt. It is also available through the world-wide-web at this URL: http://framework.zend.com/license/new-bsd If you did not receive a copy of the license and are unable to obtain it through the world-wide-web, please send an email to license@zend.com so we can send you a copy immediately.
Category
Zend  
Copyright
Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)  
License
New BSD License  
Package
Zend_Paginator  
Version
$Id$  

\Zend_Paginator_Adapter_DbSelect

Package: Zend_Paginator
Implements
Children
\Zend_Paginator_Adapter_DbTableSelect
Category
Zend  
Copyright
Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)  
License
New BSD License  

Constants

>VConstantstring  ROW_COUNT_COLUMN = 'zend_paginator_row_count'
Name of the row count column
ROW_COUNT_COLUMN
string

Properties

>VPropertyprotectedstring $_cacheIdentifier = null
Identifies this adapter for caching purposes. This value will remain constant for the entire life of this adapter regardless of how many different pages are queried.
Default valuenullDetails
Type
string
>VPropertyprotected\Zend_Db_Select $_countSelect = null
The COUNT query
Default valuenullDetails
Type
\Zend_Db_Select
>VPropertyprotectedinteger $_rowCount = null
Total item count
Default valuenullDetails
Type
integer
>VPropertyprotected\Zend_Db_Select $_select = null
Database query
Default valuenullDetails
Type
\Zend_Db_Select

Methods

methodpublic__construct(\Zend_Db_Select $select) : void

Constructor.

Parameters
NameTypeDescription
$select\Zend_Db_Select

The select query

methodpubliccount() : integer

Returns the total number of rows in the result set.

Returns
TypeDescription
integer
methodpublicgetCacheIdentifier() : string

Returns the cache identifier.

Returns
TypeDescription
string
methodpublicgetCountSelect() : \Zend_Db_Select

Get the COUNT select object for the provided query

TODO: Have a look at queries that have both GROUP BY and DISTINCT specified. In that use-case I'm expecting problems when either GROUP BY or DISTINCT has one column.
Returns
TypeDescription
\Zend_Db_Select
methodpublicgetItems(integer $offset, integer $itemCountPerPage) : array

Returns an array of items for a page.

Parameters
NameTypeDescription
$offsetinteger

Page offset

$itemCountPerPageinteger

Number of items per page

Returns
TypeDescription
array
methodpublicsetRowCount( $rowCount) : \Zend_Paginator_Adapter_DbSelect

Sets the total row count, either directly or through a supplied query. Without setting this, {@link getPages()} selects the count as a subquery (SELECT COUNT .

.. FROM (SELECT ...)). While this yields an accurate count even with queries containing clauses like LIMIT, it can be slow in some circumstances. For example, in MySQL, subqueries are generally slow when using the InnoDB storage engine. Users are therefore encouraged to profile their queries to find the solution that best meets their needs.
Parameters
NameTypeDescription
$rowCount
Returns
TypeDescription
\Zend_Paginator_Adapter_DbSelect$this
Throws
ExceptionDescription
\Zend_Paginator_Exception
Documentation was generated by phpDocumentor 2.2.0 .