diff options
author | Andrey Andreev <narf@bofh.bg> | 2012-01-05 20:43:17 +0100 |
---|---|---|
committer | Andrey Andreev <narf@bofh.bg> | 2012-01-05 20:43:17 +0100 |
commit | 6ea08e60670e4bb7ce184b695d515626d472489d (patch) | |
tree | 35abe7aa4834dd61cbcc271861421195709e5c22 | |
parent | 7b62bff30cd80b6ddde4489f8a59948766334c20 (diff) |
Fix issue 413
-rw-r--r-- | system/database/drivers/oci8/oci8_driver.php | 29 |
1 files changed, 25 insertions, 4 deletions
diff --git a/system/database/drivers/oci8/oci8_driver.php b/system/database/drivers/oci8/oci8_driver.php index cc9557e7d..dea08ffe4 100644 --- a/system/database/drivers/oci8/oci8_driver.php +++ b/system/database/drivers/oci8/oci8_driver.php @@ -528,8 +528,7 @@ class CI_DB_oci8_driver extends CI_DB { */ protected function _error_message() { - // If the error was during connection, no conn_id should be passed - $error = is_resource($this->conn_id) ? oci_error($this->conn_id) : oci_error(); + $error = self::_get_error_data(); return $error['message']; } @@ -542,13 +541,35 @@ class CI_DB_oci8_driver extends CI_DB { */ protected function _error_number() { - // Same as _error_message() - $error = is_resource($this->conn_id) ? oci_error($this->conn_id) : oci_error(); + $error = self::_get_error_data(); return $error['code']; } // -------------------------------------------------------------------- + /* Get error data + * + * Used by _error_message() and _error_number() + * + * @return array + */ + private function _get_error_data() + { + $res = NULL; + foreach (array('curs_id', 'stmt_id', 'conn_id') as $key) + { + if (is_resource($this->$key)) + { + $res = $key; + break; + } + } + + return ( ! is_null($res)) ? oci_error($res) : oci_error(); + } + + // -------------------------------------------------------------------- + /** * Escape the SQL Identifiers * |