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')
-rwxr-xr-x[-rw-r--r--]system/database/drivers/oci8/oci8_driver.php113
1 files changed, 55 insertions, 58 deletions
diff --git a/system/database/drivers/oci8/oci8_driver.php b/system/database/drivers/oci8/oci8_driver.php
index 758192358..64f53cc3f 100644..100755
--- a/system/database/drivers/oci8/oci8_driver.php
+++ b/system/database/drivers/oci8/oci8_driver.php
@@ -2,14 +2,14 @@
/**
* CodeIgniter
*
- * An open source application development framework for PHP 4.3.2 or newer
+ * An open source application development framework for PHP 5.1.6 or newer
*
- * @package CodeIgniter
- * @author ExpressionEngine Dev Team
- * @copyright Copyright (c) 2008 - 2010, EllisLab, Inc.
- * @license http://codeigniter.com/user_guide/license.html
+ * @package CodeIgniter
+ * @author ExpressionEngine Dev Team
+ * @copyright Copyright (c) 2008 - 2011, EllisLab, Inc.
+ * @license http://codeigniter.com/user_guide/license.html
* @link http://codeigniter.com
- * @since Version 1.0
+ * @since Version 1.0
* @filesource
*/
@@ -22,10 +22,10 @@
* creates dynamically based on whether the active record
* class is being used or not.
*
- * @package CodeIgniter
+ * @package CodeIgniter
* @subpackage Drivers
* @category Database
- * @author ExpressionEngine Dev Team
+ * @author ExpressionEngine Dev Team
* @link http://codeigniter.com/user_guide/database/
*/
@@ -44,14 +44,14 @@
class CI_DB_oci8_driver extends CI_DB {
var $dbdriver = 'oci8';
-
+
// The character used for excaping
var $_escape_char = '"';
-
+
// clause and character used for LIKE escape sequences
var $_like_escape_str = " escape '%s' ";
var $_like_escape_chr = '!';
-
+
/**
* The syntax to count rows is slightly different across different
* database engines, so this string appears in each driver and is
@@ -141,7 +141,7 @@ class CI_DB_oci8_driver extends CI_DB {
}
// --------------------------------------------------------------------
-
+
/**
* Version number query string
*
@@ -248,7 +248,7 @@ class CI_DB_oci8_driver extends CI_DB {
}
return FALSE;
}
-
+
// build the query string
$sql = "begin $package.$procedure(";
@@ -256,20 +256,20 @@ class CI_DB_oci8_driver extends CI_DB {
foreach($params as $param)
{
$sql .= $param['name'] . ",";
-
+
if (array_key_exists('type', $param) && ($param['type'] == OCI_B_CURSOR))
{
$have_cursor = TRUE;
}
}
$sql = trim($sql, ",") . "); end;";
-
+
$this->stmt_id = FALSE;
$this->_set_stmt_id($sql);
$this->_bind_params($params);
$this->query($sql, FALSE, $have_cursor);
}
-
+
// --------------------------------------------------------------------
/**
@@ -284,10 +284,10 @@ class CI_DB_oci8_driver extends CI_DB {
{
return;
}
-
+
foreach ($params as $param)
{
- foreach (array('name', 'value', 'type', 'length') as $val)
+ foreach (array('name', 'value', 'type', 'length') as $val)
{
if ( ! isset($param[$val]))
{
@@ -305,26 +305,26 @@ class CI_DB_oci8_driver extends CI_DB {
* Begin Transaction
*
* @access public
- * @return bool
- */
+ * @return bool
+ */
function trans_begin($test_mode = FALSE)
{
if ( ! $this->trans_enabled)
{
return TRUE;
}
-
+
// When transactions are nested we only begin/commit/rollback the outermost ones
if ($this->_trans_depth > 0)
{
return TRUE;
}
-
+
// Reset the transaction failure flag.
// If the $test_mode flag is set to TRUE transactions will be rolled back
// even if the queries produce a successful result.
$this->_trans_failure = ($test_mode === TRUE) ? TRUE : FALSE;
-
+
$this->_commit = OCI_DEFAULT;
return TRUE;
}
@@ -335,8 +335,8 @@ class CI_DB_oci8_driver extends CI_DB {
* Commit Transaction
*
* @access public
- * @return bool
- */
+ * @return bool
+ */
function trans_commit()
{
if ( ! $this->trans_enabled)
@@ -361,8 +361,8 @@ class CI_DB_oci8_driver extends CI_DB {
* Rollback Transaction
*
* @access public
- * @return bool
- */
+ * @return bool
+ */
function trans_rollback()
{
if ( ! $this->trans_enabled)
@@ -396,18 +396,15 @@ class CI_DB_oci8_driver extends CI_DB {
if (is_array($str))
{
foreach($str as $key => $val)
- {
+ {
$str[$key] = $this->escape_str($val, $like);
- }
-
- return $str;
- }
+ }
+
+ return $str;
+ }
- // Access the CI object
- $CI =& get_instance();
+ $str = remove_invisible_characters($str);
- $str = $CI->input->_remove_invisible_characters($str);
-
// escape LIKE condition wildcards
if ($like === TRUE)
{
@@ -415,7 +412,7 @@ class CI_DB_oci8_driver extends CI_DB {
array($this->_like_escape_chr.'%', $this->_like_escape_chr.'_', $this->_like_escape_chr.$this->_like_escape_chr),
$str);
}
-
+
return $str;
}
@@ -493,9 +490,9 @@ class CI_DB_oci8_driver extends CI_DB {
if ($prefix_limit !== FALSE AND $this->dbprefix != '')
{
- $sql .= " WHERE TABLE_NAME LIKE '".$this->escape_like_str($this->dbprefix)."%' ".sprintf($this->_like_escape_str, $this->_like_escape_char);
+ $sql .= " WHERE TABLE_NAME LIKE '".$this->escape_like_str($this->dbprefix)."%' ".sprintf($this->_like_escape_str, $this->_like_escape_chr);
}
-
+
return $sql;
}
@@ -558,7 +555,7 @@ class CI_DB_oci8_driver extends CI_DB {
$error = ocierror($this->conn_id);
return $error['code'];
}
-
+
// --------------------------------------------------------------------
/**
@@ -581,26 +578,26 @@ class CI_DB_oci8_driver extends CI_DB {
{
if (strpos($item, '.'.$id) !== FALSE)
{
- $str = $this->_escape_char. str_replace('.', $this->_escape_char.'.', $item);
-
+ $str = $this->_escape_char. str_replace('.', $this->_escape_char.'.', $item);
+
// remove duplicates if the user already included the escape
return preg_replace('/['.$this->_escape_char.']+/', $this->_escape_char, $str);
- }
+ }
}
-
+
if (strpos($item, '.') !== FALSE)
{
- $str = $this->_escape_char.str_replace('.', $this->_escape_char.'.'.$this->_escape_char, $item).$this->_escape_char;
+ $str = $this->_escape_char.str_replace('.', $this->_escape_char.'.'.$this->_escape_char, $item).$this->_escape_char;
}
else
{
$str = $this->_escape_char.$item.$this->_escape_char;
}
-
+
// remove duplicates if the user already included the escape
return preg_replace('/['.$this->_escape_char.']+/', $this->_escape_char, $str);
}
-
+
// --------------------------------------------------------------------
/**
@@ -619,12 +616,12 @@ class CI_DB_oci8_driver extends CI_DB {
{
$tables = array($tables);
}
-
+
return implode(', ', $tables);
}
// --------------------------------------------------------------------
-
+
/**
* Insert statement
*
@@ -662,17 +659,17 @@ class CI_DB_oci8_driver extends CI_DB {
{
$valstr[] = $key." = ".$val;
}
-
+
$limit = ( ! $limit) ? '' : ' LIMIT '.$limit;
-
+
$orderby = (count($orderby) >= 1)?' ORDER BY '.implode(", ", $orderby):'';
-
+
$sql = "UPDATE ".$table." SET ".implode(', ', $valstr);
$sql .= ($where != '' AND count($where) >=1) ? " WHERE ".implode(" ", $where) : '';
$sql .= $orderby.$limit;
-
+
return $sql;
}
@@ -688,12 +685,12 @@ class CI_DB_oci8_driver extends CI_DB {
* @access public
* @param string the table name
* @return string
- */
+ */
function _truncate($table)
{
return "TRUNCATE TABLE ".$table;
}
-
+
// --------------------------------------------------------------------
/**
@@ -706,7 +703,7 @@ class CI_DB_oci8_driver extends CI_DB {
* @param array the where clause
* @param string the limit clause
* @return string
- */
+ */
function _delete($table, $where = array(), $like = array(), $limit = FALSE)
{
$conditions = '';
@@ -724,7 +721,7 @@ class CI_DB_oci8_driver extends CI_DB {
}
$limit = ( ! $limit) ? '' : ' LIMIT '.$limit;
-
+
return "DELETE FROM ".$table.$conditions.$limit;
}
@@ -755,7 +752,7 @@ class CI_DB_oci8_driver extends CI_DB {
$this->limit_used = TRUE;
return $newsql;
- }
+ }
// --------------------------------------------------------------------