/** * Special handling for PDO query(). * All bind parameter names must begin with ':' * * @param string|JO_Db_Select $sql The SQL statement with placeholders. * @param array $bind An array of data to bind to the placeholders. * @return JO_Db_Statement_Pdo * @throws JO_Db_Adapter_Exception To re-throw PDOException. */ public function query($sql, $bind = array()) { if (empty($bind) && $sql instanceof JO_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 JO_Db_Statement_Exception */ require_once 'JO/Db/Statement/Exception.php'; throw new JO_Db_Statement_Exception($e->getMessage(), $e->getCode(), $e); } }