Class for SQL SELECT generation and results.
Located in /Db/Select.php (line 44)
Class | Description |
---|---|
![]() |
Class for SQL SELECT query manipulation for the Zend_Db_Table component. |
Specify legal join types.
The initial values for the $_parts array.
NOTE: It is important for the 'FOR_UPDATE' part to be last to ensure meximum compatibility with database adapters.
Specify legal union types.
Zend_Db_Adapter_Abstract object.
Bind variables for query
The component parts of a SELECT statement.
Initialized to the $_partsInit array in the constructor.
Tracks which columns are being select from each table and join.
Converts this object to an SQL SELECT string.
Specifies the columns used in the FROM clause.
The parameter can be a single string or Zend_Db_Expr object, or else an array of strings or Zend_Db_Expr objects.
Makes the query SELECT DISTINCT.
Makes the query SELECT FOR UPDATE.
Adds a FROM table and optional columns to the query.
The first parameter $name can be a simple string, in which case the correlation name is generated automatically. If you want to specify the correlation name, the first parameter must be an associative array in which the key is the physical table name, and the value is the correlation name. For example, array('table' => 'alias'). The correlation name is prepended to all columns fetched for this table.
The second parameter can be a single string or Zend_Db_Expr object, or else an array of strings or Zend_Db_Expr objects.
The first parameter can be null or an empty string, in which case no correlation name is generated or prepended to the columns named in the second parameter.
Gets the Zend_Db_Adapter_Abstract for this particular Zend_Db_Select object.
Get bind variables
Get part of the structured information for the currect query.
Adds grouping to the query.
Adds a HAVING condition to the query by AND.
If a value is passed as the second param, it will be quoted and replaced into the condition wherever a question-mark appears. See where() for an example
Adds a JOIN table and columns to the query.
The $name and $cols parameters follow the same logic as described in the from() method.
Add a CROSS JOIN table and colums to the query.
A cross join is a cartesian product; there is no join condition.
The $name and $cols parameters follow the same logic as described in the from() method.
Add a FULL OUTER JOIN table and colums to the query.
A full outer join is like combining a left outer join and a right outer join. All rows from both tables are included, paired with each other on the same row of the result set if they satisfy the join condition, and otherwise paired with NULLs in place of columns from the other table.
The $name and $cols parameters follow the same logic as described in the from() method.
Add an INNER JOIN table and colums to the query
Rows in both tables are matched according to the expression in the $cond argument. The result set is comprised of all cases where rows from the left table match rows from the right table.
The $name and $cols parameters follow the same logic as described in the from() method.
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.
The $name and $cols parameters follow the same logic as described in the from() method.
Add a NATURAL JOIN table and colums to the query.
A natural join assumes an equi-join across any column(s) that appear with the same name in both tables. Only natural inner joins are supported by this API, even though SQL permits natural outer joins as well.
The $name and $cols parameters follow the same logic as described in the from() method.
Add a RIGHT OUTER JOIN table and colums to the query.
Right outer join is the complement of left outer join. All rows from the right operand table are included, matching rows from the left operand table included, and the columns from the left operand table are filled with NULLs if no row exists matching the right table.
The $name and $cols parameters follow the same logic as described in the from() method.
Sets a limit count and offset to the query.
Sets the limit and count by page number.
Adds a row order to the query.
Adds a HAVING condition to the query by OR.
Otherwise identical to orHaving().
Adds a WHERE condition to the query by OR.
Otherwise identical to where().
Executes the current select object and returns the result
Clear parts of the Select object, or an individual part.
Class constructor
Adds a UNION clause to the query.
The first parameter has to be an array of Zend_Db_Select or sql query strings.
Adds a WHERE condition to the query by AND.
If a value is passed as the second param, it will be quoted and replaced into the condition wherever a question-mark appears. Array values are quoted and comma-separated.
Note that it is more correct to use named bindings in your queries for values other than strings. When you use named bindings, don't forget to pass the values when actually making a query:
Return a quoted schema name
Return a quoted table name
Populate the $_parts 'join' key
Does the dirty work of populating the join key.
The $name and $cols parameters follow the same logic as described in the from() method.
Handle JOIN... USING... syntax
This is functionality identical to the existing JOIN methods, however the join condition can be passed as a single column name. This method then completes the ON condition by using the same field for the FROM table and the JOIN table.
These joins are called by the developer simply by adding 'Using' to the method name. E.g. * joinUsing * joinInnerUsing * joinFullUsing * joinRightUsing * joinLeftUsing
Render DISTINCT clause
Render DISTINCT clause
Render FOR UPDATE clause
Render FROM clause
Render GROUP clause
Render HAVING clause
Render LIMIT OFFSET clause
Render ORDER clause
Render UNION query
Render WHERE clause
Adds to the internal table-to-column mapping array.
Internal function for creating the where clause
Turn magic function calls into non-magic function calls for joinUsing syntax
Implements magic method.
Documentation generated on Mon, 21 Jun 2010 15:43:54 -0400 by phpDocumentor 1.4.3