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.
Class for SQL SELECT generation and results.
 DISTINCT = 'distinct'
      
 Details COLUMNS = 'columns'
      
 Details FROM = 'from'
      
 Details UNION = 'union'
      
 Details WHERE = 'where'
      
 Details GROUP = 'group'
      
 Details HAVING = 'having'
      
 Details ORDER = 'order'
      
 Details LIMIT_COUNT = 'limitcount'
      
 Details LIMIT_OFFSET = 'limitoffset'
      
 Details FOR_UPDATE = 'forupdate'
      
 Details INNER_JOIN = 'inner join'
      
 Details LEFT_JOIN = 'left join'
      
 Details RIGHT_JOIN = 'right join'
      
 Details FULL_JOIN = 'full join'
      
 Details CROSS_JOIN = 'cross join'
      
 Details NATURAL_JOIN = 'natural join'
      
 Details SQL_WILDCARD = '*'
      
 Details SQL_SELECT = 'SELECT'
      
 Details SQL_UNION = 'UNION'
      
 Details SQL_UNION_ALL = 'UNION ALL'
      
 Details SQL_FROM = 'FROM'
      
 Details SQL_WHERE = 'WHERE'
      
 Details SQL_DISTINCT = 'DISTINCT'
      
 Details SQL_GROUP_BY = 'GROUP BY'
      
 Details SQL_ORDER_BY = 'ORDER BY'
      
 Details SQL_HAVING = 'HAVING'
      
 Details SQL_FOR_UPDATE = 'FOR UPDATE'
      
 Details SQL_AND = 'AND'
      
 Details SQL_AS = 'AS'
      
 Details SQL_OR = 'OR'
      
 Details SQL_ON = 'ON'
      
 Details SQL_ASC = 'ASC'
      
 Details SQL_DESC = 'DESC'
      
 DetailsZend_Db_Adapter_Abstract $_adapter = ''Zend_Db_Adapter_Abstract object.
 Detailsarray $_bind = 'array'Bind variables for query
 Detailsarray $_joinTypes = 'array'Specify legal join types.
 Detailsarray $_parts = 'array'The component parts of a SELECT statement.
Initialized to the $_partsInit array in the constructor.
 Detailsarray $_partsInit = 'array'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.
 Detailsarray $_tableCols = 'array'Tracks which columns are being select from each table and join.
 Detailsarray $_unionTypes = 'array'Specify legal union types.
 Details__call(
          string $method, array $args
          )
        
        :
        Zend_Db_SelectTurn magic function calls into non-magic function calls for joinUsing syntax
 Details__construct(
          Zend_Db_Adapter_Abstract $adapter
          )
        
        :
        Class constructor
 Details__toString(
          
          )
        
        :
        stringImplements magic method.
 Details_getDummyTable(
          
          )
        
        :
        array
 Details_getQuotedSchema(
          string $schema
              =
              null
          )
        
        :
        string|nullReturn a quoted schema name
 Details_getQuotedTable(
          string $tableName, string $correlationName
              =
              null
          )
        
        :
        stringReturn a quoted table name
 Details_join(
          null|string $type, array|string|Zend_Db_Expr $name, string $cond, array|string $cols, string $schema
              =
              null
          )
        
        :
        Zend_Db_SelectPopulate the {@link $_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.
 Details_joinUsing(
           $type,  $name,  $cond,  $cols
              =
              *,  $schema
              =
              null
          )
        
        :
        Zend_Db_SelectHandle 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.
$select = $db->select()->from('table1')
                       ->joinUsing('table2', 'column1');
// SELECT * FROM table1 JOIN table2 ON table1.column1 = table2.column2
These joins are called by the developer simply by adding 'Using' to the method name. E.g. * joinUsing * joinInnerUsing * joinFullUsing * joinRightUsing * joinLeftUsing
 Details_renderColumns(
          string $sql
          )
        
        :
        string|nullRender DISTINCT clause
 Details_renderDistinct(
          string $sql
          )
        
        :
        stringRender DISTINCT clause
 Details_renderForupdate(
          string $sql
          )
        
        :
        stringRender FOR UPDATE clause
 Details_renderFrom(
          string $sql
          )
        
        :
        stringRender FROM clause
 Details_renderGroup(
          string $sql
          )
        
        :
        stringRender GROUP clause
 Details_renderHaving(
          string $sql
          )
        
        :
        stringRender HAVING clause
 Details_renderLimitoffset(
          string $sql
          )
        
        :
        stringRender LIMIT OFFSET clause
 Details_renderOrder(
          string $sql
          )
        
        :
        stringRender ORDER clause
 Details_renderUnion(
          string $sql
          )
        
        :
        stringRender UNION query
 Details_renderWhere(
          string $sql
          )
        
        :
        stringRender WHERE clause
 Details_tableCols(
           $correlationName, array|string $cols, bool|string $afterCorrelationName
              =
              null
          )
        
        :
        voidAdds to the internal table-to-column mapping array.
 Details_uniqueCorrelation(
          string|array $name
          )
        
        :
        stringGenerate a unique correlation name
 Details_where(
          string $condition, mixed $value
              =
              null, string $type
              =
              null, boolean $bool
              =
              true
          )
        
        :
        stringInternal function for creating the where clause
 Detailsassemble(
          
          )
        
        :
        string|nullConverts this object to an SQL SELECT string.
 Detailsbind(
          mixed $bind
          )
        
        :
        Zend_Db_SelectSet bind variables
 Detailscolumns(
          array|string|Zend_Db_Expr $cols
              =
              *, string $correlationName
              =
              null
          )
        
        :
        Zend_Db_SelectSpecifies 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.
 Detailsdistinct(
          bool $flag
              =
              true
          )
        
        :
        Zend_Db_SelectMakes the query SELECT DISTINCT.
 DetailsforUpdate(
          bool $flag
              =
              true
          )
        
        :
        Zend_Db_SelectMakes the query SELECT FOR UPDATE.
 Detailsfrom(
          array|string|Zend_Db_Expr $name, array|string|Zend_Db_Expr $cols
              =
              *, string $schema
              =
              null
          )
        
        :
        Zend_Db_SelectAdds 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.
 DetailsgetAdapter(
          
          )
        
        :
        Zend_Db_Adapter_AbstractGets the Zend_Db_Adapter_Abstract for this particular Zend_Db_Select object.
 DetailsgetBind(
          
          )
        
        :
        arrayGet bind variables
 DetailsgetPart(
          string $part
          )
        
        :
        mixedGet part of the structured information for the currect query.
 Detailsgroup(
          array|string $spec
          )
        
        :
        Zend_Db_SelectAdds grouping to the query.
 Detailshaving(
          string $cond
          )
        
        :
        Zend_Db_SelectAdds 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 {@link where()} for an example
 Detailsjoin(
          array|string|Zend_Db_Expr $name, string $cond, array|string $cols
              =
              self, string $schema
              =
              null
          )
        
        :
        Zend_Db_SelectAdds a JOIN table and columns to the query.
The $name and $cols parameters follow the same logic as described in the from() method.
 DetailsjoinCross(
          array|string|Zend_Db_Expr $name, array|string $cols
              =
              self, string $schema
              =
              null
          )
        
        :
        Zend_Db_SelectAdd 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.
 DetailsjoinFull(
          array|string|Zend_Db_Expr $name, string $cond, array|string $cols
              =
              self, string $schema
              =
              null
          )
        
        :
        Zend_Db_SelectAdd 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.
 DetailsjoinInner(
          array|string|Zend_Db_Expr $name, string $cond, array|string $cols
              =
              self, string $schema
              =
              null
          )
        
        :
        Zend_Db_SelectAdd 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.
 DetailsjoinLeft(
          array|string|Zend_Db_Expr $name, string $cond, array|string $cols
              =
              self, string $schema
              =
              null
          )
        
        :
        Zend_Db_SelectAdd 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.
 DetailsjoinNatural(
          array|string|Zend_Db_Expr $name, array|string $cols
              =
              self, string $schema
              =
              null
          )
        
        :
        Zend_Db_SelectAdd 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.
 DetailsjoinRight(
          array|string|Zend_Db_Expr $name, string $cond, array|string $cols
              =
              self, string $schema
              =
              null
          )
        
        :
        Zend_Db_SelectAdd 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.
 Detailslimit(
          int $count
              =
              null, int $offset
              =
              null
          )
        
        :
        Zend_Db_SelectSets a limit count and offset to the query.
 DetailslimitPage(
          int $page, int $rowCount
          )
        
        :
        Zend_Db_SelectSets the limit and count by page number.
 DetailsorHaving(
          string $cond
          )
        
        :
        Zend_Db_SelectAdds a HAVING condition to the query by OR.
Otherwise identical to orHaving().
 DetailsorWhere(
          string $cond, mixed $value
              =
              null, constant $type
              =
              null
          )
        
        :
        Zend_Db_SelectAdds a WHERE condition to the query by OR.
Otherwise identical to where().
 Detailsorder(
          mixed $spec
          )
        
        :
        Zend_Db_SelectAdds a row order to the query.
 Detailsquery(
          integer $fetchMode
              =
              null, mixed $bind
              =
              array
          )
        
        :
        PDO_Statement|Zend_Db_StatementExecutes the current select object and returns the result
 Detailsreset(
          string $part
              =
              null
          )
        
        :
        Zend_Db_SelectClear parts of the Select object, or an individual part.
 Detailsunion(
          array $select
              =
              array,  $type
              =
              self
          )
        
        :
        Zend_Db_SelectAdds a UNION clause to the query.
The first parameter has to be an array of Zend_Db_Select or sql query strings.
$sql1 = $db->select();
$sql2 = "SELECT ...";
$select = $db->select()
     ->union(array($sql1, $sql2))
     ->order("id");
 Detailswhere(
          string $cond, mixed $value
              =
              null, constant $type
              =
              null
          )
        
        :
        Zend_Db_SelectAdds 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.
// simplest but non-secure
$select->where("id = $id");
// secure (ID is quoted but matched anyway) $select->where('id = ?', $id);
// alternatively, with named binding $select->where('id = :id');
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:
$db->fetchAll($select, array('id' => 5));
 Details