import v1.1.0_beta1 | 2009-08-21
This commit is contained in:
@ -81,6 +81,13 @@ class Zend_Db_Select
|
||||
const SQL_ASC = 'ASC';
|
||||
const SQL_DESC = 'DESC';
|
||||
|
||||
/**
|
||||
* Bind variables for query
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $_bind = array();
|
||||
|
||||
/**
|
||||
* Zend_Db_Adapter_Abstract object.
|
||||
*
|
||||
@ -159,6 +166,29 @@ class Zend_Db_Select
|
||||
$this->_parts = self::$_partsInit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get bind variables
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getBind()
|
||||
{
|
||||
return $this->_bind;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set bind variables
|
||||
*
|
||||
* @param mixed $bind
|
||||
* @return Zend_Db_Select
|
||||
*/
|
||||
public function bind($bind)
|
||||
{
|
||||
$this->_bind = $bind;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Makes the query SELECT DISTINCT.
|
||||
*
|
||||
@ -632,10 +662,15 @@ class Zend_Db_Select
|
||||
* Executes the current select object and returns the result
|
||||
*
|
||||
* @param integer $fetchMode OPTIONAL
|
||||
* @param mixed $bind An array of data to bind to the placeholders.
|
||||
* @return PDO_Statement|Zend_Db_Statement
|
||||
*/
|
||||
public function query($fetchMode = null)
|
||||
public function query($fetchMode = null, $bind = array())
|
||||
{
|
||||
if (!empty($bind)) {
|
||||
$this->bind($bind);
|
||||
}
|
||||
|
||||
$stmt = $this->_adapter->query($this);
|
||||
if ($fetchMode == null) {
|
||||
$fetchMode = $this->_adapter->getFetchMode();
|
||||
@ -730,7 +765,7 @@ class Zend_Db_Select
|
||||
$correlationName = $_correlationName;
|
||||
} else {
|
||||
// We assume just an array of identifiers, with no correlation name
|
||||
$tableName = $name;
|
||||
$tableName = $_tableName;
|
||||
$correlationName = $this->_uniqueCorrelation($tableName);
|
||||
}
|
||||
break;
|
||||
@ -1233,7 +1268,7 @@ class Zend_Db_Select
|
||||
trigger_error($e->getMessage(), E_USER_WARNING);
|
||||
$sql = '';
|
||||
}
|
||||
return $sql;
|
||||
return (string)$sql;
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user