本文整理汇总了PHP中Zend_Db_Select::getBind方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Db_Select::getBind方法的具体用法?PHP Zend_Db_Select::getBind怎么用?PHP Zend_Db_Select::getBind使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Db_Select
的用法示例。
在下文中一共展示了Zend_Db_Select::getBind方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: query
/**
* Special handling for PDO query().
* All bind parameter names must begin with ':'
*
* @param string|Zend_Db_Select $sql The SQL statement with placeholders.
* @param array $bind An array of data to bind to the placeholders.
* @return Zend_Db_Statement_Pdo
* @throws Zend_Db_Adapter_Exception To re-throw PDOException.
*/
public function query($sql, $bind = array())
{
if (empty($bind) && $sql instanceof Zend_Db_Select) {
$bind = $sql->getBind();
}
if (!empty($bind)) {
foreach ($bind as $name => $value) {
if ($value instanceof Zend_Date) {
$bind[$name] = $value->toString('yyyy-MM-dd HH:mm:ss');
}
}
}
return parent::query($sql, $bind);
}
示例2: query
/**
* Special handling for PDO query().
* All bind parameter names must begin with ':'
*
* @param string|Zend_Db_Select $sql The SQL statement with placeholders.
* @param array $bind An array of data to bind to the placeholders.
* @return Zend_Db_Statement_Pdo
* @throws Zend_Db_Adapter_Exception To re-throw PDOException.
*/
public function query($sql, $bind = array())
{
if (empty($bind) && $sql instanceof Zend_Db_Select) {
$bind = $sql->getBind();
}
if (is_array($bind)) {
foreach ($bind as $name => $value) {
if (!is_int($name) && !preg_match('/^:/', $name)) {
$newName = ":{$name}";
unset($bind[$name]);
$bind[$newName] = $value;
}
}
}
try {
return parent::query($sql, $bind);
} catch (PDOException $e) {
/**
* @see Zend_Db_Statement_Exception
*/
require_once 'Zend/Db/Statement/Exception.php';
throw new Zend_Db_Statement_Exception($e->getMessage(), $e->getCode(), $e);
}
}
示例3: query
/**
* Special handling for PDO query().
* All bind parameter names must begin with ':'
*
* @param string|Zend_Db_Select $sql The SQL statement with placeholders.
* @param array $bind An array of data to bind to the placeholders.
* @return Zend_Db_Statement_Pdo
* @throws Zend_Db_Adapter_Exception To re-throw PDOException.
*/
public function query($sql, $bind = array())
{
if (empty($bind) && $sql instanceof Zend_Db_Select) {
$bind = $sql->getBind();
}
if (is_array($bind)) {
foreach ($bind as $name => $value) {
if (!is_int($name) && !preg_match('/^:/', $name)) {
$newName = ":{$name}";
unset($bind[$name]);
$bind[$newName] = $value;
}
}
}
// Bubble_Debug start
$start = microtime(true);
$result = parent::query($sql, $bind);
if (class_exists('Mage')) {
Mage::dispatchEvent('bubble_debug_sql_query_before', array('adapter' => $this, 'query' => $sql, 'bind' => $bind, 'took' => microtime(true) - $start));
}
return $result;
// Bubble_Debug end
try {
return parent::query($sql, $bind);
} catch (PDOException $e) {
/**
* @see Zend_Db_Statement_Exception
*/
#require_once 'Zend/Db/Statement/Exception.php';
throw new Zend_Db_Statement_Exception($e->getMessage(), $e->getCode(), $e);
}
}