Class constructor
Varien_Db_Select
__construct
( $adapter)
-
Zend_Db_Adapter_Abstract
$adapter
Cross Table Update From Current select
string
crossUpdateFromSelect
(string|array $table)
Retrieve DELETE query from select
string
deleteFromSelect
(string $table)
-
string
$table: The table name or alias
Insert to table from current select
string
insertFromSelect
(string $tableName, [array $fields = array()], [bool $onDuplicate = true])
-
string
$tableName
-
array
$fields
-
bool
$onDuplicate
Generate INSERT IGNORE query to the table from current select
string
insertIgnoreFromSelect
(string $tableName, [array $fields = array()])
-
string
$tableName
-
array
$fields
Add a STRAIGHT_JOIN table and colums to the query (MySQL only).
STRAIGHT_JOIN is similar to JOIN, except that the left table is always read before the right table. This can be used for those (few) cases for which the join optimizer puts the tables in the wrong order
The $name and $cols parameters follow the same logic as described in the from() method.
Zend_Db_Select
joinStraight
(array|string|Zend_Db_Expr $name, string $cond, [array|string $cols = self::SQL_WILDCARD], [string $schema = null])
-
array|string|Zend_Db_Expr
$name: The table name.
-
string
$cond: Join on this condition.
-
array|string
$cols: The columns to select from the joined table.
-
string
$schema: The database name to specify, if any.
Reset unused LEFT JOIN(s)
Modify (hack) part of the structured information for the currect query
-
string
$part
-
mixed
$value
Use a STRAIGHT_JOIN for the SQL Select
Zend_Db_Select
useStraightJoin
([bool $flag = true])
-
bool
$flag: Whether or not the SELECT use STRAIGHT_JOIN (default true).
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.
// 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));
Zend_Db_Select
where
(string $cond, [string $value = null], [constant $type = null])
-
string
$cond: The WHERE condition.
-
string
$value: OPTIONAL A single value to quote into the condition.
-
constant
$type: OPTIONAL The type of the given value
Find table name in condition (where, column)
bool
_findTableInCond
(string $table, string $cond)
-
string
$table
-
string
$cond
Render STRAIGHT_JOIN clause
string
_renderStraightjoin
(string $sql)