API Documentation

Paginator/Adapter/DbSelect.php

Includes Classes 
category
Zend
copyright
Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
license
http://framework.zend.com/license/new-bsd New BSD License
package
Zend_Paginator
version
$Id: DbSelect.php 20096 2010-01-06 02:05:09Z bkarwin $
Classes
Zend_Paginator_Adapter_DbSelect

Description

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.

Zend_Paginator_Adapter_DbSelect

Implements
Zend_Paginator_Adapter_Interface
category
Zend
copyright
Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
license
http://framework.zend.com/license/new-bsd New BSD License
package
Zend_Paginator
Constants
ROW_COUNT_COLUMN
Properties
$_countSelect
$_select
$_rowCount
Methods
__construct
setRowCount
getItems
count
getCountSelect

Description

Constants

ROW_COUNT_COLUMN

string ROW_COUNT_COLUMN = 'zend_paginator_row_count'

Name of the row count column

Details

value
zend_paginator_row_count
ROW_COUNT_COLUMN
string

Properties

$_countSelect

Zend_Db_Select $_countSelect = 'null'

The COUNT query

Details

$_countSelect
Zend_Db_Select
visibility
protected
default
null
final
false
static
false

$_rowCount

integer $_rowCount = 'null'

Total item count

Details

$_rowCount
integer
visibility
protected
default
null
final
false
static
false

$_select

Zend_Db_Select $_select = 'null'

Database query

Details

$_select
Zend_Db_Select
visibility
protected
default
null
final
false
static
false

Methods

__construct

__construct( Zend_Db_Select $select ) :

Constructor.

Arguments
$select
Zend_Db_Select
The select query
Details
visibility
public
final
false
static
false

count

count( ) : integer

Returns the total number of rows in the result set.

Output
integer
Details
visibility
public
final
false
static
false

getCountSelect

getCountSelect( ) : 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.

Details
visibility
public
final
false
static
false

getItems

getItems( integer $offset, integer $itemCountPerPage ) : array

Returns an array of items for a page.

Arguments
$offset
integer
Page offset
$itemCountPerPage
integer
Number of items per page
Output
array
Details
visibility
public
final
false
static
false

setRowCount

setRowCount(  $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.

Arguments
$rowCount
Details
visibility
public
final
false
static
false
throws
Documentation was generated by DocBlox.