From 601f8b209d93fe70786776d9170eed5e23201e58 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Thu, 1 Mar 2012 20:11:15 +0200 Subject: Fix issue #413 (Oracle _error_message(), _error_number()) --- system/database/drivers/oci8/oci8_driver.php | 38 ++++++++++++++++++++++------ 1 file changed, 30 insertions(+), 8 deletions(-) (limited to 'system/database') diff --git a/system/database/drivers/oci8/oci8_driver.php b/system/database/drivers/oci8/oci8_driver.php index d9acaaea6..6da6dc724 100644 --- a/system/database/drivers/oci8/oci8_driver.php +++ b/system/database/drivers/oci8/oci8_driver.php @@ -529,13 +529,11 @@ class CI_DB_oci8_driver extends CI_DB { /** * The error message string * - * @access protected - * @return string + * @return string */ 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 = $this->_oci8_error_data(); return $error['message']; } @@ -544,18 +542,42 @@ class CI_DB_oci8_driver extends CI_DB { /** * The error message number * - * @access protected - * @return integer + * @return string */ protected function _error_number() { - // Same as _error_message() - $error = is_resource($this->conn_id) ? oci_error($this->conn_id) : oci_error(); + $error = $this->_oci8_error_data(); return $error['code']; } // -------------------------------------------------------------------- + /** + * OCI8-specific method to get errors. + * Used by _error_message() and _error_code(). + * + * @return array + */ + protected function _oci8_error_data() + { + if (is_resource($this->curs_id)) + { + return oci_error($this->curs_id); + } + elseif (is_resource($this->stmt_id)) + { + return oci_error($this->stmt_id); + } + elseif (is_resource($this->conn_id)) + { + return oci_error($this->conn_id); + } + + return oci_error(); + } + + // -------------------------------------------------------------------- + /** * Escape the SQL Identifiers * -- cgit v1.2.3-24-g4f1b