summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJamie Rumbelow <jamie@jamierumbelow.net>2012-02-19 13:37:00 +0100
committerJamie Rumbelow <jamie@jamierumbelow.net>2012-02-19 13:37:00 +0100
commit7efad20597ef7e06f8cf837a9f40918d2d3f2727 (patch)
tree0effaff70b6b01042975aab293a340383fbb70bf
parent7a2412cfe7f7d8db3eb845542609c476c52efc3d (diff)
Renaming Active Record to Query Builder across the system
-rw-r--r--application/config/database.php8
-rw-r--r--system/core/Loader.php10
-rwxr-xr-xsystem/database/DB.php18
-rw-r--r--system/database/DB_driver.php4
-rw-r--r--system/database/DB_query_builder.php (renamed from system/database/DB_active_rec.php)394
-rw-r--r--system/database/drivers/cubrid/cubrid_driver.php4
-rw-r--r--system/database/drivers/mssql/mssql_driver.php4
-rw-r--r--system/database/drivers/mysql/mysql_driver.php4
-rw-r--r--system/database/drivers/mysqli/mysqli_driver.php4
-rw-r--r--system/database/drivers/oci8/oci8_driver.php4
-rw-r--r--system/database/drivers/odbc/odbc_driver.php4
-rw-r--r--system/database/drivers/pdo/pdo_driver.php4
-rw-r--r--system/database/drivers/postgre/postgre_driver.php4
-rw-r--r--system/database/drivers/sqlite/sqlite_driver.php4
-rw-r--r--system/database/drivers/sqlsrv/sqlsrv_driver.php2
-rw-r--r--user_guide_src/source/database/configuration.rst12
-rw-r--r--user_guide_src/source/database/connecting.rst2
-rw-r--r--user_guide_src/source/database/examples.rst8
-rw-r--r--user_guide_src/source/database/index.rst4
-rw-r--r--user_guide_src/source/database/queries.rst2
-rw-r--r--user_guide_src/source/database/query_builder.rst (renamed from user_guide_src/source/database/active_record.rst)34
-rw-r--r--user_guide_src/source/general/models.rst2
-rw-r--r--user_guide_src/source/helpers/directory_helper.rst2
-rw-r--r--user_guide_src/source/overview/features.rst2
-rw-r--r--user_guide_src/source/tutorial/create_news_items.rst2
-rw-r--r--user_guide_src/source/tutorial/index.rst2
-rw-r--r--user_guide_src/source/tutorial/news_section.rst4
27 files changed, 274 insertions, 274 deletions
diff --git a/application/config/database.php b/application/config/database.php
index bd68db1d8..b1cad9025 100644
--- a/application/config/database.php
+++ b/application/config/database.php
@@ -45,7 +45,7 @@
| ['dbdriver'] The database type. e.g.: mysql. Currently supported:
mysql, mysqli, pdo, postgre, odbc, mssql, sqlite, oci8
| ['dbprefix'] You can add an optional prefix, which will be added
-| to the table name when using the Active Record class
+| to the table name when using the Query Builder class
| ['pconnect'] TRUE/FALSE - Whether to use a persistent connection
| ['db_debug'] TRUE/FALSE - Whether database errors should be displayed.
| ['cache_on'] TRUE/FALSE - Enables/disables query caching
@@ -68,12 +68,12 @@
| The $active_group variable lets you choose which connection group to
| make active. By default there is only one group (the 'default' group).
|
-| The $active_record variables lets you determine whether or not to load
-| the active record class
+| The $query_builder variables lets you determine whether or not to load
+| the query builder class
*/
$active_group = 'default';
-$active_record = TRUE;
+$query_builder = TRUE;
$db['default']['dsn'] = '';
$db['default']['hostname'] = 'localhost';
diff --git a/system/core/Loader.php b/system/core/Loader.php
index 12daaa928..750e8cdd6 100644
--- a/system/core/Loader.php
+++ b/system/core/Loader.php
@@ -315,16 +315,16 @@ class CI_Loader {
*
* @param string the DB credentials
* @param bool whether to return the DB object
- * @param bool whether to enable active record (this allows us to override the config setting)
+ * @param bool whether to enable query builder (this allows us to override the config setting)
* @return object
*/
- public function database($params = '', $return = FALSE, $active_record = NULL)
+ public function database($params = '', $return = FALSE, $query_builder = NULL)
{
// Grab the super object
$CI =& get_instance();
// Do we even need to load the database class?
- if (class_exists('CI_DB') AND $return == FALSE AND $active_record == NULL AND isset($CI->db) AND is_object($CI->db))
+ if (class_exists('CI_DB') AND $return == FALSE AND $query_builder == NULL AND isset($CI->db) AND is_object($CI->db))
{
return FALSE;
}
@@ -333,7 +333,7 @@ class CI_Loader {
if ($return === TRUE)
{
- return DB($params, $active_record);
+ return DB($params, $query_builder);
}
// Initialize the db variable. Needed to prevent
@@ -341,7 +341,7 @@ class CI_Loader {
$CI->db = '';
// Load the DB class
- $CI->db =& DB($params, $active_record);
+ $CI->db =& DB($params, $query_builder);
}
// --------------------------------------------------------------------
diff --git a/system/database/DB.php b/system/database/DB.php
index d06ffb40e..9ce6103ca 100755
--- a/system/database/DB.php
+++ b/system/database/DB.php
@@ -32,9 +32,9 @@
* @author EllisLab Dev Team
* @link http://codeigniter.com/user_guide/database/
* @param string
- * @param bool Determines if active record should be used or not
+ * @param bool Determines if query builder should be used or not
*/
-function &DB($params = '', $active_record_override = NULL)
+function &DB($params = '', $query_builder_override = NULL)
{
// Load the DB config file if a DSN string wasn't passed
if (is_string($params) AND strpos($params, '://') === FALSE)
@@ -115,22 +115,22 @@ function &DB($params = '', $active_record_override = NULL)
show_error('You have not selected a database type to connect to.');
}
- // Load the DB classes. Note: Since the active record class is optional
+ // Load the DB classes. Note: Since the query builder class is optional
// we need to dynamically create a class that extends proper parent class
- // based on whether we're using the active record class or not.
- if ($active_record_override !== NULL)
+ // based on whether we're using the query builder class or not.
+ if ($query_builder_override !== NULL)
{
- $active_record = $active_record_override;
+ $query_builder = $query_builder_override;
}
require_once(BASEPATH.'database/DB_driver.php');
- if ( ! isset($active_record) OR $active_record == TRUE)
+ if ( ! isset($query_builder) OR $query_builder == TRUE)
{
- require_once(BASEPATH.'database/DB_active_rec.php');
+ require_once(BASEPATH.'database/DB_query_builder.php');
if ( ! class_exists('CI_DB'))
{
- class CI_DB extends CI_DB_active_record { }
+ class CI_DB extends CI_DB_query_builder { }
}
}
elseif ( ! class_exists('CI_DB'))
diff --git a/system/database/DB_driver.php b/system/database/DB_driver.php
index b829bbe46..339226cbb 100644
--- a/system/database/DB_driver.php
+++ b/system/database/DB_driver.php
@@ -1270,7 +1270,7 @@ class CI_DB_driver {
/**
* Protect Identifiers
*
- * This function is used extensively by the Active Record class, and by
+ * This function is used extensively by the Query Builder class, and by
* a couple functions in this class.
* It takes a column or table name (optionally with an alias) and inserts
* the table prefix onto it. Some logic is necessary in order to deal with
@@ -1344,7 +1344,7 @@ class CI_DB_driver {
// Does the first segment of the exploded item match
// one of the aliases previously identified? If so,
// we have nothing more to do other than escape the item
- if (in_array($parts[0], $this->ar_aliased_tables))
+ if (in_array($parts[0], $this->qb_aliased_tables))
{
if ($protect_identifiers === TRUE)
{
diff --git a/system/database/DB_active_rec.php b/system/database/DB_query_builder.php
index 424735157..b6ad0f3d8 100644
--- a/system/database/DB_active_rec.php
+++ b/system/database/DB_query_builder.php
@@ -28,9 +28,9 @@
// ------------------------------------------------------------------------
/**
- * Active Record Class
+ * Query Builder Class
*
- * This is the platform-independent base Active Record implementation class.
+ * This is the platform-independent base Query Builder implementation class.
*
* @package CodeIgniter
* @subpackage Drivers
@@ -38,46 +38,46 @@
* @author EllisLab Dev Team
* @link http://codeigniter.com/user_guide/database/
*/
-class CI_DB_active_record extends CI_DB_driver {
+class CI_DB_query_builder extends CI_DB_driver {
protected $return_delete_sql = FALSE;
protected $reset_delete_data = FALSE;
- protected $ar_select = array();
- protected $ar_distinct = FALSE;
- protected $ar_from = array();
- protected $ar_join = array();
- protected $ar_where = array();
- protected $ar_like = array();
- protected $ar_groupby = array();
- protected $ar_having = array();
- protected $ar_keys = array();
- protected $ar_limit = FALSE;
- protected $ar_offset = FALSE;
- protected $ar_order = FALSE;
- protected $ar_orderby = array();
- protected $ar_set = array();
- protected $ar_wherein = array();
- protected $ar_aliased_tables = array();
- protected $ar_store_array = array();
- protected $ar_where_group_started = FALSE;
- protected $ar_where_group_count = 0;
-
- // Active Record Caching variables
- protected $ar_caching = FALSE;
- protected $ar_cache_exists = array();
- protected $ar_cache_select = array();
- protected $ar_cache_from = array();
- protected $ar_cache_join = array();
- protected $ar_cache_where = array();
- protected $ar_cache_like = array();
- protected $ar_cache_groupby = array();
- protected $ar_cache_having = array();
- protected $ar_cache_orderby = array();
- protected $ar_cache_set = array();
-
- protected $ar_no_escape = array();
- protected $ar_cache_no_escape = array();
+ protected $qb_select = array();
+ protected $qb_distinct = FALSE;
+ protected $qb_from = array();
+ protected $qb_join = array();
+ protected $qb_where = array();
+ protected $qb_like = array();
+ protected $qb_groupby = array();
+ protected $qb_having = array();
+ protected $qb_keys = array();
+ protected $qb_limit = FALSE;
+ protected $qb_offset = FALSE;
+ protected $qb_order = FALSE;
+ protected $qb_orderby = array();
+ protected $qb_set = array();
+ protected $qb_wherein = array();
+ protected $qb_aliased_tables = array();
+ protected $qb_store_array = array();
+ protected $qb_where_group_started = FALSE;
+ protected $qb_where_group_count = 0;
+
+ // Query Builder Caching variables
+ protected $qb_caching = FALSE;
+ protected $qb_cache_exists = array();
+ protected $qb_cache_select = array();
+ protected $qb_cache_from = array();
+ protected $qb_cache_join = array();
+ protected $qb_cache_where = array();
+ protected $qb_cache_like = array();
+ protected $qb_cache_groupby = array();
+ protected $qb_cache_having = array();
+ protected $qb_cache_orderby = array();
+ protected $qb_cache_set = array();
+
+ protected $qb_no_escape = array();
+ protected $qb_cache_no_escape = array();
/**
* Select
@@ -100,14 +100,14 @@ class CI_DB_active_record extends CI_DB_driver {
if ($val != '')
{
- $this->ar_select[] = $val;
- $this->ar_no_escape[] = $escape;
+ $this->qb_select[] = $val;
+ $this->qb_no_escape[] = $escape;
- if ($this->ar_caching === TRUE)
+ if ($this->qb_caching === TRUE)
{
- $this->ar_cache_select[] = $val;
- $this->ar_cache_exists[] = 'select';
- $this->ar_cache_no_escape[] = $escape;
+ $this->qb_cache_select[] = $val;
+ $this->qb_cache_exists[] = 'select';
+ $this->qb_cache_no_escape[] = $escape;
}
}
}
@@ -213,12 +213,12 @@ class CI_DB_active_record extends CI_DB_driver {
}
$sql = $this->_protect_identifiers($type.'('.trim($select).')').' AS '.$this->_protect_identifiers(trim($alias));
- $this->ar_select[] = $sql;
+ $this->qb_select[] = $sql;
- if ($this->ar_caching === TRUE)
+ if ($this->qb_caching === TRUE)
{
- $this->ar_cache_select[] = $sql;
- $this->ar_cache_exists[] = 'select';
+ $this->qb_cache_select[] = $sql;
+ $this->qb_cache_exists[] = 'select';
}
return $this;
@@ -254,7 +254,7 @@ class CI_DB_active_record extends CI_DB_driver {
*/
public function distinct($val = TRUE)
{
- $this->ar_distinct = (is_bool($val)) ? $val : TRUE;
+ $this->qb_distinct = (is_bool($val)) ? $val : TRUE;
return $this;
}
@@ -278,12 +278,12 @@ class CI_DB_active_record extends CI_DB_driver {
{
$v = trim($v);
$this->_track_aliases($v);
- $v = $this->ar_from[] = $this->_protect_identifiers($v, TRUE, NULL, FALSE);
+ $v = $this->qb_from[] = $this->_protect_identifiers($v, TRUE, NULL, FALSE);
- if ($this->ar_caching === TRUE)
+ if ($this->qb_caching === TRUE)
{
- $this->ar_cache_from[] = $v;
- $this->ar_cache_exists[] = 'from';
+ $this->qb_cache_from[] = $v;
+ $this->qb_cache_exists[] = 'from';
}
}
}
@@ -294,12 +294,12 @@ class CI_DB_active_record extends CI_DB_driver {
// Extract any aliases that might exist. We use this information
// in the _protect_identifiers to know whether to add a table prefix
$this->_track_aliases($val);
- $this->ar_from[] = $val = $this->_protect_identifiers($val, TRUE, NULL, FALSE);
+ $this->qb_from[] = $val = $this->_protect_identifiers($val, TRUE, NULL, FALSE);
- if ($this->ar_caching === TRUE)
+ if ($this->qb_caching === TRUE)
{
- $this->ar_cache_from[] = $val;
- $this->ar_cache_exists[] = 'from';
+ $this->qb_cache_from[] = $val;
+ $this->qb_cache_exists[] = 'from';
}
}
}
@@ -346,12 +346,12 @@ class CI_DB_active_record extends CI_DB_driver {
}
// Assemble the JOIN statement
- $this->ar_join[] = $join = $type.'JOIN '.$this->_protect_identifiers($table, TRUE, NULL, FALSE).' ON '.$cond;
+ $this->qb_join[] = $join = $type.'JOIN '.$this->_protect_identifiers($table, TRUE, NULL, FALSE).' ON '.$cond;
- if ($this->ar_caching === TRUE)
+ if ($this->qb_caching === TRUE)
{
- $this->ar_cache_join[] = $join;
- $this->ar_cache_exists[] = 'join';
+ $this->qb_cache_join[] = $join;
+ $this->qb_cache_exists[] = 'join';
}
return $this;
@@ -420,7 +420,7 @@ class CI_DB_active_record extends CI_DB_driver {
foreach ($key as $k => $v)
{
- $prefix = (count($this->ar_where) === 0 AND count($this->ar_cache_where) === 0) ? '' : $type;
+ $prefix = (count($this->qb_where) === 0 AND count($this->qb_cache_where) === 0) ? '' : $type;
if (is_null($v) && ! $this->_has_operator($k))
{
@@ -446,11 +446,11 @@ class CI_DB_active_record extends CI_DB_driver {
$k = $this->_protect_identifiers($k, FALSE, $escape);
}
- $this->ar_where[] = $prefix.$k.$v;
- if ($this->ar_caching === TRUE)
+ $this->qb_where[] = $prefix.$k.$v;
+ if ($this->qb_caching === TRUE)
{
- $this->ar_cache_where[] = $prefix.$k.$v;
- $this->ar_cache_exists[] = 'where';
+ $this->qb_cache_where[] = $prefix.$k.$v;
+ $this->qb_cache_exists[] = 'where';
}
}
@@ -557,20 +557,20 @@ class CI_DB_active_record extends CI_DB_driver {
foreach ($values as $value)
{
- $this->ar_wherein[] = $this->escape($value);
+ $this->qb_wherein[] = $this->escape($value);
}
- $prefix = (count($this->ar_where) === 0) ? '' : $type;
- $this->ar_where[] = $where_in = $prefix.$this->_protect_identifiers($key).$not.' IN ('.implode(', ', $this->ar_wherein).') ';
+ $prefix = (count($this->qb_where) === 0) ? '' : $type;
+ $this->qb_where[] = $where_in = $prefix.$this->_protect_identifiers($key).$not.' IN ('.implode(', ', $this->qb_wherein).') ';
- if ($this->ar_caching === TRUE)
+ if ($this->qb_caching === TRUE)
{
- $this->ar_cache_where[] = $where_in;
- $this->ar_cache_exists[] = 'where';
+ $this->qb_cache_where[] = $where_in;
+ $this->qb_cache_exists[] = 'where';
}
// reset the array for multiple calls
- $this->ar_wherein = array();
+ $this->qb_wherein = array();
return $this;
}
@@ -666,7 +666,7 @@ class CI_DB_active_record extends CI_DB_driver {
foreach ($field as $k => $v)
{
$k = $this->_protect_identifiers($k);
- $prefix = (count($this->ar_like) === 0) ? '' : $type;
+ $prefix = (count($this->qb_like) === 0) ? '' : $type;
$v = $this->escape_like_str($v);
if ($side === 'none')
@@ -692,11 +692,11 @@ class CI_DB_active_record extends CI_DB_driver {
$like_statement = $like_statement.sprintf($this->_like_escape_str, $this->_like_escape_chr);
}
- $this->ar_like[] = $like_statement;
- if ($this->ar_caching === TRUE)
+ $this->qb_like[] = $like_statement;
+ if ($this->qb_caching === TRUE)
{
- $this->ar_cache_like[] = $like_statement;
- $this->ar_cache_exists[] = 'like';
+ $this->qb_cache_like[] = $like_statement;
+ $this->qb_cache_exists[] = 'like';
}
}
@@ -716,13 +716,13 @@ class CI_DB_active_record extends CI_DB_driver {
public function group_start($not = '', $type = 'AND ')
{
$type = $this->_group_get_type($type);
- $this->ar_where_group_started = TRUE;
- $prefix = (count($this->ar_where) === 0 AND count($this->ar_cache_where) === 0) ? '' : $type;
- $this->ar_where[] = $value = $prefix.$not.str_repeat(' ', ++$this->ar_where_group_count).' (';
+ $this->qb_where_group_started = TRUE;
+ $prefix = (count($this->qb_where) === 0 AND count($this->qb_cache_where) === 0) ? '' : $type;
+ $this->qb_where[] = $value = $prefix.$not.str_repeat(' ', ++$this->qb_where_group_count).' (';
- if ($this->ar_caching)
+ if ($this->qb_caching)
{
- $this->ar_cache_where[] = $value;
+ $this->qb_cache_where[] = $value;
}
return $this;
@@ -773,12 +773,12 @@ class CI_DB_active_record extends CI_DB_driver {
*/
public function group_end()
{
- $this->ar_where_group_started = FALSE;
- $this->ar_where[] = $value = str_repeat(' ', $this->ar_where_group_count--) . ')';
+ $this->qb_where_group_started = FALSE;
+ $this->qb_where[] = $value = str_repeat(' ', $this->qb_where_group_count--) . ')';
- if ($this->ar_caching)
+ if ($this->qb_caching)
{
- $this->ar_cache_where[] = $value;
+ $this->qb_cache_where[] = $value;
}
return $this;
@@ -796,10 +796,10 @@ class CI_DB_active_record extends CI_DB_driver {
*/
protected function _group_get_type($type)
{
- if ($this->ar_where_group_started)
+ if ($this->qb_where_group_started)
{
$type = '';
- $this->ar_where_group_started = FALSE;
+ $this->qb_where_group_started = FALSE;
}
return $type;
@@ -826,12 +826,12 @@ class CI_DB_active_record extends CI_DB_driver {
if ($val != '')
{
- $this->ar_groupby[] = $val = $this->_protect_identifiers($val);
+ $this->qb_groupby[] = $val = $this->_protect_identifiers($val);
- if ($this->ar_caching === TRUE)
+ if ($this->qb_caching === TRUE)
{
- $this->ar_cache_groupby[] = $val;
- $this->ar_cache_exists[] = 'groupby';
+ $this->qb_cache_groupby[] = $val;
+ $this->qb_cache_exists[] = 'groupby';
}
}
}
@@ -891,7 +891,7 @@ class CI_DB_active_record extends CI_DB_driver {
foreach ($key as $k => $v)
{
- $prefix = (count($this->ar_having) === 0) ? '' : $type;
+ $prefix = (count($this->qb_having) === 0) ? '' : $type;
if ($escape === TRUE)
{
@@ -908,11 +908,11 @@ class CI_DB_active_record extends CI_DB_driver {
$v = ' '.$this->escape($v);
}
- $this->ar_having[] = $prefix.$k.$v;
- if ($this->ar_caching === TRUE)
+ $this->qb_having[] = $prefix.$k.$v;
+ if ($this->qb_caching === TRUE)
{
- $this->ar_cache_having[] = $prefix.$k.$v;
- $this->ar_cache_exists[] = 'having';
+ $this->qb_cache_having[] = $prefix.$k.$v;
+ $this->qb_cache_exists[] = 'having';
}
}
@@ -948,7 +948,7 @@ class CI_DB_active_record extends CI_DB_driver {
foreach (explode(',', $orderby) as $part)
{
$part = trim($part);
- if ( ! in_array($part, $this->ar_aliased_tables))
+ if ( ! in_array($part, $this->qb_aliased_tables))
{
$part = $this->_protect_identifiers(trim($part));
}
@@ -966,12 +966,12 @@ class CI_DB_active_record extends CI_DB_driver {
}
}
- $this->ar_orderby[] = $orderby_statement = $orderby.$direction;
+ $this->qb_orderby[] = $orderby_statement = $orderby.$direction;
- if ($this->ar_caching === TRUE)
+ if ($this->qb_caching === TRUE)
{
- $this->ar_cache_orderby[] = $orderby_statement;
- $this->ar_cache_exists[] = 'orderby';
+ $this->qb_cache_orderby[] = $orderby_statement;
+ $this->qb_cache_exists[] = 'orderby';
}
return $this;
@@ -988,11 +988,11 @@ class CI_DB_active_record extends CI_DB_driver {
*/
public function limit($value, $offset = NULL)
{
- $this->ar_limit = (int) $value;
+ $this->qb_limit = (int) $value;
if ( ! is_null($offset))
{
- $this->ar_offset = (int) $offset;
+ $this->qb_offset = (int) $offset;
}
return $this;
@@ -1008,7 +1008,7 @@ class CI_DB_active_record extends CI_DB_driver {
*/
public function offset($offset)
{
- $this->ar_offset = (int) $offset;
+ $this->qb_offset = (int) $offset;
return $this;
}
@@ -1035,11 +1035,11 @@ class CI_DB_active_record extends CI_DB_driver {
{
if ($escape === FALSE)
{
- $this->ar_set[$this->_protect_identifiers($k)] = $v;
+ $this->qb_set[$this->_protect_identifiers($k)] = $v;
}
else
{
- $this->ar_set[$this->_protect_identifiers($k, FALSE, TRUE)] = $this->escape($v);
+ $this->qb_set[$this->_protect_identifiers($k, FALSE, TRUE)] = $this->escape($v);
}
}
@@ -1111,7 +1111,7 @@ class CI_DB_active_record extends CI_DB_driver {
* "Count All Results" query
*
* Generates a platform-specific query string that counts all records
- * returned by an Active Record query.
+ * returned by an Query Builder query.
*
* @param string
* @return string
@@ -1187,7 +1187,7 @@ class CI_DB_active_record extends CI_DB_driver {
$this->set_insert_batch($set);
}
- if (count($this->ar_set) === 0)
+ if (count($this->qb_set) === 0)
{
if ($this->db_debug)
{
@@ -1199,18 +1199,18 @@ class CI_DB_active_record extends CI_DB_driver {
if ($table == '')
{
- if ( ! isset($this->ar_from[0]))
+ if ( ! isset($this->qb_from[0]))
{
return ($this->db_debug) ? $this->display_error('db_must_set_table') : FALSE;
}
- $table = $this->ar_from[0];
+ $table = $this->qb_from[0];
}
// Batch this baby
- for ($i = 0, $total = count($this->ar_set); $i < $total; $i += 100)
+ for ($i = 0, $total = count($this->qb_set); $i < $total; $i += 100)
{
- $this->query($this->_insert_batch($this->_protect_identifiers($table, TRUE, NULL, FALSE), $this->ar_keys, array_slice($this->ar_set, $i, 100)));
+ $this->query($this->_insert_batch($this->_protect_identifiers($table, TRUE, NULL, FALSE), $this->qb_keys, array_slice($this->qb_set, $i, 100)));
}
$this->_reset_write();
@@ -1244,7 +1244,7 @@ class CI_DB_active_record extends CI_DB_driver {
if (count(array_diff($keys, array_keys($row))) > 0 OR count(array_diff(array_keys($row), $keys)) > 0)
{
// batch function above returns an error on an empty array
- $this->ar_set[] = array();
+ $this->qb_set[] = array();
return;
}
@@ -1252,7 +1252,7 @@ class CI_DB_active_record extends CI_DB_driver {
if ($escape === FALSE)
{
- $this->ar_set[] = '('.implode(',', $row).')';
+ $this->qb_set[] = '('.implode(',', $row).')';
}
else
{
@@ -1262,13 +1262,13 @@ class CI_DB_active_record extends CI_DB_driver {
$clean[] = $this->escape($value);
}
- $this->ar_set[] = '('.implode(',', $clean).')';
+ $this->qb_set[] = '('.implode(',', $clean).')';
}
}
foreach ($keys as $k)
{
- $this->ar_keys[] = $this->_protect_identifiers($k);
+ $this->qb_keys[] = $this->_protect_identifiers($k);
}
return $this;
@@ -1295,10 +1295,10 @@ class CI_DB_active_record extends CI_DB_driver {
$sql = $this->_insert(
$this->_protect_identifiers(
- $this->ar_from[0], TRUE, NULL, FALSE
+ $this->qb_from[0], TRUE, NULL, FALSE
),
- array_keys($this->ar_set),
- array_values($this->ar_set)
+ array_keys($this->qb_set),
+ array_values($this->qb_set)
);
if ($reset === TRUE)
@@ -1335,10 +1335,10 @@ class CI_DB_active_record extends CI_DB_driver {
$sql = $this->_insert(
$this->_protect_identifiers(
- $this->ar_from[0], TRUE, NULL, FALSE
+ $this->qb_from[0], TRUE, NULL, FALSE
),
- array_keys($this->ar_set),
- array_values($this->ar_set)
+ array_keys($this->qb_set),
+ array_values($this->qb_set)
);
$this->_reset_write();
@@ -1360,21 +1360,21 @@ class CI_DB_active_record extends CI_DB_driver {
*/
protected function _validate_insert($table = '')
{
- if (count($this->ar_set) === 0)
+ if (count($this->qb_set) === 0)
{
return ($this->db_debug) ? $this->display_error('db_must_use_set') : FALSE;
}
if ($table == '')
{
- if ( ! isset($this->ar_from[0]))
+ if ( ! isset($this->qb_from[0]))
{
return ($this->db_debug) ? $this->display_error('db_must_set_table') : FALSE;
}
}
else
{
- $this->ar_from[0] = $table;
+ $this->qb_from[0] = $table;
}
return TRUE;
@@ -1398,22 +1398,22 @@ class CI_DB_active_record extends CI_DB_driver {
$this->set($set);
}
- if (count($this->ar_set) === 0)
+ if (count($this->qb_set) === 0)
{
return ($this->db_debug) ? $this->display_error('db_must_use_set') : FALSE;
}
if ($table == '')
{
- if ( ! isset($this->ar_from[0]))
+ if ( ! isset($this->qb_from[0]))
{
return ($this->db_debug) ? $this->display_error('db_must_set_table') : FALSE;
}
- $table = $this->ar_from[0];
+ $table = $this->qb_from[0];
}
- $sql = $this->_replace($this->_protect_identifiers($table, TRUE, NULL, FALSE), array_keys($this->ar_set), array_values($this->ar_set));
+ $sql = $this->_replace($this->_protect_identifiers($table, TRUE, NULL, FALSE), array_keys($this->qb_set), array_values($this->qb_set));
$this->_reset_write();
return $this->query($sql);
}
@@ -1440,7 +1440,7 @@ class CI_DB_active_record extends CI_DB_driver {
return FALSE;
}
- $sql = $this->_update($this->_protect_identifiers($this->ar_from[0], TRUE, NULL, FALSE), $this->ar_set, $this->ar_where, $this->ar_orderby, $this->ar_limit);
+ $sql = $this->_update($this->_protect_identifiers($this->qb_from[0], TRUE, NULL, FALSE), $this->qb_set, $this->qb_where, $this->qb_orderby, $this->qb_limit);
if ($reset === TRUE)
{
@@ -1487,7 +1487,7 @@ class CI_DB_active_record extends CI_DB_driver {
$this->limit($limit);
}
- $sql = $this->_update($this->_protect_identifiers($this->ar_from[0], TRUE, NULL, FALSE), $this->ar_set, $this->ar_where, $this->ar_orderby, $this->ar_limit, $this->ar_like);
+ $sql = $this->_update($this->_protect_identifiers($this->qb_from[0], TRUE, NULL, FALSE), $this->qb_set, $this->qb_where, $this->qb_orderby, $this->qb_limit, $this->qb_like);
$this->_reset_write();
return $this->query($sql);
}
@@ -1507,21 +1507,21 @@ class CI_DB_active_record extends CI_DB_driver {
*/
protected function _validate_update($table = '')
{
- if (count($this->ar_set) == 0)
+ if (count($this->qb_set) == 0)
{
return ($this->db_debug) ? $this->display_error('db_must_use_set') : FALSE;
}
if ($table == '')
{
- if ( ! isset($this->ar_from[0]))
+ if ( ! isset($this->qb_from[0]))
{
return ($this->db_debug) ? $this->display_error('db_must_set_table') : FALSE;
}
}
else
{
- $this->ar_from[0] = $table;
+ $this->qb_from[0] = $table;
}
return TRUE;
@@ -1554,25 +1554,25 @@ class CI_DB_active_record extends CI_DB_driver {
$this->set_update_batch($set, $index);
}
- if (count($this->ar_set) === 0)
+ if (count($this->qb_set) === 0)
{
return ($this->db_debug) ? $this->display_error('db_must_use_set') : FALSE;
}
if ($table == '')
{
- if ( ! isset($this->ar_from[0]))
+ if ( ! isset($this->qb_from[0]))
{
return ($this->db_debug) ? $this->display_error('db_must_set_table') : FALSE;
}
- $table = $this->ar_from[0];
+ $table = $this->qb_from[0];
}
// Batch this baby
- for ($i = 0, $total = count($this->ar_set); $i < $total; $i += 100)
+ for ($i = 0, $total = count($this->qb_set); $i < $total; $i += 100)
{
- $this->query($this->_update_batch($this->_protect_identifiers($table, TRUE, NULL, FALSE), array_slice($this->ar_set, $i, 100), $this->_protect_identifiers($index), $this->ar_where));
+ $this->query($this->_update_batch($this->_protect_identifiers($table, TRUE, NULL, FALSE), array_slice($this->qb_set, $i, 100), $this->_protect_identifiers($index), $this->qb_where));
}
$this->_reset_write();
@@ -1621,7 +1621,7 @@ class CI_DB_active_record extends CI_DB_driver {
return $this->display_error('db_batch_missing_index');
}
- $this->ar_set[] = $clean;
+ $this->qb_set[] = $clean;
}
return $this;
@@ -1641,12 +1641,12 @@ class CI_DB_active_record extends CI_DB_driver {
{
if ($table == '')
{
- if ( ! isset($this->ar_from[0]))
+ if ( ! isset($this->qb_from[0]))
{
return ($this->db_debug) ? $this->display_error('db_must_set_table') : FALSE;
}
- $table = $this->ar_from[0];
+ $table = $this->qb_from[0];
}
else
{
@@ -1674,12 +1674,12 @@ class CI_DB_active_record extends CI_DB_driver {
{
if ($table == '')
{
- if ( ! isset($this->ar_from[0]))
+ if ( ! isset($this->qb_from[0]))
{
return ($this->db_debug) ? $this->display_error('db_must_set_table') : FALSE;
}
- $table = $this->ar_from[0];
+ $table = $this->qb_from[0];
}
else
{
@@ -1731,12 +1731,12 @@ class CI_DB_active_record extends CI_DB_driver {
if ($table == '')
{
- if ( ! isset($this->ar_from[0]))
+ if ( ! isset($this->qb_from[0]))
{
return ($this->db_debug) ? $this->display_error('db_must_set_table') : FALSE;
}
- $table = $this->ar_from[0];
+ $table = $this->qb_from[0];
}
elseif (is_array($table))
{
@@ -1763,12 +1763,12 @@ class CI_DB_active_record extends CI_DB_driver {
$this->limit($limit);
}
- if (count($this->ar_where) === 0 && count($this->ar_wherein) === 0 && count($this->ar_like) === 0)
+ if (count($this->qb_where) === 0 && count($this->qb_wherein) === 0 && count($this->qb_like) === 0)
{
return ($this->db_debug) ? $this->display_error('db_del_must_use_where') : FALSE;
}
- $sql = $this->_delete($table, $this->ar_where, $this->ar_like, $this->ar_limit);
+ $sql = $this->_delete($table, $this->qb_where, $this->qb_like, $this->qb_limit);
if ($reset_data)
{
$this->_reset_write();
@@ -1850,9 +1850,9 @@ class CI_DB_active_record extends CI_DB_driver {
$table = trim(strrchr($table, ' '));
// Store the alias, if it doesn't already exist
- if ( ! in_array($table, $this->ar_aliased_tables))
+ if ( ! in_array($table, $this->qb_aliased_tables))
{
- $this->ar_aliased_tables[] = $table;
+ $this->qb_aliased_tables[] = $table;
}
}
}
@@ -1879,9 +1879,9 @@ class CI_DB_active_record extends CI_DB_driver {
}
else
{
- $sql = ( ! $this->ar_distinct) ? 'SELECT ' : 'SELECT DISTINCT ';
+ $sql = ( ! $this->qb_distinct) ? 'SELECT ' : 'SELECT DISTINCT ';
- if (count($this->ar_select) === 0)
+ if (count($this->qb_select) === 0)
{
$sql .= '*';
}
@@ -1890,73 +1890,73 @@ class CI_DB_active_record extends CI_DB_driver {
// Cycle through the "select" portion of the query and prep each column name.
// The reason we protect identifiers here rather then in the select() function
// is because until the user calls the from() function we don't know if there are aliases
- foreach ($this->ar_select as $key => $val)
+ foreach ($this->qb_select as $key => $val)
{
- $no_escape = isset($this->ar_no_escape[$key]) ? $this->ar_no_escape[$key] : NULL;
- $this->ar_select[$key] = $this->_protect_identifiers($val, FALSE, $no_escape);
+ $no_escape = isset($this->qb_no_escape[$key]) ? $this->qb_no_escape[$key] : NULL;
+ $this->qb_select[$key] = $this->_protect_identifiers($val, FALSE, $no_escape);
}
- $sql .= implode(', ', $this->ar_select);
+ $sql .= implode(', ', $this->qb_select);
}
}
// Write the "FROM" portion of the query
- if (count($this->ar_from) > 0)
+ if (count($this->qb_from) > 0)
{
- $sql .= "\nFROM ".$this->_from_tables($this->ar_from);
+ $sql .= "\nFROM ".$this->_from_tables($this->qb_from);
}
// Write the "JOIN" portion of the query
- if (count($this->ar_join) > 0)
+ if (count($this->qb_join) > 0)
{
- $sql .= "\n".implode("\n", $this->ar_join);
+ $sql .= "\n".implode("\n", $this->qb_join);
}
// Write the "WHERE" portion of the query
- if (count($this->ar_where) > 0 OR count($this->ar_like) > 0)
+ if (count($this->qb_where) > 0 OR count($this->qb_like) > 0)
{
$sql .= "\nWHERE ";
}
- $sql .= implode("\n", $this->ar_where);
+ $sql .= implode("\n", $this->qb_where);
// Write the "LIKE" portion of the query
- if (count($this->ar_like) > 0)
+ if (count($this->qb_like) > 0)
{
- if (count($this->ar_where) > 0)
+ if (count($this->qb_where) > 0)
{
$sql .= "\nAND ";
}
- $sql .= implode("\n", $this->ar_like);
+ $sql .= implode("\n", $this->qb_like);
}
// Write the "GROUP BY" portion of the query
- if (count($this->ar_groupby) > 0)
+ if (count($this->qb_groupby) > 0)
{
- $sql .= "\nGROUP BY ".implode(', ', $this->ar_groupby);
+ $sql .= "\nGROUP BY ".implode(', ', $this->qb_groupby);
}
// Write the "HAVING" portion of the query
- if (count($this->ar_having) > 0)
+ if (count($this->qb_having) > 0)
{
- $sql .= "\nHAVING ".implode("\n", $this->ar_having);
+ $sql .= "\nHAVING ".implode("\n", $this->qb_having);
}
// Write the "ORDER BY" portion of the query
- if (count($this->ar_orderby) > 0)
+ if (count($this->qb_orderby) > 0)
{
- $sql .= "\nORDER BY ".implode(', ', $this->ar_orderby);
- if ($this->ar_order !== FALSE)
+ $sql .= "\nORDER BY ".implode(', ', $this->qb_orderby);
+ if ($this->qb_order !== FALSE)
{
- $sql .= ($this->ar_order == 'desc') ? ' DESC' : ' ASC';
+ $sql .= ($this->qb_order == 'desc') ? ' DESC' : ' ASC';
}
}
// Write the "LIMIT" portion of the query
- if (is_numeric($this->ar_limit))
+ if (is_numeric($this->qb_limit))
{
- return $this->_limit($sql."\n", $this->ar_limit, $this->ar_offset);
+ return $this->_limit($sql."\n", $this->qb_limit, $this->qb_offset);
}
return $sql;
@@ -2040,7 +2040,7 @@ class CI_DB_active_record extends CI_DB_driver {
*/
public function start_cache()
{
- $this->ar_caching = TRUE;
+ $this->qb_caching = TRUE;
}
// --------------------------------------------------------------------
@@ -2054,7 +2054,7 @@ class CI_DB_active_record extends CI_DB_driver {
*/
public function stop_cache()
{
- $this->ar_caching = FALSE;
+ $this->qb_caching = FALSE;
}
// --------------------------------------------------------------------
@@ -2096,38 +2096,38 @@ class CI_DB_active_record extends CI_DB_driver {
*/
protected function _merge_cache()
{
- if (count($this->ar_cache_exists) === 0)
+ if (count($this->qb_cache_exists) === 0)
{
return;
}
- foreach ($this->ar_cache_exists as $val)
+ foreach ($this->qb_cache_exists as $val)
{
- $ar_variable = 'ar_'.$val;
- $ar_cache_var = 'ar_cache_'.$val;
+ $qb_variable = 'ar_'.$val;
+ $qb_cache_var = 'ar_cache_'.$val;
- if (count($this->$ar_cache_var) === 0)
+ if (count($this->$qb_cache_var) === 0)
{
continue;
}
- $this->$ar_variable = array_unique(array_merge($this->$ar_cache_var, $this->$ar_variable));
+ $this->$qb_variable = array_unique(array_merge($this->$qb_cache_var, $this->$qb_variable));
}
// If we are "protecting identifiers" we need to examine the "from"
// portion of the query to determine if there are any aliases
- if ($this->_protect_identifiers === TRUE AND count($this->ar_cache_from) > 0)
+ if ($this->_protect_identifiers === TRUE AND count($this->qb_cache_from) > 0)
{
- $this->_track_aliases($this->ar_from);
+ $this->_track_aliases($this->qb_from);
}
- $this->ar_no_escape = $this->ar_cache_no_escape;
+ $this->qb_no_escape = $this->qb_cache_no_escape;
}
// --------------------------------------------------------------------
/**
- * Reset Active Record values.
+ * Reset Query Builder values.
*
* Publicly-visible method to reset the AR values.
*
@@ -2142,16 +2142,16 @@ class CI_DB_active_record extends CI_DB_driver {
// --------------------------------------------------------------------
/**
- * Resets the active record values. Called by the get() function
+ * Resets the query builder values. Called by the get() function
*
* @param array An array of fields to reset
* @return void
*/
- protected function _reset_run($ar_reset_items)
+ protected function _reset_run($qb_reset_items)
{
- foreach ($ar_reset_items as $item => $default_value)
+ foreach ($qb_reset_items as $item => $default_value)
{
- if ( ! in_array($item, $this->ar_store_array))
+ if ( ! in_array($item, $this->qb_store_array))
{
$this->$item = $default_value;
}
@@ -2161,7 +2161,7 @@ class CI_DB_active_record extends CI_DB_driver {
// --------------------------------------------------------------------
/**
- * Resets the active record values. Called by the get() function
+ * Resets the query builder values. Called by the get() function
*
* @return void
*/
@@ -2190,7 +2190,7 @@ class CI_DB_active_record extends CI_DB_driver {
// --------------------------------------------------------------------
/**
- * Resets the active record "write" values.
+ * Resets the query builder "write" values.
*
* Called by the insert() update() insert_batch() update_batch() and delete() functions
*
@@ -2213,5 +2213,5 @@ class CI_DB_active_record extends CI_DB_driver {
}
-/* End of file DB_active_rec.php */
-/* Location: ./system/database/DB_active_rec.php */
+/* End of file DB_query_builder.php */
+/* Location: ./system/database/DB_query_builder.php */
diff --git a/system/database/drivers/cubrid/cubrid_driver.php b/system/database/drivers/cubrid/cubrid_driver.php
index cde719eae..ccabb3b4b 100644
--- a/system/database/drivers/cubrid/cubrid_driver.php
+++ b/system/database/drivers/cubrid/cubrid_driver.php
@@ -31,7 +31,7 @@
* CUBRID Database Adapter Class
*
* Note: _DB is an extender class that the app controller
- * creates dynamically based on whether the active record
+ * creates dynamically based on whether the query builder
* class is being used or not.
*
* @package CodeIgniter
@@ -742,7 +742,7 @@ class CI_DB_cubrid_driver extends CI_DB {
if (count($where) > 0 OR count($like) > 0)
{
$conditions = "\nWHERE ";
- $conditions .= implode("\n", $this->ar_where);
+ $conditions .= implode("\n", $this->qb_where);
if (count($where) > 0 && count($like) > 0)
{
diff --git a/system/database/drivers/mssql/mssql_driver.php b/system/database/drivers/mssql/mssql_driver.php
index 2a1098932..b809241b4 100644
--- a/system/database/drivers/mssql/mssql_driver.php
+++ b/system/database/drivers/mssql/mssql_driver.php
@@ -31,7 +31,7 @@
* MS SQL Database Adapter Class
*
* Note: _DB is an extender class that the app controller
- * creates dynamically based on whether the active record
+ * creates dynamically based on whether the query builder
* class is being used or not.
*
* @package CodeIgniter
@@ -623,7 +623,7 @@ class CI_DB_mssql_driver extends CI_DB {
if (count($where) > 0 OR count($like) > 0)
{
$conditions = "\nWHERE ";
- $conditions .= implode("\n", $this->ar_where);
+ $conditions .= implode("\n", $this->qb_where);
if (count($where) > 0 && count($like) > 0)
{
diff --git a/system/database/drivers/mysql/mysql_driver.php b/system/database/drivers/mysql/mysql_driver.php
index 067710ff0..9b5e331b8 100644
--- a/system/database/drivers/mysql/mysql_driver.php
+++ b/system/database/drivers/mysql/mysql_driver.php
@@ -29,7 +29,7 @@
* MySQL Database Adapter Class
*
* Note: _DB is an extender class that the app controller
- * creates dynamically based on whether the active record
+ * creates dynamically based on whether the query builder
* class is being used or not.
*
* @package CodeIgniter
@@ -646,7 +646,7 @@ class CI_DB_mysql_driver extends CI_DB {
if (count($where) > 0 OR count($like) > 0)
{
- $conditions = "\nWHERE ".implode("\n", $this->ar_where);
+ $conditions = "\nWHERE ".implode("\n", $this->qb_where);
if (count($where) > 0 && count($like) > 0)
{
diff --git a/system/database/drivers/mysqli/mysqli_driver.php b/system/database/drivers/mysqli/mysqli_driver.php
index a79b2a4ad..f2d679f43 100644
--- a/system/database/drivers/mysqli/mysqli_driver.php
+++ b/system/database/drivers/mysqli/mysqli_driver.php
@@ -29,7 +29,7 @@
* MySQLi Database Adapter Class
*
* Note: _DB is an extender class that the app controller
- * creates dynamically based on whether the active record
+ * creates dynamically based on whether the query builder
* class is being used or not.
*
* @package CodeIgniter
@@ -641,7 +641,7 @@ class CI_DB_mysqli_driver extends CI_DB {
$conditions = '';
if (count($where) > 0 OR count($like) > 0)
{
- $conditions = "\nWHERE ".implode("\n", $this->ar_where);
+ $conditions = "\nWHERE ".implode("\n", $this->qb_where);
if (count($where) > 0 && count($like) > 0)
{
diff --git a/system/database/drivers/oci8/oci8_driver.php b/system/database/drivers/oci8/oci8_driver.php
index c6621901b..5fbc0a0a0 100644
--- a/system/database/drivers/oci8/oci8_driver.php
+++ b/system/database/drivers/oci8/oci8_driver.php
@@ -31,7 +31,7 @@
* oci8 Database Adapter Class
*
* Note: _DB is an extender class that the app controller
- * creates dynamically based on whether the active record
+ * creates dynamically based on whether the query builder
* class is being used or not.
*
* @package CodeIgniter
@@ -754,7 +754,7 @@ class CI_DB_oci8_driver extends CI_DB {
if (count($where) > 0 OR count($like) > 0)
{
$conditions = "\nWHERE ";
- $conditions .= implode("\n", $this->ar_where);
+ $conditions .= implode("\n", $this->qb_where);
if (count($where) > 0 && count($like) > 0)
{
diff --git a/system/database/drivers/odbc/odbc_driver.php b/system/database/drivers/odbc/odbc_driver.php
index 6ba39f0cd..695d0080a 100644
--- a/system/database/drivers/odbc/odbc_driver.php
+++ b/system/database/drivers/odbc/odbc_driver.php
@@ -31,7 +31,7 @@
* ODBC Database Adapter Class
*
* Note: _DB is an extender class that the app controller
- * creates dynamically based on whether the active record
+ * creates dynamically based on whether the query builder
* class is being used or not.
*
* @package CodeIgniter
@@ -593,7 +593,7 @@ class CI_DB_odbc_driver extends CI_DB {
if (count($where) > 0 OR count($like) > 0)
{
$conditions = "\nWHERE ";
- $conditions .= implode("\n", $this->ar_where);
+ $conditions .= implode("\n", $this->qb_where);
if (count($where) > 0 && count($like) > 0)
{
diff --git a/system/database/drivers/pdo/pdo_driver.php b/system/database/drivers/pdo/pdo_driver.php
index de2b0abeb..77d9adf78 100644
--- a/system/database/drivers/pdo/pdo_driver.php
+++ b/system/database/drivers/pdo/pdo_driver.php
@@ -31,7 +31,7 @@
* PDO Database Adapter Class
*
* Note: _DB is an extender class that the app controller
- * creates dynamically based on whether the active record
+ * creates dynamically based on whether the query builder
* class is being used or not.
*
* @package CodeIgniter
@@ -888,7 +888,7 @@ class CI_DB_pdo_driver extends CI_DB {
if (count($where) > 0 OR count($like) > 0)
{
$conditions = "\nWHERE ";
- $conditions .= implode("\n", $this->ar_where);
+ $conditions .= implode("\n", $this->qb_where);
if (count($where) > 0 && count($like) > 0)
{
diff --git a/system/database/drivers/postgre/postgre_driver.php b/system/database/drivers/postgre/postgre_driver.php
index 42329bded..3a172bc9e 100644
--- a/system/database/drivers/postgre/postgre_driver.php
+++ b/system/database/drivers/postgre/postgre_driver.php
@@ -31,7 +31,7 @@
* Postgre Database Adapter Class
*
* Note: _DB is an extender class that the app controller
- * creates dynamically based on whether the active record
+ * creates dynamically based on whether the query builder
* class is being used or not.
*
* @package CodeIgniter
@@ -655,7 +655,7 @@ class CI_DB_postgre_driver extends CI_DB {
if (count($where) > 0 OR count($like) > 0)
{
$conditions = "\nWHERE ";
- $conditions .= implode("\n", $this->ar_where);
+ $conditions .= implode("\n", $this->qb_where);
if (count($where) > 0 && count($like) > 0)
{
diff --git a/system/database/drivers/sqlite/sqlite_driver.php b/system/database/drivers/sqlite/sqlite_driver.php
index 28c3caecd..3a7b7c673 100644
--- a/system/database/drivers/sqlite/sqlite_driver.php
+++ b/system/database/drivers/sqlite/sqlite_driver.php
@@ -33,7 +33,7 @@
* SQLite Database Adapter Class
*
* Note: _DB is an extender class that the app controller
- * creates dynamically based on whether the active record
+ * creates dynamically based on whether the query builder
* class is being used or not.
*
* @package CodeIgniter
@@ -607,7 +607,7 @@ class CI_DB_sqlite_driver extends CI_DB {
if (count($where) > 0 OR count($like) > 0)
{
$conditions = "\nWHERE ";
- $conditions .= implode("\n", $this->ar_where);
+ $conditions .= implode("\n", $this->qb_where);
if (count($where) > 0 && count($like) > 0)
{
diff --git a/system/database/drivers/sqlsrv/sqlsrv_driver.php b/system/database/drivers/sqlsrv/sqlsrv_driver.php
index 6fd52ef70..a21009ad3 100644
--- a/system/database/drivers/sqlsrv/sqlsrv_driver.php
+++ b/system/database/drivers/sqlsrv/sqlsrv_driver.php
@@ -31,7 +31,7 @@
* SQLSRV Database Adapter Class
*
* Note: _DB is an extender class that the app controller
- * creates dynamically based on whether the active record
+ * creates dynamically based on whether the query builder
* class is being used or not.
*
* @package CodeIgniter
diff --git a/user_guide_src/source/database/configuration.rst b/user_guide_src/source/database/configuration.rst
index 040e7e33f..953bbfbcb 100644
--- a/user_guide_src/source/database/configuration.rst
+++ b/user_guide_src/source/database/configuration.rst
@@ -106,18 +106,18 @@ Note: The name "test" is arbitrary. It can be anything you want. By
default we've used the word "default" for the primary connection, but it
too can be renamed to something more relevant to your project.
-Active Record
+Query Builder
-------------
-The :doc:`Active Record Class <active_record>` is globally enabled or
-disabled by setting the $active_record variable in the database
+The :doc:`Query Builder Class <query_builder>` is globally enabled or
+disabled by setting the $query_builder variable in the database
configuration file to TRUE/FALSE (boolean). If you are not using the
-active record class, setting it to FALSE will utilize fewer resources
+query builder class, setting it to FALSE will utilize fewer resources
when the database classes are initialized.
::
- $active_record = TRUE;
+ $query_builder = TRUE;
.. note:: that some CodeIgniter classes such as Sessions require Active
Records be enabled to access certain functionality.
@@ -134,7 +134,7 @@ Explanation of Values:
**database** The name of the database you want to connect to.
**dbdriver** The database type. ie: mysql, postgres, odbc, etc. Must be specified in lower case.
**dbprefix** An optional table prefix which will added to the table name when running :doc:
- `Active Record <active_record>` queries. This permits multiple CodeIgniter installations
+ `Query Builder <query_builder>` queries. This permits multiple CodeIgniter installations
to share one database.
**pconnect** TRUE/FALSE (boolean) - Whether to use a persistent connection.
**db_debug** TRUE/FALSE (boolean) - Whether database errors should be displayed.
diff --git a/user_guide_src/source/database/connecting.rst b/user_guide_src/source/database/connecting.rst
index a834cc0f7..4db038e1e 100644
--- a/user_guide_src/source/database/connecting.rst
+++ b/user_guide_src/source/database/connecting.rst
@@ -36,7 +36,7 @@ Available Parameters
string.
#. TRUE/FALSE (boolean). Whether to return the connection ID (see
Connecting to Multiple Databases below).
-#. TRUE/FALSE (boolean). Whether to enable the Active Record class. Set
+#. TRUE/FALSE (boolean). Whether to enable the Query Builder class. Set
to TRUE by default.
Manually Connecting to a Database
diff --git a/user_guide_src/source/database/examples.rst b/user_guide_src/source/database/examples.rst
index d1cd48837..8b3cc4701 100644
--- a/user_guide_src/source/database/examples.rst
+++ b/user_guide_src/source/database/examples.rst
@@ -104,10 +104,10 @@ Standard Insert
$this->db->query($sql);
echo $this->db->affected_rows();
-Active Record Query
+Query Builder Query
===================
-The :doc:`Active Record Pattern <active_record>` gives you a simplified
+The :doc:`Query Builder Pattern <query_builder>` gives you a simplified
means of retrieving data::
$query = $this->db->get('table_name');
@@ -118,10 +118,10 @@ means of retrieving data::
}
The above get() function retrieves all the results from the supplied
-table. The :doc:`Active Record <active_record>` class contains a full
+table. The :doc:`Query Builder <query_builder>` class contains a full
compliment of functions for working with data.
-Active Record Insert
+Query Builder Insert
====================
::
diff --git a/user_guide_src/source/database/index.rst b/user_guide_src/source/database/index.rst
index ab12b7cb7..7ccb8fb00 100644
--- a/user_guide_src/source/database/index.rst
+++ b/user_guide_src/source/database/index.rst
@@ -3,7 +3,7 @@ The Database Class
##################
CodeIgniter comes with a full-featured and very fast abstracted database
-class that supports both traditional structures and Active Record
+class that supports both traditional structures and Query Builder
patterns. The database functions offer clear, simple syntax.
.. toctree::
@@ -15,7 +15,7 @@ patterns. The database functions offer clear, simple syntax.
Running Queries <queries>
Generating Query Results <results>
Query Helper Functions <helpers>
- Active Record Class <active_record>
+ Query Builder Class <query_builder>
Transactions <transactions>
Table MetaData <table_data>
Field MetaData <fields>
diff --git a/user_guide_src/source/database/queries.rst b/user_guide_src/source/database/queries.rst
index 971d5d61d..2ba3d3f4a 100644
--- a/user_guide_src/source/database/queries.rst
+++ b/user_guide_src/source/database/queries.rst
@@ -50,7 +50,7 @@ Protecting identifiers
**********************
In many databases it is advisable to protect table and field names - for
-example with backticks in MySQL. **Active Record queries are
+example with backticks in MySQL. **Query Builder queries are
automatically protected**, however if you need to manually protect an
identifier you can use::
diff --git a/user_guide_src/source/database/active_record.rst b/user_guide_src/source/database/query_builder.rst
index c04e67d2a..f55d8e2f7 100644
--- a/user_guide_src/source/database/active_record.rst
+++ b/user_guide_src/source/database/query_builder.rst
@@ -1,15 +1,15 @@
###################
-Active Record Class
+Query Builder Class
###################
-CodeIgniter uses a modified version of the Active Record Database
-Pattern. This pattern allows information to be retrieved, inserted, and
-updated in your database with minimal scripting. In some cases only one
-or two lines of code are necessary to perform a database action.
+CodeIgniter gives you access to a Query Builder class. This pattern
+allows information to be retrieved, inserted, and updated in your
+database with minimal scripting. In some cases only one or two lines
+of code are necessary to perform a database action.
CodeIgniter does not require that each database table be its own class
file. It instead provides a more simplified interface.
-Beyond simplicity, a major benefit to using the Active Record features
+Beyond simplicity, a major benefit to using the Query Builder features
is that it allows you to create database independent applications, since
the query syntax is generated by each database adapter. It also allows
for safer queries, since the values are escaped automatically by the
@@ -67,7 +67,7 @@ Example::
// Produces string: SELECT * FROM mytable
-The second parameter enables you to set whether or not the active record query
+The second parameter enables you to set whether or not the query builder query
will be reset (by default it will be&mdash;just like `$this->db->get()`)::
echo $this->db->limit(10,20)->get_compiled_select('mytable', FALSE);
@@ -512,7 +512,7 @@ $this->db->count_all_results()
==============================
Permits you to determine the number of rows in a particular Active
-Record query. Queries will accept Active Record restrictors such as
+Record query. Queries will accept Query Builder restrictors such as
where(), or_where(), like(), or_like(), etc. Example::
echo $this->db->count_all_results('my_table'); // Produces an integer, like 25
@@ -636,7 +636,7 @@ Example::
// Produces string: INSERT INTO mytable (title, name, date) VALUES ('My title', 'My name', 'My date')
-The second parameter enables you to set whether or not the active record query
+The second parameter enables you to set whether or not the query builder query
will be reset (by default it will be--just like `$this->db->insert()`_)::
echo $this->db->set('title', 'My Title')->get_compiled_insert('mytable', FALSE);
@@ -928,12 +928,12 @@ multiple functions. Consider this example::
.. _ar-caching:
*********************
-Active Record Caching
+Query Builder Caching
*********************
-While not "true" caching, Active Record enables you to save (or "cache")
+While not "true" caching, Query Builder enables you to save (or "cache")
certain parts of your queries for reuse at a later point in your
-script's execution. Normally, when an Active Record call is completed,
+script's execution. Normally, when an Query Builder call is completed,
all stored information is reset for the next call. With caching, you can
prevent this reset, and reuse information easily.
@@ -944,7 +944,7 @@ There are three Caching functions available:
$this->db->start_cache()
========================
-This function must be called to begin caching. All Active Record queries
+This function must be called to begin caching. All Query Builder queries
of the correct type (see below for supported queries) are stored for
later use.
@@ -956,7 +956,7 @@ This function can be called to stop caching.
$this->db->flush_cache()
========================
-This function deletes all items from the Active Record cache.
+This function deletes all items from the Query Builder cache.
Here's a usage example::
@@ -983,12 +983,12 @@ Here's a usage example::
$this->db->reset_query()
========================
-Resetting Active Record allows you to start fresh with your query without
+Resetting Query Builder allows you to start fresh with your query without
executing it first using a method like $this->db->get() or $this->db->insert().
Just like the methods that execute a query, this will *not* reset items you've
-cached using `Active Record Caching`_.
+cached using `Query Builder Caching`_.
-This is useful in situations where you are using Active Record to generate SQL
+This is useful in situations where you are using Query Builder to generate SQL
(ex. ``$this->db->get_compiled_select()``) but then choose to, for instance,
run the query::
diff --git a/user_guide_src/source/general/models.rst b/user_guide_src/source/general/models.rst
index b816f958a..0156b0460 100644
--- a/user_guide_src/source/general/models.rst
+++ b/user_guide_src/source/general/models.rst
@@ -55,7 +55,7 @@ model class might look like::
}
.. note:: The functions in the above example use the :doc:`Active
- Record <../database/active_record>` database functions.
+ Record <../database/query_builder>` database functions.
.. note:: For the sake of simplicity in this example we're using $_POST
directly. This is generally bad practice, and a more common approach
diff --git a/user_guide_src/source/helpers/directory_helper.rst b/user_guide_src/source/helpers/directory_helper.rst
index fd169886c..cf88732d3 100644
--- a/user_guide_src/source/helpers/directory_helper.rst
+++ b/user_guide_src/source/helpers/directory_helper.rst
@@ -59,7 +59,7 @@ be numerically indexed. Here is an example of a typical array::
[1] => config.html        
[database] => Array
(              
- [0] => active_record.html              
+ [0] => query_builder.html              
[1] => binds.html              
[2] => configuration.html
[3] => connecting.html              
diff --git a/user_guide_src/source/overview/features.rst b/user_guide_src/source/overview/features.rst
index 44db08a94..8c27b1436 100644
--- a/user_guide_src/source/overview/features.rst
+++ b/user_guide_src/source/overview/features.rst
@@ -15,7 +15,7 @@ CodeIgniter's main features.
- Model-View-Controller Based System
- Extremely Light Weight
- Full Featured database classes with support for several platforms.
-- Active Record Database Support
+- Query Builder Database Support
- Form and Data Validation
- Security and XSS Filtering
- Session Management
diff --git a/user_guide_src/source/tutorial/create_news_items.rst b/user_guide_src/source/tutorial/create_news_items.rst
index 794b67eed..bfaf13537 100644
--- a/user_guide_src/source/tutorial/create_news_items.rst
+++ b/user_guide_src/source/tutorial/create_news_items.rst
@@ -94,7 +94,7 @@ Model
-----
The only thing that remains is writing a method that writes the data to
-the database. You'll use the Active Record class to insert the
+the database. You'll use the Query Builder class to insert the
information and use the input library to get the posted data. Open up
the model created earlier and add the following:
diff --git a/user_guide_src/source/tutorial/index.rst b/user_guide_src/source/tutorial/index.rst
index c959d04d2..b1ab331d1 100644
--- a/user_guide_src/source/tutorial/index.rst
+++ b/user_guide_src/source/tutorial/index.rst
@@ -16,7 +16,7 @@ This tutorial will primarily focus on:
- Model-View-Controller basics
- Routing basics
- Form validation
-- Performing basic database queries using "Active Record"
+- Performing basic database queries using "Query Builder"
The entire tutorial is split up over several pages, each explaining a
small part of the functionality of the CodeIgniter framework. You'll go
diff --git a/user_guide_src/source/tutorial/news_section.rst b/user_guide_src/source/tutorial/news_section.rst
index 38e4214ca..82b3e3b38 100644
--- a/user_guide_src/source/tutorial/news_section.rst
+++ b/user_guide_src/source/tutorial/news_section.rst
@@ -54,7 +54,7 @@ seed records.
Now that the database and a model have been set up, you'll need a method
to get all of our posts from our database. To do this, the database
abstraction layer that is included with CodeIgniter — `Active
-Record <../database/active_record.html>`_ — is used. This makes it
+Record <../database/query_builder.html>`_ — is used. This makes it
possible to write your 'queries' once and make them work on `all
supported database systems <../general/requirements.html>`_. Add the
following code to your model.
@@ -76,7 +76,7 @@ following code to your model.
With this code you can perform two different queries. You can get all
news records, or get a news item by its `slug <#>`_. You might have
noticed that the $slug variable wasn't sanitized before running the
-query; Active Record does this for you.
+query; Query Builder does this for you.
Display the news
----------------