summaryrefslogtreecommitdiffstats
path: root/system/database
diff options
context:
space:
mode:
authorAndrey Andreev <narf@bofh.bg>2012-03-01 19:11:15 +0100
committerAndrey Andreev <narf@bofh.bg>2012-03-01 19:11:15 +0100
commit601f8b209d93fe70786776d9170eed5e23201e58 (patch)
treee0628e24d3e5c2d07b7101b4827f28e4755d0ea3 /system/database
parente3a68042c086acfc98ae273adbd8527af0c6ab8b (diff)
Fix issue #413 (Oracle _error_message(), _error_number())
Diffstat (limited to 'system/database')
-rw-r--r--system/database/drivers/oci8/oci8_driver.php38
1 files changed, 30 insertions, 8 deletions
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,19 +542,43 @@ 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
*
* This function escapes column and table names