Index: Zend/Db/Statement/Mysqli.php =================================================================== --- Zend/Db/Statement/Mysqli.php (revision 10908) +++ Zend/Db/Statement/Mysqli.php (working copy) @@ -81,7 +81,7 @@ * @see Zend_Db_Statement_Mysqli_Exception */ require_once 'Zend/Db/Statement/Mysqli/Exception.php'; - throw new Zend_Db_Statement_Mysqli_Exception("Mysqli prepare error: " . $mysqli->error); + throw new Zend_Db_Statement_Mysqli_Exception("Mysqli prepare error: " . $mysqli->error, $mysqli->errno); } } @@ -212,7 +212,7 @@ * @see Zend_Db_Statement_Mysqli_Exception */ require_once 'Zend/Db/Statement/Mysqli/Exception.php'; - throw new Zend_Db_Statement_Mysqli_Exception("Mysqli statement execute error : " . $this->_stmt->error); + throw new Zend_Db_Statement_Mysqli_Exception("Mysqli statement execute error : " . $this->_stmt->error, $this->_stmt->errno); } @@ -224,7 +224,7 @@ * @see Zend_Db_Statement_Mysqli_Exception */ require_once 'Zend/Db/Statement/Mysqli/Exception.php'; - throw new Zend_Db_Statement_Mysqli_Exception("Mysqli statement metadata error: " . $this->_stmt->error); + throw new Zend_Db_Statement_Mysqli_Exception("Mysqli statement metadata error: " . $this->_stmt->error, $this->_stmt->errno); } } Index: Zend/Db/Statement/Mysqli/Exception.php =================================================================== --- Zend/Db/Statement/Mysqli/Exception.php (revision 10908) +++ Zend/Db/Statement/Mysqli/Exception.php (working copy) @@ -19,7 +19,7 @@ */ /** - * Zend_Db_Statement_Exception + * @see Zend_Db_Statement_Exception */ require_once 'Zend/Db/Statement/Exception.php'; @@ -31,6 +31,31 @@ */ class Zend_Db_Statement_Mysqli_Exception extends Zend_Db_Statement_Exception -{ +{ + /** + * @var string + * @access protected + */ + protected $message = 'Unknown exception'; + + /** + * @var string + * @access protected + */ + protected $code = 0; + + /** + * Override default constructor to provide both error message and + * error code to the exception + * + * @param string $msg + * @param int $code + * @return void + */ + function __construct($error = null, $code = 0) + { + $this->message = $error; + $this->code = $code; + } }