diff options
author | Timothy Warren <tim@timshomepage.net> | 2012-03-02 15:07:04 +0100 |
---|---|---|
committer | Timothy Warren <tim@timshomepage.net> | 2012-03-02 15:07:04 +0100 |
commit | d33dab14c5d812d30f48d9a5f6324bb230e77203 (patch) | |
tree | 9f56e656e54c68d4a971b7985269f3c1cba1c696 /system/database/drivers/pdo | |
parent | eabc5ec81209ec83393222f2964098aedf6dbc7a (diff) | |
parent | 4be5de1d11eefd9f0b7cf0589a2942f067cefe35 (diff) |
Merge upstream
Diffstat (limited to 'system/database/drivers/pdo')
-rw-r--r-- | system/database/drivers/pdo/pdo_driver.php | 35 |
1 files changed, 18 insertions, 17 deletions
diff --git a/system/database/drivers/pdo/pdo_driver.php b/system/database/drivers/pdo/pdo_driver.php index 90f0fd791..de5e1f05e 100644 --- a/system/database/drivers/pdo/pdo_driver.php +++ b/system/database/drivers/pdo/pdo_driver.php @@ -609,29 +609,30 @@ class CI_DB_pdo_driver extends CI_DB { // -------------------------------------------------------------------- /** - * The error message string + * Error * - * @access private - * @return string + * Returns an array containing code and message of the last + * database error that has occured. + * + * @return array */ - function _error_message() + public function error() { - $error_array = $this->conn_id->errorInfo(); + $error = array('code' => '00000', 'message' => ''); + $pdo_error = $this->conn_id->errorInfo(); - return $error_array[2]; - } + if (empty($pdo_error[0])) + { + return $error; + } - // -------------------------------------------------------------------- + $error['code'] = isset($pdo_error[1]) ? $pdo_error[0].'/'.$pdo_error[1] : $pdo_error[0]; + if (isset($pdo_error[2])) + { + $error['message'] = $pdo_error[2]; + } - /** - * The error message number - * - * @access private - * @return integer - */ - function _error_number() - { - return $this->conn_id->errorCode(); + return $error; } // -------------------------------------------------------------------- |