summaryrefslogtreecommitdiffstats
path: root/system/database
diff options
context:
space:
mode:
Diffstat (limited to 'system/database')
-rw-r--r--system/database/DB.php6
-rw-r--r--system/database/DB_active_rec.php34
-rw-r--r--system/database/DB_cache.php2
-rw-r--r--system/database/DB_driver.php176
-rw-r--r--system/database/DB_result.php52
-rw-r--r--system/database/DB_utility.php14
-rw-r--r--system/database/drivers/mssql/mssql_driver.php26
-rw-r--r--system/database/drivers/mssql/mssql_result.php10
-rw-r--r--system/database/drivers/mssql/mssql_utility.php6
-rw-r--r--system/database/drivers/mysql/mysql_driver.php44
-rw-r--r--system/database/drivers/mysql/mysql_result.php8
-rw-r--r--system/database/drivers/mysql/mysql_utility.php52
-rw-r--r--system/database/drivers/mysqli/mysqli_driver.php34
-rw-r--r--system/database/drivers/mysqli/mysqli_result.php10
-rw-r--r--system/database/drivers/mysqli/mysqli_utility.php54
-rw-r--r--system/database/drivers/oci8/oci8_driver.php902
-rw-r--r--system/database/drivers/oci8/oci8_result.php308
-rw-r--r--system/database/drivers/oci8/oci8_utility.php4
-rw-r--r--system/database/drivers/odbc/odbc_driver.php28
-rw-r--r--system/database/drivers/odbc/odbc_result.php8
-rw-r--r--system/database/drivers/odbc/odbc_utility.php8
-rw-r--r--system/database/drivers/postgre/postgre_driver.php28
-rw-r--r--system/database/drivers/postgre/postgre_result.php8
-rw-r--r--system/database/drivers/postgre/postgre_utility.php6
-rw-r--r--system/database/drivers/sqlite/sqlite_driver.php38
-rw-r--r--system/database/drivers/sqlite/sqlite_result.php6
-rw-r--r--system/database/drivers/sqlite/sqlite_utility.php6
27 files changed, 939 insertions, 939 deletions
diff --git a/system/database/DB.php b/system/database/DB.php
index d2afce982..c6bd365d9 100644
--- a/system/database/DB.php
+++ b/system/database/DB.php
@@ -7,7 +7,7 @@
* @package CodeIgniter
* @author Rick Ellis
* @copyright Copyright (c) 2006, pMachine, Inc.
- * @license http://www.codeignitor.com/user_guide/license.html
+ * @license http://www.codeignitor.com/user_guide/license.html
* @link http://www.codeigniter.com
* @since Version 1.0
* @filesource
@@ -46,7 +46,7 @@ function &DB($params = '', $active_record = FALSE)
}
// Load the DB classes. Note: Since the active record class is optional
- // we need to dynamically create a class that extends proper parent class
+ // we need to dynamically create a class that extends proper parent class
// based on whether we're using the active record class or not.
// Kudos to Paul for discovering this clever use of eval()
@@ -57,7 +57,7 @@ function &DB($params = '', $active_record = FALSE)
require_once(BASEPATH.'database/DB_driver'.EXT);
- if ( ! isset($params['active_r']) OR $params['active_r'] == TRUE)
+ if ( ! isset($params['active_r']) OR $params['active_r'] == TRUE)
{
require_once(BASEPATH.'database/DB_active_rec'.EXT);
diff --git a/system/database/DB_active_rec.php b/system/database/DB_active_rec.php
index 8db6161af..b41b929d7 100644
--- a/system/database/DB_active_rec.php
+++ b/system/database/DB_active_rec.php
@@ -7,17 +7,17 @@
* @package CodeIgniter
* @author Rick Ellis
* @copyright Copyright (c) 2006, pMachine, Inc.
- * @license http://www.codeignitor.com/user_guide/license.html
+ * @license http://www.codeignitor.com/user_guide/license.html
* @link http://www.codeigniter.com
* @since Version 1.0
* @filesource
*/
-
+
// ------------------------------------------------------------------------
/**
* Active Record Class
- *
+ *
* This is the platform-independent base Active Record implementation class.
*
* @package CodeIgniter
@@ -547,11 +547,11 @@ class CI_DB_active_record extends CI_DB_driver {
if (count($this->ar_set) == 0)
{
- if ($this->db_debug)
- {
+ if ($this->db_debug)
+ {
return $this->display_error('db_must_use_set');
- }
- return FALSE;
+ }
+ return FALSE;
}
if ($table == '')
@@ -596,11 +596,11 @@ class CI_DB_active_record extends CI_DB_driver {
if (count($this->ar_set) == 0)
{
- if ($this->db_debug)
- {
+ if ($this->db_debug)
+ {
return $this->display_error('db_must_use_set');
- }
- return FALSE;
+ }
+ return FALSE;
}
if ($table == '')
@@ -663,11 +663,11 @@ class CI_DB_active_record extends CI_DB_driver {
if (count($this->ar_where) == 0)
{
- if ($this->db_debug)
- {
+ if ($this->db_debug)
+ {
return $this->display_error('db_del_must_use_where');
- }
- return FALSE;
+ }
+ return FALSE;
}
$sql = $this->_delete($this->dbprefix.$table, $this->ar_where);
@@ -679,7 +679,7 @@ class CI_DB_active_record extends CI_DB_driver {
// --------------------------------------------------------------------
/**
- * Use Table - DEPRECATED
+ * Use Table - DEPRECATED
*
* @deprecated use $this->db->from instead
*/
@@ -726,7 +726,7 @@ class CI_DB_active_record extends CI_DB_driver {
/**
* Compile the SELECT statement
*
- * Generates a query string based on which functions were used.
+ * Generates a query string based on which functions were used.
* Should not be called directly. The get() function calls it.
*
* @access private
diff --git a/system/database/DB_cache.php b/system/database/DB_cache.php
index b469b0e1e..53425d1d9 100644
--- a/system/database/DB_cache.php
+++ b/system/database/DB_cache.php
@@ -7,7 +7,7 @@
* @package CodeIgniter
* @author Rick Ellis
* @copyright Copyright (c) 2006, pMachine, Inc.
- * @license http://www.codeignitor.com/user_guide/license.html
+ * @license http://www.codeignitor.com/user_guide/license.html
* @link http://www.codeigniter.com
* @since Version 1.0
* @filesource
diff --git a/system/database/DB_driver.php b/system/database/DB_driver.php
index 8a7b88f18..ab8a6a8e2 100644
--- a/system/database/DB_driver.php
+++ b/system/database/DB_driver.php
@@ -7,17 +7,17 @@
* @package CodeIgniter
* @author Rick Ellis
* @copyright Copyright (c) 2006, pMachine, Inc.
- * @license http://www.codeignitor.com/user_guide/license.html
+ * @license http://www.codeignitor.com/user_guide/license.html
* @link http://www.codeigniter.com
* @since Version 1.0
* @filesource
*/
-
+
// ------------------------------------------------------------------------
/**
* Database Driver Class
- *
+ *
* This is the platform-independent base DB implementation class.
* This class will not be called directly. Rather, the adapter
* class for the specific database will extend and instantiate it.
@@ -64,10 +64,10 @@ class CI_DB_driver {
/**
* Constructor. Accepts one parameter containing the database
- * connection settings.
+ * connection settings.
*
- * Database settings can be passed as discreet
- * parameters or as a data source name in the first
+ * Database settings can be passed as discreet
+ * parameters or as a data source name in the first
* parameter. DSNs must have this prototype:
* $dsn = 'driver://username:password@hostname/database';
*
@@ -93,16 +93,16 @@ class CI_DB_driver {
if (is_array($params))
{
$defaults = array(
- 'hostname' => '',
- 'username' => '',
- 'password' => '',
- 'database' => '',
- 'dbdriver' => 'mysql',
- 'dbprefix' => '',
- 'port' => '',
- 'pconnect' => FALSE,
- 'db_debug' => FALSE,
- 'cachedir' => '',
+ 'hostname' => '',
+ 'username' => '',
+ 'password' => '',
+ 'database' => '',
+ 'dbdriver' => 'mysql',
+ 'dbprefix' => '',
+ 'port' => '',
+ 'pconnect' => FALSE,
+ 'db_debug' => FALSE,
+ 'cachedir' => '',
'cache_on' => FALSE
);
@@ -132,9 +132,9 @@ class CI_DB_driver {
// Connect to the database
$this->conn_id = ($this->pconnect == FALSE) ? $this->db_connect() : $this->db_pconnect();
-
+
if ( ! $this->conn_id)
- {
+ {
log_message('error', 'Unable to connect to the database');
if ($this->db_debug)
@@ -162,7 +162,7 @@ class CI_DB_driver {
* The name of the platform in use (mysql, mssql, etc...)
*
* @access public
- * @return string
+ * @return string
*/
function platform()
{
@@ -172,7 +172,7 @@ class CI_DB_driver {
// --------------------------------------------------------------------
/**
- * Database Version Number. Returns a string containing the
+ * Database Version Number. Returns a string containing the
* version of the database being used
*
* @access public
@@ -204,16 +204,16 @@ class CI_DB_driver {
/**
* Execute the query
*
- * Accepts an SQL string as input and returns a result object upon
- * successful execution of a "read" type query. Returns boolean TRUE
- * upon successful execution of a "write" type query. Returns boolean
- * FALSE upon failure, and if the $db_debug variable is set to TRUE
+ * Accepts an SQL string as input and returns a result object upon
+ * successful execution of a "read" type query. Returns boolean TRUE
+ * upon successful execution of a "write" type query. Returns boolean
+ * FALSE upon failure, and if the $db_debug variable is set to TRUE
* will raise an error.
- *
+ *
* @access public
* @param string An SQL query string
* @param array An array of binding data
- * @return mixed
+ * @return mixed
*/
function query($sql, $binds = FALSE, $return_object = TRUE)
{
@@ -227,8 +227,8 @@ class CI_DB_driver {
return FALSE;
}
- // Is query caching enabled? If the query is a "read type"
- // we will load the caching class and return the previously
+ // Is query caching enabled? If the query is a "read type"
+ // we will load the caching class and return the previously
// cached query if it exists
if ($this->cache_on == TRUE AND stristr($sql, 'SELECT'))
{
@@ -253,10 +253,10 @@ class CI_DB_driver {
// Start the Query Timer
$time_start = list($sm, $ss) = explode(' ', microtime());
-
+
// Run the Query
if (FALSE === ($this->result_id = $this->simple_query($sql)))
- {
+ {
// This will trigger a rollback if transactions are being used
$this->_trans_failure = TRUE;
@@ -265,13 +265,13 @@ class CI_DB_driver {
log_message('error', 'Query error: '.$this->_error_message());
return $this->display_error(
array(
- 'Error Number: '.$this->_error_number(),
+ 'Error Number: '.$this->_error_number(),
$this->_error_message(),
$sql
)
);
}
-
+
return FALSE;
}
@@ -296,7 +296,7 @@ class CI_DB_driver {
return TRUE;
}
- // Return TRUE if we don't need to create a result object
+ // Return TRUE if we don't need to create a result object
// Currently only the Oracle driver uses this when stored
// procedures are used
if ($return_object !== TRUE)
@@ -318,7 +318,7 @@ class CI_DB_driver {
$RES->limit_used = $this->limit_used;
}
- // Is query caching enabled? If so, we'll serialize the
+ // Is query caching enabled? If so, we'll serialize the
// result object and save it to a cache file.
if ($this->cache_on == TRUE AND $this->_cache_init())
{
@@ -347,9 +347,9 @@ class CI_DB_driver {
/**
* Load the result drivers
- *
+ *
* @access public
- * @return string the name of the result class
+ * @return string the name of the result class
*/
function load_rdriver()
{
@@ -367,14 +367,14 @@ class CI_DB_driver {
// --------------------------------------------------------------------
/**
- * Simple Query
+ * Simple Query
* This is a simplified version of the query() function. Internally
* we only use it when running transaction commands since they do
* not require all the features of the main query() function.
- *
+ *
* @access public
* @param string the sql query
- * @return mixed
+ * @return mixed
*/
function simple_query($sql)
{
@@ -391,9 +391,9 @@ class CI_DB_driver {
/**
* Disable Transactions
* This permits transactions to be disabled at run-time.
- *
+ *
* @access public
- * @return void
+ * @return void
*/
function trans_off()
{
@@ -404,9 +404,9 @@ class CI_DB_driver {
/**
* Start Transaction
- *
+ *
* @access public
- * @return void
+ * @return void
*/
function trans_start($test_mode = FALSE)
{
@@ -429,9 +429,9 @@ class CI_DB_driver {
/**
* Complete Transaction
- *
+ *
* @access public
- * @return bool
+ * @return bool
*/
function trans_complete()
{
@@ -467,9 +467,9 @@ class CI_DB_driver {
/**
* Lets you retrieve the transaction flag to determine if it has failed
- *
+ *
* @access public
- * @return bool
+ * @return bool
*/
function trans_status()
{
@@ -480,11 +480,11 @@ class CI_DB_driver {
/**
* Compile Bindings
- *
+ *
* @access public
* @param string the sql statement
* @param array an array of bind data
- * @return string
+ * @return string
*/
function compile_binds($sql, $binds)
{
@@ -514,15 +514,15 @@ class CI_DB_driver {
// --------------------------------------------------------------------
/**
- * Determines if a query is a "write" type.
- *
+ * Determines if a query is a "write" type.
+ *
* @access public
* @param string An SQL query string
- * @return boolean
+ * @return boolean
*/
function is_write_type($sql)
{
- if ( ! preg_match('/^\s*"?(INSERT|UPDATE|DELETE|REPLACE|CREATE|DROP|LOAD DATA|COPY|ALTER|GRANT|REVOKE|LOCK|UNLOCK)\s+/i', $sql))
+ if ( ! preg_match('/^\s*"?(INSERT|UPDATE|DELETE|REPLACE|CREATE|DROP|LOAD DATA|COPY|ALTER|GRANT|REVOKE|LOCK|UNLOCK)\s+/i', $sql))
{
return FALSE;
}
@@ -532,11 +532,11 @@ class CI_DB_driver {
// --------------------------------------------------------------------
/**
- * Calculate the aggregate query elapsed time
- *
+ * Calculate the aggregate query elapsed time
+ *
* @access public
* @param integer The number of decimal places
- * @return integer
+ * @return integer
*/
function elapsed_time($decimals = 6)
{
@@ -547,9 +547,9 @@ class CI_DB_driver {
/**
* Returns the total number of queries
- *
+ *
* @access public
- * @return integer
+ * @return integer
*/
function total_queries()
{
@@ -560,9 +560,9 @@ class CI_DB_driver {
/**
* Returns the last query that was executed
- *
+ *
* @access public
- * @return void
+ * @return void
*/
function last_query()
{
@@ -576,10 +576,10 @@ class CI_DB_driver {
*
* Escapes data based on type
* Sets boolean and null types
- *
+ *
* @access public
* @param string
- * @return integer
+ * @return integer
*/
function escape($str)
{
@@ -605,10 +605,10 @@ class CI_DB_driver {
*
* Retrieves the primary key. It assumes that the row in the first
* position is the primary key
- *
+ *
* @access public
* @param string the table name
- * @return string
+ * @return string
*/
function primary($table = '')
{
@@ -626,9 +626,9 @@ class CI_DB_driver {
/**
* Returns an array of table names
- *
+ *
* @access public
- * @return array
+ * @return array
*/
function list_tables()
{
@@ -688,7 +688,7 @@ class CI_DB_driver {
*
* @access public
* @param string the table name
- * @return array
+ * @return array
*/
function list_fields($table = '')
{
@@ -754,7 +754,7 @@ class CI_DB_driver {
/**
* DEPRECATED - use list_fields()
*/
- function field_names($table = '')
+ function field_names($table = '')
{
return $this->list_fields($table);
}
@@ -763,10 +763,10 @@ class CI_DB_driver {
/**
* Returns an object with field data
- *
+ *
* @access public
* @param string the table name
- * @return object
+ * @return object
*/
function field_data($table = '')
{
@@ -787,18 +787,18 @@ class CI_DB_driver {
/**
* Generate an insert string
- *
+ *
* @access public
* @param string the table upon which the query will be performed
* @param array an associative array data of key/values
- * @return string
+ * @return string
*/
function insert_string($table, $data)
{
- $fields = array();
+ $fields = array();
$values = array();
- foreach($data as $key => $val)
+ foreach($data as $key => $val)
{
$fields[] = $key;
$values[] = $this->escape($val);
@@ -811,12 +811,12 @@ class CI_DB_driver {
/**
* Generate an update string
- *
+ *
* @access public
* @param string the table upon which the query will be performed
* @param array an associative array data of key/values
* @param mixed the "where" statement
- * @return string
+ * @return string
*/
function update_string($table, $data, $where)
{
@@ -824,7 +824,7 @@ class CI_DB_driver {
return false;
$fields = array();
- foreach($data as $key => $val)
+ foreach($data as $key => $val)
{
$fields[$key] = $this->escape($val);
}
@@ -861,11 +861,11 @@ class CI_DB_driver {
/**
* Enables a native PHP function to be run, using a platform agnostic wrapper.
- *
+ *
* @access public
* @param string the function name
* @param mixed any parameters needed by the function
- * @return mixed
+ * @return mixed
*/
function call_function($function)
{
@@ -877,7 +877,7 @@ class CI_DB_driver {
}
if ( ! function_exists($function))
- {
+ {
if ($this->db_debug)
{
return $this->display_error('db_unsupported_function');
@@ -888,7 +888,7 @@ class CI_DB_driver {
{
$args = (func_num_args() > 1) ? array_splice(func_get_args(), 1) : null;
- return call_user_func_array($function, $args);
+ return call_user_func_array($function, $args);
}
}
@@ -999,16 +999,16 @@ class CI_DB_driver {
/**
* Close DB Connection
- *
+ *
* @access public
- * @return void
+ * @return void
*/
function close()
{
if (is_resource($this->conn_id))
{
$this->_close($this->conn_id);
- }
+ }
$this->conn_id = FALSE;
}
@@ -1016,14 +1016,14 @@ class CI_DB_driver {
/**
* Display an error message
- *
+ *
* @access public
* @param string the error message
* @param string any "swap" values
* @param boolean whether to localize the message
- * @return string sends the application/error_db.php template
+ * @return string sends the application/error_db.php template
*/
- function display_error($error = '', $swap = '', $native = FALSE)
+ function display_error($error = '', $swap = '', $native = FALSE)
{
$LANG = new CI_Language();
$LANG->load('db');
@@ -1048,7 +1048,7 @@ class CI_DB_driver {
echo $error->show_error('An Error Was Encountered', $message, 'error_db');
exit;
- }
+ }
}
diff --git a/system/database/DB_result.php b/system/database/DB_result.php
index d02bfb96e..44f166d21 100644
--- a/system/database/DB_result.php
+++ b/system/database/DB_result.php
@@ -7,17 +7,17 @@
* @package CodeIgniter
* @author Rick Ellis
* @copyright Copyright (c) 2006, pMachine, Inc.
- * @license http://www.codeignitor.com/user_guide/license.html
+ * @license http://www.codeignitor.com/user_guide/license.html
* @link http://www.codeigniter.com
* @since Version 1.0
* @filesource
*/
-
+
// ------------------------------------------------------------------------
/**
* Database Result Class
- *
+ *
* This is the platform-independent result class.
* This class will not be called directly. Rather, the adapter
* class for the specific database will extend and instantiate it.
@@ -38,10 +38,10 @@ class CI_DB_result {
/**
* Query result. Acts as a wrapper function for the following functions.
- *
+ *
* @access public
* @param string can be "object" or "array"
- * @return mixed either a result object or array
+ * @return mixed either a result object or array
*/
function result($type = 'object')
{
@@ -52,9 +52,9 @@ class CI_DB_result {
/**
* Query result. "object" version.
- *
+ *
* @access public
- * @return object
+ * @return object
*/
function result_object()
{
@@ -70,7 +70,7 @@ class CI_DB_result {
$this->_data_seek(0);
while ($row = $this->_fetch_object())
- {
+ {
$this->result_object[] = $row;
}
@@ -81,9 +81,9 @@ class CI_DB_result {
/**
* Query result. "array" version.
- *
+ *
* @access public
- * @return array
+ * @return array
*/
function result_array()
{
@@ -110,10 +110,10 @@ class CI_DB_result {
/**
* Query result. Acts as a wrapper function for the following functions.
- *
+ *
* @access public
* @param string can be "object" or "array"
- * @return mixed either a result object or array
+ * @return mixed either a result object or array
*/
function row($n = 0, $type = 'object')
{
@@ -124,9 +124,9 @@ class CI_DB_result {
/**
* Returns a single result row - object version
- *
+ *
* @access public
- * @return object
+ * @return object
*/
function row_object($n = 0)
{
@@ -149,9 +149,9 @@ class CI_DB_result {
/**
* Returns a single result row - array version
- *
+ *
* @access public
- * @return array
+ * @return array
*/
function row_array($n = 0)
{
@@ -175,9 +175,9 @@ class CI_DB_result {
/**
* Returns the "first" row
- *
+ *
* @access public
- * @return object
+ * @return object
*/
function first_row($type = 'object')
{
@@ -194,9 +194,9 @@ class CI_DB_result {
/**
* Returns the "last" row
- *
+ *
* @access public
- * @return object
+ * @return object
*/
function last_row($type = 'object')
{
@@ -213,9 +213,9 @@ class CI_DB_result {
/**
* Returns the "next" row
- *
+ *
* @access public
- * @return object
+ * @return object
*/
function next_row($type = 'object')
{
@@ -238,9 +238,9 @@ class CI_DB_result {
/**
* Returns the "previous" row
- *
+ *
* @access public
- * @return object
+ * @return object
*/
function previous_row($type = 'object')
{
@@ -261,11 +261,11 @@ class CI_DB_result {
// --------------------------------------------------------------------
/**
- * The following functions are normally overloaded by the identically named
+ * The following functions are normally overloaded by the identically named
* methods in the platform-specific driver -- except when query caching
* is used. When caching is enabled we do not load the other driver.
* These functions are primarily here to prevent undefined function errors
- * when a cached result object is in use. They are not otherwise fully
+ * when a cached result object is in use. They are not otherwise fully
* operational due to the unavailability of the database resource IDs with
* cached results.
*/
diff --git a/system/database/DB_utility.php b/system/database/DB_utility.php
index 13fcaa5c9..e64e008bc 100644
--- a/system/database/DB_utility.php
+++ b/system/database/DB_utility.php
@@ -7,7 +7,7 @@
* @package CodeIgniter
* @author Rick Ellis
* @copyright Copyright (c) 2006, pMachine, Inc.
- * @license http://www.codeignitor.com/user_guide/license.html
+ * @license http://www.codeignitor.com/user_guide/license.html
* @link http://www.codeigniter.com
* @since Version 1.0
* @filesource
@@ -302,7 +302,7 @@ class CI_DB_utility {
}
$xml .= $tab."</{$element}>".$newline;
}
- $xml .= "</$root>".$newline;
+ $xml .= "</$root>".$newline;
return $xml;
}
@@ -371,13 +371,13 @@ class CI_DB_utility {
// Is the encoder supported? If not, we'll either issue an
// error or use plain text depending on the debug settings
- if (($prefs['format'] == 'gzip' AND ! @function_exists('gzencode'))
- OR ($prefs['format'] == 'zip' AND ! @function_exists('gzcompress')))
+ if (($prefs['format'] == 'gzip' AND ! @function_exists('gzencode'))
+ OR ($prefs['format'] == 'zip' AND ! @function_exists('gzcompress')))
{
- if ($this->db->db_debug)
- {
+ if ($this->db->db_debug)
+ {
return $this->db->display_error('db_unsuported_compression');
- }
+ }
$prefs['format'] = 'txt';
}
diff --git a/system/database/drivers/mssql/mssql_driver.php b/system/database/drivers/mssql/mssql_driver.php
index 4dc8792ca..a1d7d29ed 100644
--- a/system/database/drivers/mssql/mssql_driver.php
+++ b/system/database/drivers/mssql/mssql_driver.php
@@ -7,12 +7,12 @@
* @package CodeIgniter
* @author Rick Ellis
* @copyright Copyright (c) 2006, pMachine, Inc.
- * @license http://www.codeignitor.com/user_guide/license.html
+ * @license http://www.codeignitor.com/user_guide/license.html
* @link http://www.codeigniter.com
* @since Version 1.0
* @filesource
*/
-
+
// ------------------------------------------------------------------------
/**
@@ -106,18 +106,18 @@ class CI_DB_mssql_driver extends CI_DB {
* @param string an SQL query
* @return string
*/
- function _prep_query($sql)
- {
+ function _prep_query($sql)
+ {
return $sql;
- }
+ }
// --------------------------------------------------------------------
/**
* Begin Transaction
- *
+ *
* @access public
- * @return bool
+ * @return bool
*/
function trans_begin($test_mode = FALSE)
{
@@ -133,8 +133,8 @@ class CI_DB_mssql_driver extends CI_DB {
}
// 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.
+ // 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->simple_query('BEGIN TRAN');
@@ -145,9 +145,9 @@ class CI_DB_mssql_driver extends CI_DB {
/**
* Commit Transaction
- *
+ *
* @access public
- * @return bool
+ * @return bool
*/
function trans_commit()
{
@@ -170,9 +170,9 @@ class CI_DB_mssql_driver extends CI_DB {
/**
* Rollback Transaction
- *
+ *
* @access public
- * @return bool
+ * @return bool
*/
function trans_rollback()
{
diff --git a/system/database/drivers/mssql/mssql_result.php b/system/database/drivers/mssql/mssql_result.php
index 0ba0b8c57..230c1b55b 100644
--- a/system/database/drivers/mssql/mssql_result.php
+++ b/system/database/drivers/mssql/mssql_result.php
@@ -7,12 +7,12 @@
* @package CodeIgniter
* @author Rick Ellis
* @copyright Copyright (c) 2006, pMachine, Inc.
- * @license http://www.codeignitor.com/user_guide/license.html
+ * @license http://www.codeignitor.com/user_guide/license.html
* @link http://www.codeigniter.com
* @since Version 1.0
* @filesource
*/
-
+
// ------------------------------------------------------------------------
/**
@@ -65,7 +65,7 @@ class CI_DB_mssql_result extends CI_DB_result {
$field_names = array();
while ($field = mssql_fetch_field($this->result_id))
{
- $field_names[] = $field->name;
+ $field_names[] = $field->name;
}
return $field_names;
@@ -116,8 +116,8 @@ class CI_DB_mssql_result extends CI_DB_result {
{
if (is_resource($this->result_id))
{
- mssql_free_result($this->result_id);
- $this->result_id = FALSE;
+ mssql_free_result($this->result_id);
+ $this->result_id = FALSE;
}
}
diff --git a/system/database/drivers/mssql/mssql_utility.php b/system/database/drivers/mssql/mssql_utility.php
index 24ff1e13c..4a49f533e 100644
--- a/system/database/drivers/mssql/mssql_utility.php
+++ b/system/database/drivers/mssql/mssql_utility.php
@@ -7,12 +7,12 @@
* @package CodeIgniter
* @author Rick Ellis
* @copyright Copyright (c) 2006, pMachine, Inc.
- * @license http://www.codeignitor.com/user_guide/license.html
+ * @license http://www.codeignitor.com/user_guide/license.html
* @link http://www.codeigniter.com
* @since Version 1.0
* @filesource
*/
-
+
// ------------------------------------------------------------------------
/**
@@ -74,7 +74,7 @@ class CI_DB_mssql_utility extends CI_DB_utility {
*/
function _list_databases()
{
- return "EXEC sp_helpdb"; // Can also be: EXEC sp_databases
+ return "EXEC sp_helpdb"; // Can also be: EXEC sp_databases
}
// --------------------------------------------------------------------
diff --git a/system/database/drivers/mysql/mysql_driver.php b/system/database/drivers/mysql/mysql_driver.php
index 20311ffa0..be7c672f7 100644
--- a/system/database/drivers/mysql/mysql_driver.php
+++ b/system/database/drivers/mysql/mysql_driver.php
@@ -7,12 +7,12 @@
* @package CodeIgniter
* @author Rick Ellis
* @copyright Copyright (c) 2006, pMachine, Inc.
- * @license http://www.codeignitor.com/user_guide/license.html
+ * @license http://www.codeignitor.com/user_guide/license.html
* @link http://www.codeigniter.com
* @since Version 1.0
* @filesource
*/
-
+
// ------------------------------------------------------------------------
/**
@@ -32,10 +32,10 @@ class CI_DB_mysql_driver extends CI_DB {
/**
* Whether to use the MySQL "delete hack" which allows the number
- * of affected rows to be shown. Uses a preg_replace when enabled,
+ * of affected rows to be shown. Uses a preg_replace when enabled,
* adding a bit more processing to all queries.
*/
- var $delete_hack = TRUE;
+ var $delete_hack = TRUE;
/**
* Non-persistent database connection
@@ -113,28 +113,28 @@ class CI_DB_mysql_driver extends CI_DB {
* @param string an SQL query
* @return string
*/
- function _prep_query($sql)
- {
- // "DELETE FROM TABLE" returns 0 affected rows This hack modifies
+ function _prep_query($sql)
+ {
+ // "DELETE FROM TABLE" returns 0 affected rows This hack modifies
// the query so that it returns the number of affected rows
if ($this->delete_hack === TRUE)
{
- if (preg_match('/^\s*DELETE\s+FROM\s+(\S+)\s*$/i', $sql))
+ if (preg_match('/^\s*DELETE\s+FROM\s+(\S+)\s*$/i', $sql))
{
$sql = preg_replace("/^\s*DELETE\s+FROM\s+(\S+)\s*$/", "DELETE FROM \\1 WHERE 1=1", $sql);
}
}
return $sql;
- }
-
+ }
+
// --------------------------------------------------------------------
/**
* Begin Transaction
- *
+ *
* @access public
- * @return bool
+ * @return bool
*/
function trans_begin($test_mode = FALSE)
{
@@ -150,8 +150,8 @@ class CI_DB_mysql_driver extends CI_DB {
}
// 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.
+ // 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->simple_query('SET AUTOCOMMIT=0');
@@ -163,9 +163,9 @@ class CI_DB_mysql_driver extends CI_DB {
/**
* Commit Transaction
- *
+ *
* @access public
- * @return bool
+ * @return bool
*/
function trans_commit()
{
@@ -189,9 +189,9 @@ class CI_DB_mysql_driver extends CI_DB {
/**
* Rollback Transaction
- *
+ *
* @access public
- * @return bool
+ * @return bool
*/
function trans_rollback()
{
@@ -227,8 +227,8 @@ class CI_DB_mysql_driver extends CI_DB {
return $str;
}
- if (function_exists('mysql_real_escape_string'))
- {
+ if (function_exists('mysql_real_escape_string'))
+ {
return mysql_real_escape_string($str, $this->conn_id);
}
elseif (function_exists('mysql_escape_string'))
@@ -237,8 +237,8 @@ class CI_DB_mysql_driver extends CI_DB {
}
else
{
- return addslashes($str);
- }
+ return addslashes($str);
+ }
}
// --------------------------------------------------------------------
diff --git a/system/database/drivers/mysql/mysql_result.php b/system/database/drivers/mysql/mysql_result.php
index 1cf6ff188..4bfaf54a4 100644
--- a/system/database/drivers/mysql/mysql_result.php
+++ b/system/database/drivers/mysql/mysql_result.php
@@ -7,7 +7,7 @@
* @package CodeIgniter
* @author Rick Ellis
* @copyright Copyright (c) 2006, pMachine, Inc.
- * @license http://www.codeignitor.com/user_guide/license.html
+ * @license http://www.codeignitor.com/user_guide/license.html
* @link http://www.codeigniter.com
* @since Version 1.0
* @filesource
@@ -65,7 +65,7 @@ class CI_DB_mysql_result extends CI_DB_result {
$field_names = array();
while ($field = mysql_fetch_field($this->result_id))
{
- $field_names[] = $field->name;
+ $field_names[] = $field->name;
}
return $field_names;
@@ -116,8 +116,8 @@ class CI_DB_mysql_result extends CI_DB_result {
{
if (is_resource($this->result_id))
{
- mysql_free_result($this->result_id);
- $this->result_id = FALSE;
+ mysql_free_result($this->result_id);
+ $this->result_id = FALSE;
}
}
diff --git a/system/database/drivers/mysql/mysql_utility.php b/system/database/drivers/mysql/mysql_utility.php
index b387ace9e..b0a7dfea7 100644
--- a/system/database/drivers/mysql/mysql_utility.php
+++ b/system/database/drivers/mysql/mysql_utility.php
@@ -7,7 +7,7 @@
* @package CodeIgniter
* @author Rick Ellis
* @copyright Copyright (c) 2006, pMachine, Inc.
- * @license http://www.codeignitor.com/user_guide/license.html
+ * @license http://www.codeignitor.com/user_guide/license.html
* @link http://www.codeigniter.com
* @since Version 1.0
* @filesource
@@ -129,39 +129,39 @@ class CI_DB_mysql_utility extends CI_DB_utility {
// Build the output
$output = '';
- foreach ((array)$tables as $table)
- {
- // Is the table in the "ignore" list?
+ foreach ((array)$tables as $table)
+ {
+ // Is the table in the "ignore" list?
if (in_array($table, (array)$ignore, TRUE))
{
- continue;
- }
+ continue;
+ }
- // Get the table schema
+ // Get the table schema
$query = $this->db->query("SHOW CREATE TABLE `".$this->db->database.'`.'.$table);
// No result means the table name was invalid
- if ($query === FALSE)
- {
- continue;
- }
-
- // Write out the table schema
- $output .= '#'.$newline.'# TABLE STRUCTURE FOR: '.$table.$newline.'#'.$newline.$newline;
-
+ if ($query === FALSE)
+ {
+ continue;
+ }
+
+ // Write out the table schema
+ $output .= '#'.$newline.'# TABLE STRUCTURE FOR: '.$table.$newline.'#'.$newline.$newline;
+
if ($add_drop == TRUE)
{
- $output .= 'DROP TABLE IF EXISTS '.$table.';'.$newline.$newline;
+ $output .= 'DROP TABLE IF EXISTS '.$table.';'.$newline.$newline;
}
$i = 0;
$result = $query->result_array();
foreach ($result[0] as $val)
{
- if ($i++ % 2)
- {
- $output .= $val.';'.$newline.$newline;
- }
+ if ($i++ % 2)
+ {
+ $output .= $val.';'.$newline.$newline;
+ }
}
// If inserts are not needed we're done...
@@ -179,7 +179,7 @@ class CI_DB_mysql_utility extends CI_DB_utility {
}
// Fetch the field names and determine if the field is an
- // integer type. We use this info to decide whether to
+ // integer type. We use this info to decide whether to
// surround the data with quotes or not
$i = 0;
@@ -188,13 +188,13 @@ class CI_DB_mysql_utility extends CI_DB_utility {
while ($field = mysql_fetch_field($query->result_id))
{
$is_int[$i] = (in_array(
- strtolower(mysql_field_type($query->result_id, $i)),
- array('tinyint', 'smallint', 'mediumint', 'int', 'bigint', 'timestamp'),
+ strtolower(mysql_field_type($query->result_id, $i)),
+ array('tinyint', 'smallint', 'mediumint', 'int', 'bigint', 'timestamp'),
TRUE)
) ? TRUE : FALSE;
// Create a string of field names
- $field_str .= $field->name.', ';
+ $field_str .= $field->name.', ';
$i++;
}
@@ -211,8 +211,8 @@ class CI_DB_mysql_utility extends CI_DB_utility {
foreach ($row as $v)
{
// Do a little formatting...
- $v = str_replace(array("\x00", "\x0a", "\x0d", "\x1a"), array('\0', '\n', '\r', '\Z'), $v);
- $v = str_replace(array("\n", "\r", "\t"), array('\n', '\r', '\t'), $v);
+ $v = str_replace(array("\x00", "\x0a", "\x0d", "\x1a"), array('\0', '\n', '\r', '\Z'), $v);
+ $v = str_replace(array("\n", "\r", "\t"), array('\n', '\r', '\t'), $v);
$v = str_replace('\\', '\\\\', $v);
$v = str_replace('\'', '\\\'', $v);
$v = str_replace('\\\n', '\n', $v);
diff --git a/system/database/drivers/mysqli/mysqli_driver.php b/system/database/drivers/mysqli/mysqli_driver.php
index ea2adbea9..59420912f 100644
--- a/system/database/drivers/mysqli/mysqli_driver.php
+++ b/system/database/drivers/mysqli/mysqli_driver.php
@@ -7,12 +7,12 @@
* @package CodeIgniter
* @author Rick Ellis
* @copyright Copyright (c) 2006, pMachine, Inc.
- * @license http://www.codeignitor.com/user_guide/license.html
+ * @license http://www.codeignitor.com/user_guide/license.html
* @link http://www.codeigniter.com
* @since Version 1.0
* @filesource
*/
-
+
// ------------------------------------------------------------------------
/**
@@ -32,10 +32,10 @@ class CI_DB_mysqli_driver extends CI_DB {
/**
* Whether to use the MySQL "delete hack" which allows the number
- * of affected rows to be shown. Uses a preg_replace when enabled,
+ * of affected rows to be shown. Uses a preg_replace when enabled,
* adding a bit more processing to all queries.
*/
- var $delete_hack = TRUE;
+ var $delete_hack = TRUE;
// --------------------------------------------------------------------
@@ -116,28 +116,28 @@ class CI_DB_mysqli_driver extends CI_DB {
* @param string an SQL query
* @return string
*/
- function _prep_query($sql)
- {
- // "DELETE FROM TABLE" returns 0 affected rows This hack modifies
+ function _prep_query($sql)
+ {
+ // "DELETE FROM TABLE" returns 0 affected rows This hack modifies
// the query so that it returns the number of affected rows
if ($this->delete_hack === TRUE)
{
- if (preg_match('/^\s*DELETE\s+FROM\s+(\S+)\s*$/i', $sql))
+ if (preg_match('/^\s*DELETE\s+FROM\s+(\S+)\s*$/i', $sql))
{
$sql = preg_replace("/^\s*DELETE\s+FROM\s+(\S+)\s*$/", "DELETE FROM \\1 WHERE 1=1", $sql);
}
}
return $sql;
- }
+ }
// --------------------------------------------------------------------
/**
* Begin Transaction
- *
+ *
* @access public
- * @return bool
+ * @return bool
*/
function trans_begin($test_mode = FALSE)
{
@@ -153,8 +153,8 @@ class CI_DB_mysqli_driver extends CI_DB {
}
// 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.
+ // 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->simple_query('SET AUTOCOMMIT=0');
@@ -166,9 +166,9 @@ class CI_DB_mysqli_driver extends CI_DB {
/**
* Commit Transaction
- *
+ *
* @access public
- * @return bool
+ * @return bool
*/
function trans_commit()
{
@@ -192,9 +192,9 @@ class CI_DB_mysqli_driver extends CI_DB {
/**
* Rollback Transaction
- *
+ *
* @access public
- * @return bool
+ * @return bool
*/
function trans_rollback()
{
diff --git a/system/database/drivers/mysqli/mysqli_result.php b/system/database/drivers/mysqli/mysqli_result.php
index 215403e9d..5e4e65ff7 100644
--- a/system/database/drivers/mysqli/mysqli_result.php
+++ b/system/database/drivers/mysqli/mysqli_result.php
@@ -7,12 +7,12 @@
* @package CodeIgniter
* @author Rick Ellis
* @copyright Copyright (c) 2006, pMachine, Inc.
- * @license http://www.codeignitor.com/user_guide/license.html
+ * @license http://www.codeignitor.com/user_guide/license.html
* @link http://www.codeigniter.com
* @since Version 1.0
* @filesource
*/
-
+
// ------------------------------------------------------------------------
/**
@@ -65,7 +65,7 @@ class CI_DB_mysqli_result extends CI_DB_result {
$field_names = array();
while ($field = mysql_fetch_field($this->result_id))
{
- $field_names[] = $field->name;
+ $field_names[] = $field->name;
}
return $field_names;
@@ -116,8 +116,8 @@ class CI_DB_mysqli_result extends CI_DB_result {
{
if (is_resource($this->result_id))
{
- mysqli_free_result($this->result_id);
- $this->result_id = FALSE;
+ mysqli_free_result($this->result_id);
+ $this->result_id = FALSE;
}
}
diff --git a/system/database/drivers/mysqli/mysqli_utility.php b/system/database/drivers/mysqli/mysqli_utility.php
index 17af40b76..a7bdb708e 100644
--- a/system/database/drivers/mysqli/mysqli_utility.php
+++ b/system/database/drivers/mysqli/mysqli_utility.php
@@ -7,12 +7,12 @@
* @package CodeIgniter
* @author Rick Ellis
* @copyright Copyright (c) 2006, pMachine, Inc.
- * @license http://www.codeignitor.com/user_guide/license.html
+ * @license http://www.codeignitor.com/user_guide/license.html
* @link http://www.codeigniter.com
* @since Version 1.0
* @filesource
*/
-
+
// ------------------------------------------------------------------------
/**
@@ -129,39 +129,39 @@ class CI_DB_mysqli_utility extends CI_DB_utility {
// Build the output
$output = '';
- foreach ((array)$tables as $table)
- {
- // Is the table in the "ignore" list?
+ foreach ((array)$tables as $table)
+ {
+ // Is the table in the "ignore" list?
if (in_array($table, (array)$ignore, TRUE))
{
- continue;
- }
+ continue;
+ }
- // Get the table schema
+ // Get the table schema
$query = $this->db->query("SHOW CREATE TABLE `".$this->db->database.'`.'.$table);
// No result means the table name was invalid
- if ($query === FALSE)
- {
- continue;
- }
-
- // Write out the table schema
- $output .= '#'.$newline.'# TABLE STRUCTURE FOR: '.$table.$newline.'#'.$newline.$newline;
-
+ if ($query === FALSE)
+ {
+ continue;
+ }
+
+ // Write out the table schema
+ $output .= '#'.$newline.'# TABLE STRUCTURE FOR: '.$table.$newline.'#'.$newline.$newline;
+
if ($add_drop == TRUE)
{
- $output .= 'DROP TABLE IF EXISTS '.$table.';'.$newline.$newline;
+ $output .= 'DROP TABLE IF EXISTS '.$table.';'.$newline.$newline;
}
$i = 0;
$result = $query->result_array();
foreach ($result[0] as $val)
{
- if ($i++ % 2)
- {
- $output .= $val.';'.$newline.$newline;
- }
+ if ($i++ % 2)
+ {
+ $output .= $val.';'.$newline.$newline;
+ }
}
// If inserts are not needed we're done...
@@ -179,7 +179,7 @@ class CI_DB_mysqli_utility extends CI_DB_utility {
}
// Fetch the field names and determine if the field is an
- // integer type. We use this info to decide whether to
+ // integer type. We use this info to decide whether to
// surround the data with quotes or not
$i = 0;
@@ -188,13 +188,13 @@ class CI_DB_mysqli_utility extends CI_DB_utility {
while ($field = mysqli_fetch_field($query->result_id))
{
$is_int[$i] = (in_array(
- strtolower(mysql_field_type($query->result_id, $i)),
- array('tinyint', 'smallint', 'mediumint', 'int', 'bigint', 'timestamp'),
+ strtolower(mysql_field_type($query->result_id, $i)),
+ array('tinyint', 'smallint', 'mediumint', 'int', 'bigint', 'timestamp'),
TRUE)
) ? TRUE : FALSE;
// Create a string of field names
- $field_str .= $field->name.', ';
+ $field_str .= $field->name.', ';
$i++;
}
@@ -211,8 +211,8 @@ class CI_DB_mysqli_utility extends CI_DB_utility {
foreach ($row as $v)
{
// Do a little formatting...
- $v = str_replace(array("\x00", "\x0a", "\x0d", "\x1a"), array('\0', '\n', '\r', '\Z'), $v);
- $v = str_replace(array("\n", "\r", "\t"), array('\n', '\r', '\t'), $v);
+ $v = str_replace(array("\x00", "\x0a", "\x0d", "\x1a"), array('\0', '\n', '\r', '\Z'), $v);
+ $v = str_replace(array("\n", "\r", "\t"), array('\n', '\r', '\t'), $v);
$v = str_replace('\\', '\\\\', $v);
$v = str_replace('\'', '\\\'', $v);
$v = str_replace('\\\n', '\n', $v);
diff --git a/system/database/drivers/oci8/oci8_driver.php b/system/database/drivers/oci8/oci8_driver.php
index 4f5470c1a..c091edf64 100644
--- a/system/database/drivers/oci8/oci8_driver.php
+++ b/system/database/drivers/oci8/oci8_driver.php
@@ -4,12 +4,12 @@
*
* An open source application development framework for PHP 4.3.2 or newer
*
- * @package CodeIgniter
- * @author Rick Ellis
+ * @package CodeIgniter
+ * @author Rick Ellis
* @copyright Copyright (c) 2006, pMachine, Inc.
- * @license http://www.codeignitor.com/user_guide/license.html
- * @link http://www.codeigniter.com
- * @since Version 1.0
+ * @license http://www.codeignitor.com/user_guide/license.html
+ * @link http://www.codeigniter.com
+ * @since Version 1.0
* @filesource
*/
@@ -22,182 +22,182 @@
* creates dynamically based on whether the active record
* class is being used or not.
*
- * @package CodeIgniter
+ * @package CodeIgniter
* @subpackage Drivers
- * @category Database
- * @author Rick Ellis
- * @link http://www.codeigniter.com/user_guide/database/
+ * @category Database
+ * @author Rick Ellis
+ * @link http://www.codeigniter.com/user_guide/database/
*/
/**
* oci8 Database Adapter Class
*
- * This is a modification of the DB_driver class to
+ * This is a modification of the DB_driver class to
* permit access to oracle databases
*
* NOTE: this uses the PHP 4 oci methods
*
- * @author Kelly McArdle
+ * @author Kelly McArdle
*
*/
class CI_DB_oci8_driver extends CI_DB {
// Set "auto commit" by default
- var $_commit = OCI_COMMIT_ON_SUCCESS;
-
- // need to track statement id and cursor id
- var $stmt_id;
- var $curs_id;
-
- // if we use a limit, we will add a field that will
- // throw off num_fields later
- var $limit_used;
-
- /**
- * Non-persistent database connection
- *
- * @access private called by the base class
- * @return resource
- */
- function db_connect()
- {
- return ocilogon($this->username, $this->password, $this->hostname);
- }
-
- // --------------------------------------------------------------------
-
- /**
- * Persistent database connection
- *
- * @access private called by the base class
- * @return resource
- */
- function db_pconnect()
- {
- return ociplogon($this->username, $this->password, $this->hostname);
- }
-
- // --------------------------------------------------------------------
-
- /**
- * Select the database
- *
- * @access private called by the base class
- * @return resource
- */
- function db_select()
- {
- return TRUE;
- }
+ var $_commit = OCI_COMMIT_ON_SUCCESS;
+
+ // need to track statement id and cursor id
+ var $stmt_id;
+ var $curs_id;
+
+ // if we use a limit, we will add a field that will
+ // throw off num_fields later
+ var $limit_used;
+
+ /**
+ * Non-persistent database connection
+ *
+ * @access private called by the base class
+ * @return resource
+ */
+ function db_connect()
+ {
+ return ocilogon($this->username, $this->password, $this->hostname);
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
+ * Persistent database connection
+ *
+ * @access private called by the base class
+ * @return resource
+ */
+ function db_pconnect()
+ {
+ return ociplogon($this->username, $this->password, $this->hostname);
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
+ * Select the database
+ *
+ * @access private called by the base class
+ * @return resource
+ */
+ function db_select()
+ {
+ return TRUE;
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
+ * Version number query string
+ *
+ * @access public
+ * @return string
+ */
+ function _version()
+ {
+ return ociserverversion($this->conn_id);
+ }
// --------------------------------------------------------------------
- /**
- * Version number query string
- *
- * @access public
- * @return string
- */
- function _version()
- {
- return ociserverversion($this->conn_id);
- }
-
- // --------------------------------------------------------------------
-
- /**
- * Execute the query
- *
- * @access private called by the base class
- * @param string an SQL query
- * @return resource
- */
- function _execute($sql)
- {
- // oracle must parse the query before it is run. All of the actions with
- // the query are based on the statement id returned by ociparse
- $this->_set_stmt_id($sql);
- ocisetprefetch($this->stmt_id, 1000);
- return @ociexecute($this->stmt_id, $this->_commit);
- }
-
- /**
- * Generate a statement ID
- *
- * @access private
- * @param string an SQL query
- * @return none
- */
- function _set_stmt_id($sql)
- {
- if ( ! is_resource($this->stmt_id))
- {
+ /**
+ * Execute the query
+ *
+ * @access private called by the base class
+ * @param string an SQL query
+ * @return resource
+ */
+ function _execute($sql)
+ {
+ // oracle must parse the query before it is run. All of the actions with
+ // the query are based on the statement id returned by ociparse
+ $this->_set_stmt_id($sql);
+ ocisetprefetch($this->stmt_id, 1000);
+ return @ociexecute($this->stmt_id, $this->_commit);
+ }
+
+ /**
+ * Generate a statement ID
+ *
+ * @access private
+ * @param string an SQL query
+ * @return none
+ */
+ function _set_stmt_id($sql)
+ {
+ if ( ! is_resource($this->stmt_id))
+ {
$this->stmt_id = ociparse($this->conn_id, $this->_prep_query($sql));
- }
- }
-
- // --------------------------------------------------------------------
-
- /**
- * Prep the query
- *
- * If needed, each database adapter can prep the query string
- *
- * @access private called by execute()
- * @param string an SQL query
- * @return string
- */
- function _prep_query($sql)
- {
- return $sql;
- }
-
- // --------------------------------------------------------------------
-
- /**
- * getCursor. Returns a cursor from the datbase
- *
- * @access public
- * @return cursor id
- */
- function get_cursor()
- {
+ }
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
+ * Prep the query
+ *
+ * If needed, each database adapter can prep the query string
+ *
+ * @access private called by execute()
+ * @param string an SQL query
+ * @return string
+ */
+ function _prep_query($sql)
+ {
+ return $sql;
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
+ * getCursor. Returns a cursor from the datbase
+ *
+ * @access public
+ * @return cursor id
+ */
+ function get_cursor()
+ {
$this->curs_id = ocinewcursor($this->conn_id);
return $this->curs_id;
- }
-
- // --------------------------------------------------------------------
-
- /**
- * Stored Procedure. Executes a stored procedure
- *
- * @access public
- * @param package package stored procedure is in
- * @param procedure stored procedure to execute
- * @param params array of parameters
- * @return array
- *
- * params array keys
- *
- * KEY OPTIONAL NOTES
- * name no the name of the parameter should be in :<param_name> format
- * value no the value of the parameter. If this is an OUT or IN OUT parameter,
- * this should be a reference to a variable
- * type yes the type of the parameter
- * length yes the max size of the parameter
- */
- function stored_procedure($package, $procedure, $params)
- {
- if ($package == '' OR $procedure == '' OR ! is_array($params))
- {
- if ($this->db_debug)
- {
- log_message('error', 'Invalid query: '.$package.'.'.$procedure);
- return $this->display_error('db_invalid_query');
- }
- return FALSE;
- }
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
+ * Stored Procedure. Executes a stored procedure
+ *
+ * @access public
+ * @param package package stored procedure is in
+ * @param procedure stored procedure to execute
+ * @param params array of parameters
+ * @return array
+ *
+ * params array keys
+ *
+ * KEY OPTIONAL NOTES
+ * name no the name of the parameter should be in :<param_name> format
+ * value no the value of the parameter. If this is an OUT or IN OUT parameter,
+ * this should be a reference to a variable
+ * type yes the type of the parameter
+ * length yes the max size of the parameter
+ */
+ function stored_procedure($package, $procedure, $params)
+ {
+ if ($package == '' OR $procedure == '' OR ! is_array($params))
+ {
+ if ($this->db_debug)
+ {
+ log_message('error', 'Invalid query: '.$package.'.'.$procedure);
+ return $this->display_error('db_invalid_query');
+ }
+ return FALSE;
+ }
// build the query string
$sql = "begin $package.$procedure(";
@@ -216,18 +216,18 @@ class CI_DB_oci8_driver extends CI_DB {
$this->stmt_id = FALSE;
$this->_set_stmt_id($sql);
- $this->_bind_params($params);
+ $this->_bind_params($params);
$this->query($sql, FALSE, $have_cursor);
}
- // --------------------------------------------------------------------
-
- /**
- * Bind parameters
- *
- * @access private
- * @return none
- */
+ // --------------------------------------------------------------------
+
+ /**
+ * Bind parameters
+ *
+ * @access private
+ * @return none
+ */
function _bind_params($params)
{
if ( ! is_array($params) OR ! is_resource($this->stmt_id))
@@ -235,27 +235,27 @@ class CI_DB_oci8_driver extends CI_DB {
return;
}
- foreach ($params as $param)
- {
+ foreach ($params as $param)
+ {
foreach (array('name', 'value', 'type', 'length') as $val)
- {
- if ( ! isset($param[$val]))
- {
- $param[$val] = '';
- }
- }
-
+ {
+ if ( ! isset($param[$val]))
+ {
+ $param[$val] = '';
+ }
+ }
+
ocibindbyname($this->stmt_id, $param['name'], $param['value'], $param['length'], $param['type']);
- }
+ }
}
// --------------------------------------------------------------------
/**
* Begin Transaction
- *
+ *
* @access public
- * @return bool
+ * @return bool
*/
function trans_begin($test_mode = FALSE)
{
@@ -271,8 +271,8 @@ class CI_DB_oci8_driver extends CI_DB {
}
// 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.
+ // 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;
@@ -283,9 +283,9 @@ class CI_DB_oci8_driver extends CI_DB {
/**
* Commit Transaction
- *
+ *
* @access public
- * @return bool
+ * @return bool
*/
function trans_commit()
{
@@ -309,9 +309,9 @@ class CI_DB_oci8_driver extends CI_DB {
/**
* Rollback Transaction
- *
+ *
* @access public
- * @return bool
+ * @return bool
*/
function trans_rollback()
{
@@ -331,272 +331,272 @@ class CI_DB_oci8_driver extends CI_DB {
return $ret;
}
- // --------------------------------------------------------------------
-
- /**
- * Escape String
- *
- * @access public
- * @param string
- * @return string
- */
- function escape_str($str)
- {
- return $str;
- }
-
- // --------------------------------------------------------------------
-
- /**
- * Affected Rows
- *
- * @access public
- * @return integer
- */
- function affected_rows()
- {
- return @ocirowcount($this->stmt_id);
- }
-
- // --------------------------------------------------------------------
-
- /**
- * Insert ID
- *
- * @access public
- * @return integer
- */
- function insert_id()
- {
- // not supported in oracle
- return 0;
- }
-
- // --------------------------------------------------------------------
-
- /**
- * "Count All" query
- *
- * Generates a platform-specific query string that counts all records in
- * the specified database
- *
- * @access public
- * @param string
- * @return string
- */
- function count_all($table = '')
- {
- if ($table == '')
- return '0';
-
- $query = $this->query("SELECT COUNT(1) AS numrows FROM ".$table);
-
- if ($query == FALSE)
- {
- return 0;
- }
-
- $row = $query->row();
- return $row->NUMROWS;
- }
-
- // --------------------------------------------------------------------
-
- /**
- * Show table query
- *
- * Generates a platform-specific query string so that the table names can be fetched
- *
- * @access private
- * @return string
- */
- function _list_tables()
- {
- return "SELECT TABLE_NAME FROM ALL_TABLES";
- }
-
- // --------------------------------------------------------------------
-
- /**
- * Show column query
- *
- * Generates a platform-specific query string so that the column names can be fetched
- *
- * @access public
- * @param string the table name
- * @return string
- */
- function _list_columns($table = '')
- {
- return "SELECT COLUMN_NAME FROM all_tab_columns WHERE table_name = '$table'";
- }
-
- // --------------------------------------------------------------------
-
- /**
- * Field data query
- *
- * Generates a platform-specific query so that the column data can be retrieved
- *
- * @access public
- * @param string the table name
- * @return object
- */
- function _field_data($table)
- {
+ // --------------------------------------------------------------------
+
+ /**
+ * Escape String
+ *
+ * @access public
+ * @param string
+ * @return string
+ */
+ function escape_str($str)
+ {
+ return $str;
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
+ * Affected Rows
+ *
+ * @access public
+ * @return integer
+ */
+ function affected_rows()
+ {
+ return @ocirowcount($this->stmt_id);
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
+ * Insert ID
+ *
+ * @access public
+ * @return integer
+ */
+ function insert_id()
+ {
+ // not supported in oracle
+ return 0;
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
+ * "Count All" query
+ *
+ * Generates a platform-specific query string that counts all records in
+ * the specified database
+ *
+ * @access public
+ * @param string
+ * @return string
+ */
+ function count_all($table = '')
+ {
+ if ($table == '')
+ return '0';
+
+ $query = $this->query("SELECT COUNT(1) AS numrows FROM ".$table);
+
+ if ($query == FALSE)
+ {
+ return 0;
+ }
+
+ $row = $query->row();
+ return $row->NUMROWS;
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
+ * Show table query
+ *
+ * Generates a platform-specific query string so that the table names can be fetched
+ *
+ * @access private
+ * @return string
+ */
+ function _list_tables()
+ {
+ return "SELECT TABLE_NAME FROM ALL_TABLES";
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
+ * Show column query
+ *
+ * Generates a platform-specific query string so that the column names can be fetched
+ *
+ * @access public
+ * @param string the table name
+ * @return string
+ */
+ function _list_columns($table = '')
+ {
+ return "SELECT COLUMN_NAME FROM all_tab_columns WHERE table_name = '$table'";
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
+ * Field data query
+ *
+ * Generates a platform-specific query so that the column data can be retrieved
+ *
+ * @access public
+ * @param string the table name
+ * @return object
+ */
+ function _field_data($table)
+ {
return "SELECT * FROM ".$this->_escape_table($table)." where rownum = 1";
- }
-
- // --------------------------------------------------------------------
-
- /**
- * The error message string
- *
- * @access private
- * @return string
- */
- function _error_message()
- {
- $error = ocierror($this->conn_id);
- return $error['message'];
- }
-
- // --------------------------------------------------------------------
-
- /**
- * The error message number
- *
- * @access private
- * @return integer
- */
- function _error_number()
- {
- $error = ocierror($this->conn_id);
- return $error['code'];
- }
-
- // --------------------------------------------------------------------
-
- /**
- * Escape Table Name
- *
- * This function adds backticks if the table name has a period
- * in it. Some DBs will get cranky unless periods are escaped
- *
- * @access private
- * @param string the table name
- * @return string
- */
- function _escape_table($table)
- {
- if (stristr($table, '.'))
- {
- $table = preg_replace("/\./", "`.`", $table);
- }
-
- return $table;
- }
-
- // --------------------------------------------------------------------
-
- /**
- * Insert statement
- *
- * Generates a platform-specific insert string from the supplied data
- *
- * @access public
- * @param string the table name
- * @param array the insert keys
- * @param array the insert values
- * @return string
- */
- function _insert($table, $keys, $values)
- {
- return "INSERT INTO ".$this->_escape_table($table)." (".implode(', ', $keys).") VALUES (".implode(', ', $values).")";
- }
-
- // --------------------------------------------------------------------
-
- /**
- * Update statement
- *
- * Generates a platform-specific update string from the supplied data
- *
- * @access public
- * @param string the table name
- * @param array the update data
- * @param array the where clause
- * @return string
- */
- function _update($table, $values, $where)
- {
- foreach($values as $key => $val)
- {
- $valstr[] = $key." = ".$val;
- }
-
- return "UPDATE ".$this->_escape_table($table)." SET ".implode(', ', $valstr)." WHERE ".implode(" ", $where);
- }
-
- // --------------------------------------------------------------------
-
- /**
- * Delete statement
- *
- * Generates a platform-specific delete string from the supplied data
- *
- * @access public
- * @param string the table name
- * @param array the where clause
- * @return string
- */
- function _delete($table, $where)
- {
- return "DELETE FROM ".$this->_escape_table($table)." WHERE ".implode(" ", $where);
- }
-
- // --------------------------------------------------------------------
-
- /**
- * Limit string
- *
- * Generates a platform-specific LIMIT clause
- *
- * @access public
- * @param string the sql query string
- * @param integer the number of rows to limit the query to
- * @param integer the offset value
- * @return string
- */
- function _limit($sql, $limit, $offset)
- {
- $limit = $offset + $limit;
- $newsql = "SELECT * FROM (select inner_query.*, rownum rnum FROM ($sql) inner_query WHERE rownum < $limit)";
-
- if ($offset != 0)
- {
- $newsql .= " WHERE rnum >= $offset";
- }
-
- // remember that we used limits
- $this->limit_used = TRUE;
-
- return $newsql;
- }
-
- // --------------------------------------------------------------------
-
- /**
- * Close DB Connection
- *
- * @access public
- * @param resource
- * @return void
- */
- function _close($conn_id)
- {
- ocilogoff($conn_id);
- }
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
+ * The error message string
+ *
+ * @access private
+ * @return string
+ */
+ function _error_message()
+ {
+ $error = ocierror($this->conn_id);
+ return $error['message'];
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
+ * The error message number
+ *
+ * @access private
+ * @return integer
+ */
+ function _error_number()
+ {
+ $error = ocierror($this->conn_id);
+ return $error['code'];
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
+ * Escape Table Name
+ *
+ * This function adds backticks if the table name has a period
+ * in it. Some DBs will get cranky unless periods are escaped
+ *
+ * @access private
+ * @param string the table name
+ * @return string
+ */
+ function _escape_table($table)
+ {
+ if (stristr($table, '.'))
+ {
+ $table = preg_replace("/\./", "`.`", $table);
+ }
+
+ return $table;
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
+ * Insert statement
+ *
+ * Generates a platform-specific insert string from the supplied data
+ *
+ * @access public
+ * @param string the table name
+ * @param array the insert keys
+ * @param array the insert values
+ * @return string
+ */
+ function _insert($table, $keys, $values)
+ {
+ return "INSERT INTO ".$this->_escape_table($table)." (".implode(', ', $keys).") VALUES (".implode(', ', $values).")";
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
+ * Update statement
+ *
+ * Generates a platform-specific update string from the supplied data
+ *
+ * @access public
+ * @param string the table name
+ * @param array the update data
+ * @param array the where clause
+ * @return string
+ */
+ function _update($table, $values, $where)
+ {
+ foreach($values as $key => $val)
+ {
+ $valstr[] = $key." = ".$val;
+ }
+
+ return "UPDATE ".$this->_escape_table($table)." SET ".implode(', ', $valstr)." WHERE ".implode(" ", $where);
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
+ * Delete statement
+ *
+ * Generates a platform-specific delete string from the supplied data
+ *
+ * @access public
+ * @param string the table name
+ * @param array the where clause
+ * @return string
+ */
+ function _delete($table, $where)
+ {
+ return "DELETE FROM ".$this->_escape_table($table)." WHERE ".implode(" ", $where);
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
+ * Limit string
+ *
+ * Generates a platform-specific LIMIT clause
+ *
+ * @access public
+ * @param string the sql query string
+ * @param integer the number of rows to limit the query to
+ * @param integer the offset value
+ * @return string
+ */
+ function _limit($sql, $limit, $offset)
+ {
+ $limit = $offset + $limit;
+ $newsql = "SELECT * FROM (select inner_query.*, rownum rnum FROM ($sql) inner_query WHERE rownum < $limit)";
+
+ if ($offset != 0)
+ {
+ $newsql .= " WHERE rnum >= $offset";
+ }
+
+ // remember that we used limits
+ $this->limit_used = TRUE;
+
+ return $newsql;
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
+ * Close DB Connection
+ *
+ * @access public
+ * @param resource
+ * @return void
+ */
+ function _close($conn_id)
+ {
+ ocilogoff($conn_id);
+ }
}
diff --git a/system/database/drivers/oci8/oci8_result.php b/system/database/drivers/oci8/oci8_result.php
index ab13a3935..947a76109 100644
--- a/system/database/drivers/oci8/oci8_result.php
+++ b/system/database/drivers/oci8/oci8_result.php
@@ -4,12 +4,12 @@
*
* An open source application development framework for PHP 4.3.2 or newer
*
- * @package CodeIgniter
- * @author Rick Ellis
+ * @package CodeIgniter
+ * @author Rick Ellis
* @copyright Copyright (c) 2006, pMachine, Inc.
- * @license http://www.codeignitor.com/user_guide/license.html
- * @link http://www.codeigniter.com
- * @since Version 1.0
+ * @license http://www.codeignitor.com/user_guide/license.html
+ * @link http://www.codeigniter.com
+ * @since Version 1.0
* @filesource
*/
@@ -20,59 +20,59 @@
*
* This class extends the parent result class: CI_DB_result
*
- * @category Database
- * @author Rick Ellis
- * @link http://www.codeigniter.com/user_guide/database/
+ * @category Database
+ * @author Rick Ellis
+ * @link http://www.codeigniter.com/user_guide/database/
*/
class CI_DB_oci8_result extends CI_DB_result {
- var $stmt_id;
- var $curs_id;
- var $limit_used;
-
- /**
- * Number of rows in the result set
- *
- * @access public
- * @return integer
- */
- function num_rows()
- {
- // get the results, count them,
- // rerun query - otherwise we
- // won't have data after calling
- // num_rows()
- $this->result_array();
- $rowcount = count($this->result_array);
- @ociexecute($this->stmt_id);
- if ($this->curs_id)
+ var $stmt_id;
+ var $curs_id;
+ var $limit_used;
+
+ /**
+ * Number of rows in the result set
+ *
+ * @access public
+ * @return integer
+ */
+ function num_rows()
+ {
+ // get the results, count them,
+ // rerun query - otherwise we
+ // won't have data after calling
+ // num_rows()
+ $this->result_array();
+ $rowcount = count($this->result_array);
+ @ociexecute($this->stmt_id);
+ if ($this->curs_id)
{
@ociexecute($this->curs_id);
}
- return $rowcount;
- }
-
- // --------------------------------------------------------------------
-
- /**
- * Number of fields in the result set
- *
- * @access public
- * @return integer
- */
- function num_fields()
- {
- $count = @ocinumcols($this->stmt_id);
-
- // if we used a limit, we added a field,
- // subtract it out
- if ($this->limit_used)
- {
- $count = $count - 1;
- }
-
- return $count;
- }
+ return $rowcount;
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
+ * Number of fields in the result set
+ *
+ * @access public
+ * @return integer
+ */
+ function num_fields()
+ {
+ $count = @ocinumcols($this->stmt_id);
+
+ // if we used a limit, we added a field,
+ // subtract it out
+ if ($this->limit_used)
+ {
+ $count = $count - 1;
+ }
+
+ return $count;
+ }
// --------------------------------------------------------------------
@@ -87,11 +87,11 @@ class CI_DB_oci8_result extends CI_DB_result {
function list_fields()
{
$field_names = array();
- $fieldCount = $this->num_fields();
- for ($c = 1; $c <= $fieldCount; $c++)
- {
- $field_names[] = ocicolumnname($this->stmt_id, $c);
- }
+ $fieldCount = $this->num_fields();
+ for ($c = 1; $c <= $fieldCount; $c++)
+ {
+ $field_names[] = ocicolumnname($this->stmt_id, $c);
+ }
return $field_names;
}
@@ -101,32 +101,32 @@ class CI_DB_oci8_result extends CI_DB_result {
return $this->list_fields();
}
- // --------------------------------------------------------------------
-
- /**
- * Field data
- *
- * Generates an array of objects containing field meta-data
- *
- * @access public
- * @return array
- */
- function field_data()
- {
- $retval = array();
- $fieldCount = $this->num_fields();
- for ($c = 1; $c <= $fieldCount; $c++)
- {
- $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);
-
- $retval[] = $F;
- }
-
- return $retval;
- }
+ // --------------------------------------------------------------------
+
+ /**
+ * Field data
+ *
+ * Generates an array of objects containing field meta-data
+ *
+ * @access public
+ * @return array
+ */
+ function field_data()
+ {
+ $retval = array();
+ $fieldCount = $this->num_fields();
+ for ($c = 1; $c <= $fieldCount; $c++)
+ {
+ $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);
+
+ $retval[] = $F;
+ }
+
+ return $retval;
+ }
// --------------------------------------------------------------------
@@ -139,25 +139,25 @@ class CI_DB_oci8_result extends CI_DB_result {
{
if (is_resource($this->result_id))
{
- OCIFreeStatement($this->result_id);
- $this->result_id = FALSE;
+ OCIFreeStatement($this->result_id);
+ $this->result_id = FALSE;
}
}
- // --------------------------------------------------------------------
-
- /**
- * Result - associative array
- *
- * Returns the result set as an array
- *
- * @access private
- * @return array
- */
- function _fetch_assoc(&$row)
- {
- // if pulling from a cursor, use curs_id
- if ($this->curs_id)
+ // --------------------------------------------------------------------
+
+ /**
+ * Result - associative array
+ *
+ * Returns the result set as an array
+ *
+ * @access private
+ * @return array
+ */
+ function _fetch_assoc(&$row)
+ {
+ // if pulling from a cursor, use curs_id
+ if ($this->curs_id)
{
return ocifetchinto($this->curs_id, $row, OCI_ASSOC + OCI_RETURN_NULLS);
}
@@ -165,7 +165,7 @@ class CI_DB_oci8_result extends CI_DB_result {
{
return ocifetchinto($this->stmt_id, $row, OCI_ASSOC + OCI_RETURN_NULLS);
}
- }
+ }
// --------------------------------------------------------------------
@@ -184,25 +184,25 @@ class CI_DB_oci8_result extends CI_DB_result {
return FALSE;
}
- // --------------------------------------------------------------------
-
- /**
- * Result - object
- *
- * Returns the result set as an object
- *
- * @access private
- * @return object
- */
- function _fetch_object()
- {
- // the PHP 4 version of the oracle functions do not
- // have a fetch method so we call the array version
- // and build an object from that
-
- $row = array();
- $res = $this->_fetch_assoc($row);
- if ($res != FALSE)
+ // --------------------------------------------------------------------
+
+ /**
+ * Result - object
+ *
+ * Returns the result set as an object
+ *
+ * @access private
+ * @return object
+ */
+ function _fetch_object()
+ {
+ // the PHP 4 version of the oracle functions do not
+ // have a fetch method so we call the array version
+ // and build an object from that
+
+ $row = array();
+ $res = $this->_fetch_assoc($row);
+ if ($res != FALSE)
{
$obj = new stdClass();
foreach ($row as $key => $value)
@@ -212,41 +212,41 @@ class CI_DB_oci8_result extends CI_DB_result {
$res = $obj;
}
- return $res;
- }
-
- // --------------------------------------------------------------------
-
- /**
- * Query result. "array" version.
- *
- * @access public
- * @return array
- */
- function result_array()
- {
- if (count($this->result_array) > 0)
- {
- return $this->result_array;
- }
-
- // oracle's fetch functions do not
- // return arrays, the information
- // is returned in reference parameters
- //
- $row = NULL;
- while ($this->_fetch_assoc($row))
- {
- $this->result_array[] = $row;
- }
-
- if (count($this->result_array) == 0)
- {
- return FALSE;
- }
-
- return $this->result_array;
- }
+ return $res;
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
+ * Query result. "array" version.
+ *
+ * @access public
+ * @return array
+ */
+ function result_array()
+ {
+ if (count($this->result_array) > 0)
+ {
+ return $this->result_array;
+ }
+
+ // oracle's fetch functions do not
+ // return arrays, the information
+ // is returned in reference parameters
+ //
+ $row = NULL;
+ while ($this->_fetch_assoc($row))
+ {
+ $this->result_array[] = $row;
+ }
+
+ if (count($this->result_array) == 0)
+ {
+ return FALSE;
+ }
+
+ return $this->result_array;
+ }
}
diff --git a/system/database/drivers/oci8/oci8_utility.php b/system/database/drivers/oci8/oci8_utility.php
index f4e912183..1d83af1fe 100644
--- a/system/database/drivers/oci8/oci8_utility.php
+++ b/system/database/drivers/oci8/oci8_utility.php
@@ -7,12 +7,12 @@
* @package CodeIgniter
* @author Rick Ellis
* @copyright Copyright (c) 2006, pMachine, Inc.
- * @license http://www.codeignitor.com/user_guide/license.html
+ * @license http://www.codeignitor.com/user_guide/license.html
* @link http://www.codeigniter.com
* @since Version 1.0
* @filesource
*/
-
+
// ------------------------------------------------------------------------
/**
diff --git a/system/database/drivers/odbc/odbc_driver.php b/system/database/drivers/odbc/odbc_driver.php
index 17a6dfbd0..09ca07ee4 100644
--- a/system/database/drivers/odbc/odbc_driver.php
+++ b/system/database/drivers/odbc/odbc_driver.php
@@ -7,12 +7,12 @@
* @package CodeIgniter
* @author Rick Ellis
* @copyright Copyright (c) 2006, pMachine, Inc.
- * @license http://www.codeignitor.com/user_guide/license.html
+ * @license http://www.codeignitor.com/user_guide/license.html
* @link http://www.codeigniter.com
* @since Version 1.0
* @filesource
*/
-
+
// ------------------------------------------------------------------------
/**
@@ -21,7 +21,7 @@
* Note: _DB is an extender class that the app controller
* creates dynamically based on whether the active record
* class is being used or not.
- *
+ *
* @package CodeIgniter
* @subpackage Drivers
* @category Database
@@ -107,18 +107,18 @@ class CI_DB_odbc_driver extends CI_DB {
* @param string an SQL query
* @return string
*/
- function _prep_query($sql)
- {
+ function _prep_query($sql)
+ {
return $sql;
- }
+ }
// --------------------------------------------------------------------
/**
* Begin Transaction
- *
+ *
* @access public
- * @return bool
+ * @return bool
*/
function trans_begin($test_mode = FALSE)
{
@@ -134,8 +134,8 @@ class CI_DB_odbc_driver extends CI_DB {
}
// 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.
+ // 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;
return odbc_autocommit($this->conn_id, FALSE);
@@ -145,9 +145,9 @@ class CI_DB_odbc_driver extends CI_DB {
/**
* Commit Transaction
- *
+ *
* @access public
- * @return bool
+ * @return bool
*/
function trans_commit()
{
@@ -171,9 +171,9 @@ class CI_DB_odbc_driver extends CI_DB {
/**
* Rollback Transaction
- *
+ *
* @access public
- * @return bool
+ * @return bool
*/
function trans_rollback()
{
diff --git a/system/database/drivers/odbc/odbc_result.php b/system/database/drivers/odbc/odbc_result.php
index ea834f9b4..47fb103b3 100644
--- a/system/database/drivers/odbc/odbc_result.php
+++ b/system/database/drivers/odbc/odbc_result.php
@@ -7,12 +7,12 @@
* @package CodeIgniter
* @author Rick Ellis
* @copyright Copyright (c) 2006, pMachine, Inc.
- * @license http://www.codeignitor.com/user_guide/license.html
+ * @license http://www.codeignitor.com/user_guide/license.html
* @link http://www.codeigniter.com
* @since Version 1.0
* @filesource
*/
-
+
// ------------------------------------------------------------------------
/**
@@ -116,8 +116,8 @@ class CI_DB_odbc_result extends CI_DB_result {
{
if (is_resource($this->result_id))
{
- odbc_free_result($this->result_id);
- $this->result_id = FALSE;
+ odbc_free_result($this->result_id);
+ $this->result_id = FALSE;
}
}
diff --git a/system/database/drivers/odbc/odbc_utility.php b/system/database/drivers/odbc/odbc_utility.php
index dc62df9f0..8af463b13 100644
--- a/system/database/drivers/odbc/odbc_utility.php
+++ b/system/database/drivers/odbc/odbc_utility.php
@@ -7,12 +7,12 @@
* @package CodeIgniter
* @author Rick Ellis
* @copyright Copyright (c) 2006, pMachine, Inc.
- * @license http://www.codeignitor.com/user_guide/license.html
+ * @license http://www.codeignitor.com/user_guide/license.html
* @link http://www.codeigniter.com
* @since Version 1.0
* @filesource
*/
-
+
// ------------------------------------------------------------------------
/**
@@ -34,7 +34,7 @@ class CI_DB_odbc_utility extends CI_DB_utility {
*/
function _create_database()
{
- // ODBC has no "create database" command since it's
+ // ODBC has no "create database" command since it's
// designed to connect to an existing database
if ($this->db->db_debug)
{
@@ -54,7 +54,7 @@ class CI_DB_odbc_utility extends CI_DB_utility {
*/
function _drop_database($name)
{
- // ODBC has no "drop database" command since it's
+ // ODBC has no "drop database" command since it's
// designed to connect to an existing database
if ($this->db->db_debug)
{
diff --git a/system/database/drivers/postgre/postgre_driver.php b/system/database/drivers/postgre/postgre_driver.php
index f74e652d5..81aaafe14 100644
--- a/system/database/drivers/postgre/postgre_driver.php
+++ b/system/database/drivers/postgre/postgre_driver.php
@@ -7,12 +7,12 @@
* @package CodeIgniter
* @author Rick Ellis
* @copyright Copyright (c) 2006, pMachine, Inc.
- * @license http://www.codeignitor.com/user_guide/license.html
+ * @license http://www.codeignitor.com/user_guide/license.html
* @link http://www.codeigniter.com
* @since Version 1.0
* @filesource
*/
-
+
// ------------------------------------------------------------------------
/**
@@ -111,18 +111,18 @@ class CI_DB_postgre_driver extends CI_DB {
* @param string an SQL query
* @return string
*/
- function _prep_query($sql)
- {
+ function _prep_query($sql)
+ {
return $sql;
- }
+ }
// --------------------------------------------------------------------
/**
* Begin Transaction
- *
+ *
* @access public
- * @return bool
+ * @return bool
*/
function trans_begin($test_mode = FALSE)
{
@@ -138,8 +138,8 @@ class CI_DB_postgre_driver extends CI_DB {
}
// 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.
+ // 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;
return @pg_exec($this->conn_id, "begin");
@@ -149,9 +149,9 @@ class CI_DB_postgre_driver extends CI_DB {
/**
* Commit Transaction
- *
+ *
* @access public
- * @return bool
+ * @return bool
*/
function trans_commit()
{
@@ -173,9 +173,9 @@ class CI_DB_postgre_driver extends CI_DB {
/**
* Rollback Transaction
- *
+ *
* @access public
- * @return bool
+ * @return bool
*/
function trans_rollback()
{
@@ -298,7 +298,7 @@ class CI_DB_postgre_driver extends CI_DB {
* @return string
*/
function _list_tables()
- {
+ {
return "SELECT table_name FROM information_schema.tables WHERE table_schema = 'public'";
}
diff --git a/system/database/drivers/postgre/postgre_result.php b/system/database/drivers/postgre/postgre_result.php
index e792544ae..76bd60187 100644
--- a/system/database/drivers/postgre/postgre_result.php
+++ b/system/database/drivers/postgre/postgre_result.php
@@ -7,12 +7,12 @@
* @package CodeIgniter
* @author Rick Ellis
* @copyright Copyright (c) 2006, pMachine, Inc.
- * @license http://www.codeignitor.com/user_guide/license.html
+ * @license http://www.codeignitor.com/user_guide/license.html
* @link http://www.codeigniter.com
* @since Version 1.0
* @filesource
*/
-
+
// ------------------------------------------------------------------------
/**
@@ -116,8 +116,8 @@ class CI_DB_postgre_result extends CI_DB_result {
{
if (is_resource($this->result_id))
{
- pg_free_result($this->result_id);
- $this->result_id = FALSE;
+ pg_free_result($this->result_id);
+ $this->result_id = FALSE;
}
}
diff --git a/system/database/drivers/postgre/postgre_utility.php b/system/database/drivers/postgre/postgre_utility.php
index b08b879d7..478e74276 100644
--- a/system/database/drivers/postgre/postgre_utility.php
+++ b/system/database/drivers/postgre/postgre_utility.php
@@ -7,12 +7,12 @@
* @package CodeIgniter
* @author Rick Ellis
* @copyright Copyright (c) 2006, pMachine, Inc.
- * @license http://www.codeignitor.com/user_guide/license.html
+ * @license http://www.codeignitor.com/user_guide/license.html
* @link http://www.codeigniter.com
* @since Version 1.0
* @filesource
*/
-
+
// ------------------------------------------------------------------------
/**
@@ -90,7 +90,7 @@ class CI_DB_postgre_utility extends CI_DB_utility {
*/
function _optimize_table($table)
{
- return FALSE;
+ return FALSE;
}
// --------------------------------------------------------------------
diff --git a/system/database/drivers/sqlite/sqlite_driver.php b/system/database/drivers/sqlite/sqlite_driver.php
index fd9fd2c50..ce3c57935 100644
--- a/system/database/drivers/sqlite/sqlite_driver.php
+++ b/system/database/drivers/sqlite/sqlite_driver.php
@@ -7,12 +7,12 @@
* @package CodeIgniter
* @author Rick Ellis
* @copyright Copyright (c) 2006, pMachine, Inc.
- * @license http://www.codeignitor.com/user_guide/license.html
+ * @license http://www.codeignitor.com/user_guide/license.html
* @link http://www.codeigniter.com
* @since Version 1.0
* @filesource
*/
-
+
// ------------------------------------------------------------------------
@@ -44,10 +44,10 @@ class CI_DB_sqlite_driver extends CI_DB {
{
log_message('error', $error);
- if ($this->db_debug)
- {
+ if ($this->db_debug)
+ {
$this->display_error($error, '', TRUE);
- }
+ }
}
return $conn_id;
@@ -67,10 +67,10 @@ class CI_DB_sqlite_driver extends CI_DB {
{
log_message('error', $error);
- if ($this->db_debug)
- {
+ if ($this->db_debug)
+ {
$this->display_error($error, '', TRUE);
- }
+ }
}
return $conn_id;
@@ -128,18 +128,18 @@ class CI_DB_sqlite_driver extends CI_DB {
* @param string an SQL query
* @return string
*/
- function _prep_query($sql)
- {
+ function _prep_query($sql)
+ {
return $sql;
- }
+ }
// --------------------------------------------------------------------
/**
* Begin Transaction
- *
+ *
* @access public
- * @return bool
+ * @return bool
*/
function trans_begin($test_mode = FALSE)
{
@@ -155,8 +155,8 @@ class CI_DB_sqlite_driver extends CI_DB {
}
// 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.
+ // 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->simple_query('BEGIN TRANSACTION');
@@ -167,9 +167,9 @@ class CI_DB_sqlite_driver extends CI_DB {
/**
* Commit Transaction
- *
+ *
* @access public
- * @return bool
+ * @return bool
*/
function trans_commit()
{
@@ -192,9 +192,9 @@ class CI_DB_sqlite_driver extends CI_DB {
/**
* Rollback Transaction
- *
+ *
* @access public
- * @return bool
+ * @return bool
*/
function trans_rollback()
{
diff --git a/system/database/drivers/sqlite/sqlite_result.php b/system/database/drivers/sqlite/sqlite_result.php
index 55364bb24..00045d06c 100644
--- a/system/database/drivers/sqlite/sqlite_result.php
+++ b/system/database/drivers/sqlite/sqlite_result.php
@@ -7,19 +7,19 @@
* @package CodeIgniter
* @author Rick Ellis
* @copyright Copyright (c) 2006, pMachine, Inc.
- * @license http://www.codeignitor.com/user_guide/license.html
+ * @license http://www.codeignitor.com/user_guide/license.html
* @link http://www.codeigniter.com
* @since Version 1.0
* @filesource
*/
-
+
// ------------------------------------------------------------------------
/**
* SQLite Result Class
*
* This class extends the parent result class: CI_DB_result
- *
+ *
* @category Database
* @author Rick Ellis
* @link http://www.codeigniter.com/user_guide/database/
diff --git a/system/database/drivers/sqlite/sqlite_utility.php b/system/database/drivers/sqlite/sqlite_utility.php
index ecce5be40..91649c78d 100644
--- a/system/database/drivers/sqlite/sqlite_utility.php
+++ b/system/database/drivers/sqlite/sqlite_utility.php
@@ -7,12 +7,12 @@
* @package CodeIgniter
* @author Rick Ellis
* @copyright Copyright (c) 2006, pMachine, Inc.
- * @license http://www.codeignitor.com/user_guide/license.html
+ * @license http://www.codeignitor.com/user_guide/license.html
* @link http://www.codeigniter.com
* @since Version 1.0
* @filesource
*/
-
+
// ------------------------------------------------------------------------
/**
@@ -68,7 +68,7 @@ class CI_DB_sqlite_utility extends CI_DB_utility {
*
* I don't believe you can do a database listing with SQLite
* since each database is its own file. I suppose we could
- * try reading a directory looking for SQLite files, but
+ * try reading a directory looking for SQLite files, but
* that doesn't seem like a terribly good idea
*
* @access private