Zend Framework  1.12
Public Member Functions | Protected Attributes | List of all members
Zend_Db_Table_Select Class Reference

Public Member Functions

 __construct (Zend_Db_Table_Abstract $table)
 Class constructor.
 
 getTable ()
 Return the table that created this select object.
 
 setTable (Zend_Db_Table_Abstract $table)
 Sets the primary table name and retrieves the table schema.
 
 setIntegrityCheck ($flag=true)
 Sets the integrity check flag.
 
 isReadOnly ()
 Tests query to determine if expressions or aliases columns exist.
 
 from ($name, $cols=self::SQL_WILDCARD, $schema=null)
 Adds a FROM table and optional columns to the query.
 
 assemble ()
 Performs a validation on the select query before passing back to the parent class.
 
- Public Member Functions inherited from Zend_Db_Select
 __construct (Zend_Db_Adapter_Abstract $adapter)
 Class constructor.
 
 getBind ()
 Get bind variables.
 
 bind ($bind)
 Set bind variables.
 
 distinct ($flag=true)
 Makes the query SELECT DISTINCT.
 
 from ($name, $cols= '*', $schema=null)
 Adds a FROM table and optional columns to the query.
 
 columns ($cols= '*', $correlationName=null)
 Specifies the columns used in the FROM clause.
 
 union ($select=array(), $type=self::SQL_UNION)
 Adds a UNION clause to the query.
 
 join ($name, $cond, $cols=self::SQL_WILDCARD, $schema=null)
 Adds a JOIN table and columns to the query.
 
 joinInner ($name, $cond, $cols=self::SQL_WILDCARD, $schema=null)
 Add an INNER JOIN table and colums to the query Rows in both tables are matched according to the expression in the $cond argument.
 
 joinLeft ($name, $cond, $cols=self::SQL_WILDCARD, $schema=null)
 Add a LEFT OUTER JOIN table and colums to the query All rows from the left operand table are included, matching rows from the right operand table included, and the columns from the right operand table are filled with NULLs if no row exists matching the left table.
 
 joinRight ($name, $cond, $cols=self::SQL_WILDCARD, $schema=null)
 Add a RIGHT OUTER JOIN table and colums to the query.
 
 joinFull ($name, $cond, $cols=self::SQL_WILDCARD, $schema=null)
 Add a FULL OUTER JOIN table and colums to the query.
 
 joinCross ($name, $cols=self::SQL_WILDCARD, $schema=null)
 Add a CROSS JOIN table and colums to the query.
 
 joinNatural ($name, $cols=self::SQL_WILDCARD, $schema=null)
 Add a NATURAL JOIN table and colums to the query.
 
 where ($cond, $value=null, $type=null)
 Adds a WHERE condition to the query by AND.
 
 orWhere ($cond, $value=null, $type=null)
 Adds a WHERE condition to the query by OR.
 
 group ($spec)
 Adds grouping to the query.
 
 having ($cond, $value=null, $type=null)
 Adds a HAVING condition to the query by AND.
 
 orHaving ($cond, $value=null, $type=null)
 Adds a HAVING condition to the query by OR.
 
 order ($spec)
 Adds a row order to the query.
 
 limit ($count=null, $offset=null)
 Sets a limit count and offset to the query.
 
 limitPage ($page, $rowCount)
 Sets the limit and count by page number.
 
 forUpdate ($flag=true)
 Makes the query SELECT FOR UPDATE.
 
 getPart ($part)
 Get part of the structured information for the current query.
 
 query ($fetchMode=null, $bind=array())
 Executes the current select object and returns the result.
 
 assemble ()
 Converts this object to an SQL SELECT string.
 
 reset ($part=null)
 Clear parts of the Select object, or an individual part.
 
 getAdapter ()
 Gets the Zend_Db_Adapter_Abstract for this particular Zend_Db_Select object.
 
 _joinUsing ($type, $name, $cond, $cols= '*', $schema=null)
 Handle JOIN...
 
 __call ($method, array $args)
 Turn magic function calls into non-magic function calls for joinUsing syntax.
 
 __toString ()
 Implements magic method.
 

Protected Attributes

 $_info
 
 $_integrityCheck = true
 
 $_table
 
- Protected Attributes inherited from Zend_Db_Select
 $_bind = array()
 
 $_adapter
 
 $_parts = array()
 
 $_tableCols = array()
 

Additional Inherited Members

- Public Attributes inherited from Zend_Db_Select
const DISTINCT = 'distinct'
 
const COLUMNS = 'columns'
 
const FROM = 'from'
 
const UNION = 'union'
 
const WHERE = 'where'
 
const GROUP = 'group'
 
const HAVING = 'having'
 
const ORDER = 'order'
 
const LIMIT_COUNT = 'limitcount'
 
const LIMIT_OFFSET = 'limitoffset'
 
const FOR_UPDATE = 'forupdate'
 
const INNER_JOIN = 'inner join'
 
const LEFT_JOIN = 'left join'
 
const RIGHT_JOIN = 'right join'
 
const FULL_JOIN = 'full join'
 
const CROSS_JOIN = 'cross join'
 
const NATURAL_JOIN = 'natural join'
 
const SQL_WILDCARD = '*'
 
const SQL_SELECT = 'SELECT'
 
const SQL_UNION = 'UNION'
 
const SQL_UNION_ALL = 'UNION ALL'
 
const SQL_FROM = 'FROM'
 
const SQL_WHERE = 'WHERE'
 
const SQL_DISTINCT = 'DISTINCT'
 
const SQL_GROUP_BY = 'GROUP BY'
 
const SQL_ORDER_BY = 'ORDER BY'
 
const SQL_HAVING = 'HAVING'
 
const SQL_FOR_UPDATE = 'FOR UPDATE'
 
const SQL_AND = 'AND'
 
const SQL_AS = 'AS'
 
const SQL_OR = 'OR'
 
const SQL_ON = 'ON'
 
const SQL_ASC = 'ASC'
 
const SQL_DESC = 'DESC'
 
- Protected Member Functions inherited from Zend_Db_Select
 _join ($type, $name, $cond, $cols, $schema=null)
 Populate the $_parts 'join' key.
 
 _tableCols ($correlationName, $cols, $afterCorrelationName=null)
 Adds to the internal table-to-column mapping array.
 
 _where ($condition, $value=null, $type=null, $bool=true)
 Internal function for creating the where clause.
 
 _getDummyTable ()
 
 _getQuotedSchema ($schema=null)
 Return a quoted schema name.
 
 _getQuotedTable ($tableName, $correlationName=null)
 Return a quoted table name.
 
 _renderDistinct ($sql)
 Render DISTINCT clause.
 
 _renderColumns ($sql)
 Render DISTINCT clause.
 
 _renderFrom ($sql)
 Render FROM clause.
 
 _renderUnion ($sql)
 Render UNION query.
 
 _renderWhere ($sql)
 Render WHERE clause.
 
 _renderGroup ($sql)
 Render GROUP clause.
 
 _renderHaving ($sql)
 Render HAVING clause.
 
 _renderOrder ($sql)
 Render ORDER clause.
 
 _renderLimitoffset ($sql)
 Render LIMIT OFFSET clause.
 
 _renderForupdate ($sql)
 Render FOR UPDATE clause.
 
- Static Protected Attributes inherited from Zend_Db_Select
static $_partsInit
 
static $_joinTypes
 
static $_unionTypes
 

Constructor & Destructor Documentation

__construct ( Zend_Db_Table_Abstract  $table)

Class constructor.

Parameters
Zend_Db_Table_Abstract$adapter

Member Function Documentation

assemble ( )

Performs a validation on the select query before passing back to the parent class.

Ensures that only columns from the primary Zend_Db_Table are returned in the result.

Returns
string|null This object as a SELECT string (or null if a string cannot be produced)
from (   $name,
  $cols = self::SQL_WILDCARD,
  $schema = null 
)

Adds a FROM table and optional columns to the query.

The table name can be expressed

Parameters
array | string | Zend_Db_Expr | Zend_Db_Table_Abstract$nameThe table name or an associative array relating table name to correlation name.
array | string | Zend_Db_Expr$colsThe columns to select from this table.
string$schemaThe schema name to specify, if any.
Returns
Zend_Db_Table_Select This Zend_Db_Table_Select object.
getTable ( )

Return the table that created this select object.

Returns
Zend_Db_Table_Abstract
isReadOnly ( )

Tests query to determine if expressions or aliases columns exist.

Returns
boolean
setIntegrityCheck (   $flag = true)

Sets the integrity check flag.

Setting this flag to false skips the checks for table joins, allowing 'hybrid' table rows to be created.

Parameters
Zend_Db_Table_Abstract$adapter
Returns
Zend_Db_Select This Zend_Db_Select object.
setTable ( Zend_Db_Table_Abstract  $table)

Sets the primary table name and retrieves the table schema.

Parameters
Zend_Db_Table_Abstract$adapter
Returns
Zend_Db_Select This Zend_Db_Select object.

Member Data Documentation

$_info
protected
$_integrityCheck = true
protected
$_table
protected