summaryrefslogtreecommitdiffstats
path: root/system/database/drivers/oci8/oci8_driver.php
diff options
context:
space:
mode:
authorJohn Crepezzi <john.crepezzi@gmail.com>2012-03-04 19:20:44 +0100
committerJohn Crepezzi <john.crepezzi@gmail.com>2012-03-04 19:20:44 +0100
commit2baae203864cecd6f7c92b244c28dd18e0051d2c (patch)
tree29211c59a463e7865349def9c3f892d2bc3902c5 /system/database/drivers/oci8/oci8_driver.php
parentd5c0172e02b99278f4928897c1489cd628a50e2d (diff)
parentc8da4fe74d9cb0d456a18316fa9a0879d50e33f4 (diff)
Merge branch 'develop' of github.com:EllisLab/CodeIgniter into develop
Diffstat (limited to 'system/database/drivers/oci8/oci8_driver.php')
-rw-r--r--system/database/drivers/oci8/oci8_driver.php84
1 files changed, 34 insertions, 50 deletions
diff --git a/system/database/drivers/oci8/oci8_driver.php b/system/database/drivers/oci8/oci8_driver.php
index c6621901b..35cafff6c 100644
--- a/system/database/drivers/oci8/oci8_driver.php
+++ b/system/database/drivers/oci8/oci8_driver.php
@@ -139,30 +139,15 @@ class CI_DB_oci8_driver extends CI_DB {
// --------------------------------------------------------------------
/**
- * Set client character set
+ * Database version number
*
- * @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
- * @return string
+ * @return string
*/
- protected function _version()
+ public function version()
{
- return oci_server_version($this->conn_id);
+ return isset($this->data_cache['version'])
+ ? $this->data_cache['version']
+ : $this->data_cache['version'] = oci_server_version($this->conn_id);
}
// --------------------------------------------------------------------
@@ -398,10 +383,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 +399,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;
@@ -545,31 +528,32 @@ class CI_DB_oci8_driver extends CI_DB {
// --------------------------------------------------------------------
/**
- * The error message string
+ * Error
*
- * @access protected
- * @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();
- return $error['message'];
- }
-
- // --------------------------------------------------------------------
-
- /**
- * The error message number
+ * Returns an array containing code and message of the last
+ * database error that has occured.
*
- * @access protected
- * @return integer
+ * @return array
*/
- protected function _error_number()
+ public function error()
{
- // Same as _error_message()
- $error = is_resource($this->conn_id) ? oci_error($this->conn_id) : oci_error();
- return $error['code'];
+ /* oci_error() returns an array that already contains the
+ * 'code' and 'message' keys, so we can just return it.
+ */
+ 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();
}
// --------------------------------------------------------------------