diff options
Diffstat (limited to 'user_guide_src')
-rw-r--r-- | user_guide_src/source/changelog.rst | 4 | ||||
-rw-r--r-- | user_guide_src/source/database/configuration.rst | 12 | ||||
-rw-r--r-- | user_guide_src/source/database/connecting.rst | 2 | ||||
-rw-r--r-- | user_guide_src/source/database/examples.rst | 8 | ||||
-rw-r--r-- | user_guide_src/source/database/index.rst | 4 | ||||
-rw-r--r-- | user_guide_src/source/database/queries.rst | 2 | ||||
-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.rst | 2 | ||||
-rw-r--r-- | user_guide_src/source/helpers/directory_helper.rst | 2 | ||||
-rw-r--r-- | user_guide_src/source/overview/features.rst | 2 | ||||
-rw-r--r-- | user_guide_src/source/tutorial/create_news_items.rst | 2 | ||||
-rw-r--r-- | user_guide_src/source/tutorial/index.rst | 2 | ||||
-rw-r--r-- | user_guide_src/source/tutorial/news_section.rst | 4 |
13 files changed, 41 insertions, 39 deletions
diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst index 587c64c5a..7f8f9bd8b 100644 --- a/user_guide_src/source/changelog.rst +++ b/user_guide_src/source/changelog.rst @@ -45,7 +45,9 @@ Release Date: Not Released - Database - - Added new :doc:`Active Record <database/active_record>` methods that return + - Renamed the Active Record class to Query Builder to remove confusion with + the Active Record design pattern + - Added new :doc:`Query Builder <database/query_builder>` methods that return the SQL string of queries without executing them: get_compiled_select(), get_compiled_insert(), get_compiled_update(), get_compiled_delete(). - Taking care of LIKE condition when used with MySQL UPDATE statement. 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 fb4524116..5822ca62c 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 15a73614a..d23efecb3 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—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 ---------------- |