diff options
Diffstat (limited to 'system/database/drivers/oci8')
-rwxr-xr-x[-rw-r--r--] | system/database/drivers/oci8/index.html | 0 | ||||
-rwxr-xr-x[-rw-r--r--] | system/database/drivers/oci8/oci8_driver.php | 113 | ||||
-rwxr-xr-x[-rw-r--r--] | system/database/drivers/oci8/oci8_forge.php | 36 | ||||
-rwxr-xr-x[-rw-r--r--] | system/database/drivers/oci8/oci8_result.php | 34 | ||||
-rwxr-xr-x[-rw-r--r--] | system/database/drivers/oci8/oci8_utility.php | 39 |
5 files changed, 92 insertions, 130 deletions
diff --git a/system/database/drivers/oci8/index.html b/system/database/drivers/oci8/index.html index c942a79ce..c942a79ce 100644..100755 --- a/system/database/drivers/oci8/index.html +++ b/system/database/drivers/oci8/index.html 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; - } + } // -------------------------------------------------------------------- diff --git a/system/database/drivers/oci8/oci8_forge.php b/system/database/drivers/oci8/oci8_forge.php index d77ed8de6..3cd17585a 100644..100755 --- a/system/database/drivers/oci8/oci8_forge.php +++ b/system/database/drivers/oci8/oci8_forge.php @@ -2,11 +2,11 @@ /** * 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. + * @copyright Copyright (c) 2008 - 2011, EllisLab, Inc. * @license http://codeigniter.com/user_guide/license.html * @link http://codeigniter.com * @since Version 1.0 @@ -66,12 +66,12 @@ class CI_DB_oci8_forge extends CI_DB_forge { function _create_table($table, $fields, $primary_keys, $keys, $if_not_exists) { $sql = 'CREATE TABLE '; - + if ($if_not_exists === TRUE) { $sql .= 'IF NOT EXISTS '; } - + $sql .= $this->db->_escape_identifiers($table)." ("; $current_field_count = 0; @@ -87,41 +87,41 @@ class CI_DB_oci8_forge extends CI_DB_forge { else { $attributes = array_change_key_case($attributes, CASE_UPPER); - + $sql .= "\n\t".$this->db->_protect_identifiers($field); - + $sql .= ' '.$attributes['TYPE']; - + if (array_key_exists('CONSTRAINT', $attributes)) { $sql .= '('.$attributes['CONSTRAINT'].')'; } - + if (array_key_exists('UNSIGNED', $attributes) && $attributes['UNSIGNED'] === TRUE) { $sql .= ' UNSIGNED'; } - + if (array_key_exists('DEFAULT', $attributes)) { $sql .= ' DEFAULT \''.$attributes['DEFAULT'].'\''; } - + if (array_key_exists('NULL', $attributes) && $attributes['NULL'] === TRUE) { $sql .= ' NULL'; } else { - $sql .= ' NOT NULL'; + $sql .= ' NOT NULL'; } - + if (array_key_exists('AUTO_INCREMENT', $attributes) && $attributes['AUTO_INCREMENT'] === TRUE) { $sql .= ' AUTO_INCREMENT'; } } - + // don't add a comma on the end of the last field if (++$current_field_count < count($fields)) { @@ -141,17 +141,17 @@ class CI_DB_oci8_forge extends CI_DB_forge { { if (is_array($key)) { - $key = $this->db->_protect_identifiers($key); + $key = $this->db->_protect_identifiers($key); } else { $key = array($this->db->_protect_identifiers($key)); } - + $sql .= ",\n\tUNIQUE COLUMNS (" . implode(', ', $key) . ")"; } } - + $sql .= "\n)"; return $sql; @@ -218,9 +218,9 @@ class CI_DB_oci8_forge extends CI_DB_forge { { $sql .= ' AFTER ' . $this->db->_protect_identifiers($after_field); } - + return $sql; - + } // -------------------------------------------------------------------- diff --git a/system/database/drivers/oci8/oci8_result.php b/system/database/drivers/oci8/oci8_result.php index cab538e21..88531b436 100644..100755 --- a/system/database/drivers/oci8/oci8_result.php +++ b/system/database/drivers/oci8/oci8_result.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 */ @@ -21,7 +21,7 @@ * This class extends the parent result class: CI_DB_result * * @category Database - * @author ExpressionEngine Dev Team + * @author ExpressionEngine Dev Team * @link http://codeigniter.com/user_guide/database/ */ class CI_DB_oci8_result extends CI_DB_result { @@ -35,7 +35,7 @@ class CI_DB_oci8_result extends CI_DB_result { * * Oracle doesn't have a graceful way to retun the number of rows * so we have to use what amounts to a hack. - * + * * * @access public * @return integer @@ -111,7 +111,7 @@ class CI_DB_oci8_result extends CI_DB_result { $fieldCount = $this->num_fields(); for ($c = 1; $c <= $fieldCount; $c++) { - $F = new stdClass(); + $F = new stdClass(); $F->name = ocicolumnname($this->stmt_id, $c); $F->type = ocicolumntype($this->stmt_id, $c); $F->max_length = ocicolumnsize($this->stmt_id, $c); @@ -128,12 +128,12 @@ class CI_DB_oci8_result extends CI_DB_result { * Free the result * * @return null - */ + */ function free_result() { if (is_resource($this->result_id)) { - ocifreestatement($this->result_id); + ocifreestatement($this->result_id); $this->result_id = FALSE; } } @@ -151,8 +151,8 @@ class CI_DB_oci8_result extends CI_DB_result { function _fetch_assoc(&$row) { $id = ($this->curs_id) ? $this->curs_id : $this->stmt_id; - - return ocifetchinto($id, $row, OCI_ASSOC + OCI_RETURN_NULLS); + + return ocifetchinto($id, $row, OCI_ASSOC + OCI_RETURN_NULLS); } // -------------------------------------------------------------------- @@ -166,17 +166,17 @@ class CI_DB_oci8_result extends CI_DB_result { * @return object */ function _fetch_object() - { + { $result = array(); // If PHP 5 is being used we can fetch an result object if (function_exists('oci_fetch_object')) { $id = ($this->curs_id) ? $this->curs_id : $this->stmt_id; - + return @oci_fetch_object($id); } - + // If PHP 4 is being used we have to build our own result foreach ($this->result_array() as $key => $val) { @@ -192,7 +192,7 @@ class CI_DB_oci8_result extends CI_DB_result { { $obj->$key = $val; } - + $result[] = $obj; } diff --git a/system/database/drivers/oci8/oci8_utility.php b/system/database/drivers/oci8/oci8_utility.php index 74670eaab..854b467e1 100644..100755 --- a/system/database/drivers/oci8/oci8_utility.php +++ b/system/database/drivers/oci8/oci8_utility.php @@ -2,11 +2,11 @@ /** * 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. + * @copyright Copyright (c) 2008 - 2011, EllisLab, Inc. * @license http://codeigniter.com/user_guide/license.html * @link http://codeigniter.com * @since Version 1.0 @@ -81,41 +81,6 @@ class CI_DB_oci8_utility extends CI_DB_utility { // Currently unsupported return $this->db->display_error('db_unsuported_feature'); } - - /** - * - * The functions below have been deprecated as of 1.6, and are only here for backwards - * compatibility. They now reside in dbforge(). The use of dbutils for database manipulation - * is STRONGLY discouraged in favour if using dbforge. - * - */ - - /** - * Create database - * - * @access public - * @param string the database name - * @return bool - */ - function _create_database($name) - { - return FALSE; - } - - // -------------------------------------------------------------------- - - /** - * Drop database - * - * @access private - * @param string the database name - * @return bool - */ - function _drop_database($name) - { - return FALSE; - } - } /* End of file oci8_utility.php */ |