summaryrefslogtreecommitdiffstats
path: root/system/database/drivers/oci8/oci8_driver.php
diff options
context:
space:
mode:
Diffstat (limited to 'system/database/drivers/oci8/oci8_driver.php')
-rw-r--r--system/database/drivers/oci8/oci8_driver.php68
1 files changed, 36 insertions, 32 deletions
diff --git a/system/database/drivers/oci8/oci8_driver.php b/system/database/drivers/oci8/oci8_driver.php
index c6621901b..6da6dc724 100644
--- a/system/database/drivers/oci8/oci8_driver.php
+++ b/system/database/drivers/oci8/oci8_driver.php
@@ -139,22 +139,6 @@ class CI_DB_oci8_driver extends CI_DB {
// --------------------------------------------------------------------
/**
- * Set client character set
- *
- * @access public
- * @param string
- * @param string
- * @return resource
- */
- public function db_set_charset($charset, $collation)
- {
- // this is done upon connect
- return TRUE;
- }
-
- // --------------------------------------------------------------------
-
- /**
* Version number query string
*
* @access protected
@@ -398,10 +382,9 @@ class CI_DB_oci8_driver extends CI_DB {
/**
* Escape String
*
- * @access public
- * @param string
+ * @param string
* @param bool whether or not the string will be used in a LIKE condition
- * @return string
+ * @return string
*/
public function escape_str($str, $like = FALSE)
{
@@ -415,15 +398,14 @@ class CI_DB_oci8_driver extends CI_DB {
return $str;
}
- $str = remove_invisible_characters($str);
- $str = str_replace("'", "''", $str);
+ $str = str_replace("'", "''", remove_invisible_characters($str));
// escape LIKE condition wildcards
if ($like === TRUE)
{
- $str = str_replace( array('%', '_', $this->_like_escape_chr),
- array($this->_like_escape_chr.'%', $this->_like_escape_chr.'_', $this->_like_escape_chr.$this->_like_escape_chr),
- $str);
+ return str_replace(array($this->_like_escape_chr, '%', '_'),
+ array($this->_like_escape_chr.$this->_like_escape_chr, $this->_like_escape_chr.'%', $this->_like_escape_chr.'_'),
+ $str);
}
return $str;
@@ -547,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'];
}
@@ -562,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