From 0c147b365a8bb2e584d4f957d4d0761f02bebe56 Mon Sep 17 00:00:00 2001 From: Kyle Farris Date: Fri, 26 Aug 2011 02:29:31 -0400 Subject: Added get_compiled_select(), get_compiled_insert(), get_compiled_update(), get_compiled_delete(), and reset_query() methods. to the Active Record class. --- system/database/DB_active_rec.php | 257 +++++++++++++++++++++++++++++++++----- 1 file changed, 223 insertions(+), 34 deletions(-) diff --git a/system/database/DB_active_rec.php b/system/database/DB_active_rec.php index 37d162bc1..8c801cd62 100644 --- a/system/database/DB_active_rec.php +++ b/system/database/DB_active_rec.php @@ -28,6 +28,9 @@ */ class CI_DB_active_record extends CI_DB_driver { + private $return_delete_sql = FALSE; + private $reset_delete_data = FALSE; + var $ar_select = array(); var $ar_distinct = FALSE; var $ar_from = array(); @@ -196,7 +199,7 @@ class CI_DB_active_record extends CI_DB_driver { $alias = $this->_create_alias_from_table(trim($select)); } - $sql = $type.'('.$this->_protect_identifiers(trim($select)).') AS '.$this->_protect_identifiers(trim($alias)); + $sql = $type.'('.$this->_protect_identifiers(trim($select)).') AS '.$alias; $this->ar_select[] = $sql; @@ -660,12 +663,8 @@ class CI_DB_active_record extends CI_DB_driver { $prefix = (count($this->ar_like) == 0) ? '' : $type; $v = $this->escape_like_str($v); - - if ($side == 'none') - { - $like_statement = $prefix." $k $not LIKE '{$v}'"; - } - elseif ($side == 'before') + + if ($side == 'before') { $like_statement = $prefix." $k $not LIKE '%{$v}'"; } @@ -874,11 +873,11 @@ class CI_DB_active_record extends CI_DB_driver { */ public function limit($value, $offset = '') { - $this->ar_limit = (int) $value; + $this->ar_limit = $value; if ($offset != '') { - $this->ar_offset = (int) $offset; + $this->ar_offset = $offset; } return $this; @@ -931,6 +930,38 @@ class CI_DB_active_record extends CI_DB_driver { return $this; } + + + // -------------------------------------------------------------------- + + /** + * Get SELECT query string + * + * Compiles a SELECT query string and returns the sql. + * + * @access public + * @param string the table name to select from (optional) + * @param boolean TRUE: resets AR values; FALSE: leave AR vaules alone + * @return string + */ + public function get_compiled_select($table = '', $reset = TRUE) + { + if ($table != '') + { + $this->_track_aliases($table); + $this->from($table); + } + + $select = $this->_compile_select(); + + if ($reset === TRUE) + { + $this->_reset_select(); + } + + return $select; + } + // -------------------------------------------------------------------- @@ -1148,6 +1179,36 @@ class CI_DB_active_record extends CI_DB_driver { return $this; } + + // -------------------------------------------------------------------- + + /** + * Get INSERT query string + * + * Compiles an insert query and returns the sql + * + * @access public + * @param string the table to insert into + * @param boolean TRUE: reset AR values; FALSE: leave AR values alone + * @return string + */ + public function get_compiled_insert($table = '', $reset = TRUE) + { + if ($this->_validate_insert($table) === FALSE) + { + return FALSE; + } + + $sql = $this->_insert($this->_protect_identifiers($this->ar_from[0], TRUE, NULL, FALSE), array_keys($this->ar_set), array_values($this->ar_set)); + + if ($reset === TRUE) + { + $this->_reset_write(); + } + + return $sql; + } + // -------------------------------------------------------------------- @@ -1156,17 +1217,45 @@ class CI_DB_active_record extends CI_DB_driver { * * Compiles an insert string and runs the query * + * @access public * @param string the table to insert data into * @param array an associative array of insert values * @return object */ - function insert($table = '', $set = NULL) + public function insert($table = '', $set = NULL) { if ( ! is_null($set)) { $this->set($set); } + + if ($this->_validate_insert($table) === FALSE) + { + return FALSE; + } + + $sql = $this->_insert($this->_protect_identifiers($this->ar_from[0], TRUE, NULL, FALSE), array_keys($this->ar_set), array_values($this->ar_set)); + $this->_reset_write(); + return $this->query($sql); + } + + + // -------------------------------------------------------------------- + + /** + * Validate Insert + * + * This method is used by both insert() and get_compiled_insert() to + * validate that the there data is actually being set and that table + * has been chosen to be inserted into. + * + * @access public + * @param string the table to insert data into + * @return string + */ + protected function _validate_insert($table = '') + { if (count($this->ar_set) == 0) { if ($this->db_debug) @@ -1186,14 +1275,13 @@ class CI_DB_active_record extends CI_DB_driver { } return FALSE; } - - $table = $this->ar_from[0]; } - - $sql = $this->_insert($this->_protect_identifiers($table, TRUE, NULL, FALSE), array_keys($this->ar_set), array_values($this->ar_set)); - - $this->_reset_write(); - return $this->query($sql); + else + { + $this->ar_from[0] = $table; + } + + return TRUE; } // -------------------------------------------------------------------- @@ -1242,7 +1330,41 @@ class CI_DB_active_record extends CI_DB_driver { $this->_reset_write(); return $this->query($sql); } + + + // -------------------------------------------------------------------- + /** + * Get UPDATE query string + * + * Compiles an update query and returns the sql + * + * @access public + * @param string the table to update + * @param boolean TRUE: reset AR values; FALSE: leave AR values alone + * @return string + */ + public function get_compiled_update($table = '', $reset = TRUE) + { + // Combine any cached components with the current statements + $this->_merge_cache(); + + if ($this->_validate_update($table) === FALSE) + { + 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); + + if ($reset === TRUE) + { + $this->_reset_write(); + } + + return $sql; + } + + // -------------------------------------------------------------------- /** @@ -1265,6 +1387,43 @@ class CI_DB_active_record extends CI_DB_driver { $this->set($set); } + if ($this->_validate_update($table) === FALSE) + { + return FALSE; + } + + if ($where != NULL) + { + $this->where($where); + } + + if ($limit != NULL) + { + $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->_reset_write(); + return $this->query($sql); + } + + + // -------------------------------------------------------------------- + + /** + * Validate Update + * + * This method is used by both update() and get_compiled_update() to + * validate that data is actually being set and that a table has been + * chosen to be update. + * + * @access public + * @param string the table to update data on + * @return string + */ + protected function _validate_update($table = '') + { if (count($this->ar_set) == 0) { if ($this->db_debug) @@ -1284,24 +1443,11 @@ class CI_DB_active_record extends CI_DB_driver { } return FALSE; } - - $table = $this->ar_from[0]; } - - if ($where != NULL) - { - $this->where($where); - } - - if ($limit != NULL) + else { - $this->limit($limit); + $this->ar_from[0] = $table; } - - $sql = $this->_update($this->_protect_identifiers($table, TRUE, NULL, FALSE), $this->ar_set, $this->ar_where, $this->ar_orderby, $this->ar_limit); - - $this->_reset_write(); - return $this->query($sql); } @@ -1326,7 +1472,7 @@ class CI_DB_active_record extends CI_DB_driver { { if ($this->db_debug) { - return $this->display_error('db_must_use_index'); + return $this->display_error('db_myst_use_index'); } return FALSE; @@ -1503,7 +1649,27 @@ class CI_DB_active_record extends CI_DB_driver { return $this->query($sql); } + + // -------------------------------------------------------------------- + /** + * Get DELETE query string + * + * Compiles a delete query string and returns the sql + * + * @access public + * @param string the table to delete from + * @param boolean TRUE: reset AR values; FALSE: leave AR values alone + * @return string + */ + public function get_compiled_delete($table = '', $reset = TRUE) + { + $this->return_delete_sql = TRUE; + $sql = $this->delete($table, '', NULL, $reset); + $this->return_delete_sql = FALSE; + return $sql; + } + // -------------------------------------------------------------------- /** @@ -1576,9 +1742,15 @@ class CI_DB_active_record extends CI_DB_driver { { $this->_reset_write(); } + + if ($this->return_delete_sql === true) + { + return $sql; + } return $this->query($sql); } + // -------------------------------------------------------------------- @@ -1659,6 +1831,7 @@ class CI_DB_active_record extends CI_DB_driver { } } } + // -------------------------------------------------------------------- @@ -1965,6 +2138,22 @@ class CI_DB_active_record extends CI_DB_driver { $this->ar_no_escape = $this->ar_cache_no_escape; } + + // -------------------------------------------------------------------- + + /** + * Reset Active Record values. + * + * Publicly-visible method to reset the AR values. + * + * @access public + * @return void + */ + public function reset_query() + { + $this->_reset_select(); + $this->_reset_write(); + } // -------------------------------------------------------------------- @@ -2042,4 +2231,4 @@ class CI_DB_active_record extends CI_DB_driver { } /* End of file DB_active_rec.php */ -/* Location: ./system/database/DB_active_rec.php */ \ No newline at end of file +/* Location: ./system/database/DB_active_rec.php */ -- cgit v1.2.3-24-g4f1b From 0a3176b56ad069643c400302b1baf9a2c90267ad Mon Sep 17 00:00:00 2001 From: kylefarris Date: Fri, 26 Aug 2011 02:37:52 -0400 Subject: Small formatting fix. --- system/database/DB_active_rec.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system/database/DB_active_rec.php b/system/database/DB_active_rec.php index 8c801cd62..c36e20348 100644 --- a/system/database/DB_active_rec.php +++ b/system/database/DB_active_rec.php @@ -947,7 +947,7 @@ class CI_DB_active_record extends CI_DB_driver { public function get_compiled_select($table = '', $reset = TRUE) { if ($table != '') - { + { $this->_track_aliases($table); $this->from($table); } -- cgit v1.2.3-24-g4f1b From c1ee04b4532124cbfaff69f50c996af64f63ac51 Mon Sep 17 00:00:00 2001 From: kylefarris Date: Fri, 26 Aug 2011 02:39:54 -0400 Subject: Updated the changelog to reflect new Active Record methods: get_compiled_select(), get_compiled_delete(), get_compiled_insert(), get_compiled_update(), and reset_query(). --- user_guide/changelog.html | 27 ++------------------------- 1 file changed, 2 insertions(+), 25 deletions(-) diff --git a/user_guide/changelog.html b/user_guide/changelog.html index bb80ab8b8..5fff21f7b 100644 --- a/user_guide/changelog.html +++ b/user_guide/changelog.html @@ -66,23 +66,18 @@ Change Log
  • General Changes
    • Callback validation rules can now accept parameters like any other validation rule.
    • -
    • Ability to log certain error types, not all under a threshold.
    • -
    • Added html_escape() to Common functions to escape HTML output for preventing XSS.
  • Helpers
    • Added increment_string() to String Helper to turn "foo" into "foo-1" or "foo-1" into "foo-2".
    • -
    • Altered form helper - made action on form_open_multipart helper function call optional. Fixes (#65)
  • Database
      -
    • Added a CUBRID driver to the Database Driver. Thanks to the CUBRID team for supplying this patch.
    • +
    • Added a CUBRID driver to the Database Driver. Thanks to the CUBRID team for supplying this patch.
    • Typecast limit and offset in the Database Driver to integers to avoid possible injection.
    • -
    • - Added additional option 'none' for the optional third argument for $this->db->like() in the Database Driver. -
    • +
    • Added new Active Record methods that return the SQL string of queries without executing them: get_compiled_select(), get_compiled_insert(), get_compiled_update(), get_compiled_delete().
  • Libraries @@ -91,13 +86,6 @@ Change Log
  • Added support to set an optional parameter in your callback rules of validation using the Form Validation Library.
  • Added a Migration Library to assist with applying incremental updates to your database schema.
  • Driver children can be located in any package path.
  • -
  • Added max_filename_increment config setting for Upload library.
  • -
  • CI_Loader::_ci_autoloader() is now a protected method.
  • - - -
  • Core -
      -
    • Changed private functions in CI_URI to protected so MY_URI can override them.
  • @@ -108,11 +96,6 @@ Change Log
  • If a config class was loaded first then a library with the same name is loaded, the config would be ignored.
  • Fixed a bug (Reactor #19) where 1) the 404_override route was being ignored in some cases, and 2) auto-loaded libraries were not available to the 404_override controller when a controller existed but the requested method did not.
  • Fixed a bug (Reactor #89) where MySQL export would fail if the table had hyphens or other non alphanumeric/underscore characters.
  • -
  • Fixed a bug (#200) where MySQL queries would be malformed after calling count_all() then db->get()
  • -
  • Fixed a bug (#181) where a mis-spelling was in the form validation language file.
  • -
  • Fixed a bug (#160) - Removed unneeded array copy in the file cache driver.
  • -
  • Fixed a bug (#150) - field_data() now correctly returns column length.
  • -
  • Fixed a bug (#8) - load_class() now looks for core classes in APPPATH first, allowing them to be replaced.
  • Version 2.0.3

    @@ -132,13 +115,7 @@ Change Log
  • Visual updates to the welcome_message view file and default error templates. Thanks to danijelb for the pull request.
  • Added insert_batch() function to the PostgreSQL database driver. Thanks to epallerols for the patch.
  • Added "application/x-csv" to mimes.php.
  • -
  • Added CSRF protection URI whitelisting.
  • Fixed a bug where Email library attachments with a "." in the name would using invalid MIME-types.
  • -
  • Added support for pem,p10,p12,p7a,p7c,p7m,p7r,p7s,crt,crl,der,kdb,rsa,cer,sst,csr Certs to mimes.php.
  • -
  • Added support pgp,gpg to mimes.php.
  • -
  • Added support 3gp, 3g2, mp4, wmv, f4v, vlc Video files to mimes.php.
  • -
  • Added support m4a, aac, m4u, xspf, au, ac3, flac, ogg Audio files to mimes.php.
  • -
  • Helpers -- cgit v1.2.3-24-g4f1b From 0f35b6e8fd4640915b1793f2e531867b859f1e3d Mon Sep 17 00:00:00 2001 From: kylefarris Date: Fri, 26 Aug 2011 02:40:56 -0400 Subject: Updated the Active Record documentation to reflect new publicly visible Active Record methods: get_compiled_select(), get_compiled_delete(), get_compiled_insert(), get_compiled_update(), and reset_query(). --- user_guide/database/active_record.html | 113 +++++++++++++++++++++++++++++---- 1 file changed, 100 insertions(+), 13 deletions(-) diff --git a/user_guide/database/active_record.html b/user_guide/database/active_record.html index 92d9614d5..d53630402 100644 --- a/user_guide/database/active_record.html +++ b/user_guide/database/active_record.html @@ -73,6 +73,7 @@ is generated by each database adapter. It also allows for safer queries, since
  • Deleting Data
  • Method Chaining
  • Active Record Caching
  • +
  • Reset Active Record
  •  Selecting Data

    @@ -107,6 +108,27 @@ foreach ($query->result() as $row)

    Please visit the result functions page for a full discussion regarding result generation.

    +

    $this->db->get_compiled_select();

    + +

    Compiles the selection query just like $this->db->get() but does not run the query. This method simply returns the SQL query as a string.

    + +$sql = $this->db->get_compiled_select('mytable');
    +echo $sql;
    +
    +// Produces string: SELECT * FROM mytable
    + +

    The second parameter enables you to set whether or not the active record 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);
    +
    +// Produces string: SELECT * FROM mytable LIMIT 20, 10 (in MySQL. Other databases have slightly different syntax)
    +
    +echo $this->db->select('title, content, date')->get_compiled_select();
    +
    +// Produces string: SELECT title, content, date FROM mytable
    + +

    The key thing to notice in the above example is that the second query did not utlize $this->db->from() and did not pass a table name into the first parameter. The reason for this outcome is because the query has not been executed using $this->db->get() which resets values or reset directly using $this-db->reset_query().

    +

    $this->db->get_where();

    @@ -334,13 +356,6 @@ $this->db->or_where('id >', $id); $this->db->like('title', 'match', 'both');
    // Produces: WHERE title LIKE '%match%' -If you do not want to use the wildcard (%) you can pass to the optional third argument the option 'none'. - - - $this->db->like('title', 'match', 'none');
    -// Produces: WHERE title LIKE 'match' -
    -
  • Associative array method: @@ -528,11 +543,41 @@ $this->db->insert('mytable', $object);

    Note: All values are escaped automatically producing safer queries.

    +  +

    $this->db->get_compiled_insert();

    + +

    Compiles the insertion query just like $this->db->insert() but does not run the query. This method simply returns the SQL query as a string.

    + + +$data = array(
    +   'title' => 'My title' ,
    +   'name' => 'My Name' ,
    +   'date' => 'My date'
    +);
    +
    +$sql = $this->db->set($data)->get_compiled_insert('mytable');
    +echo $sql;
    +
    +// 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 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);
    +
    +// Produces string: INSERT INTO mytable (title) VALUES ('My Title')
    +
    +echo $this->db->set('content', 'My Content')->get_compiled_insert();
    +
    +// Produces string: INSERT INTO mytable (title, content) VALUES ('My Title', 'My Content')
    + +

    The key thing to notice in the above example is that the second query did not utlize $this->db->from() nor did it pass a table name into the first parameter. The reason this worked is because the query has not been executed using $this->db->insert() which resets values or reset directly using $this-db->reset_query().

    + +

    $this->db->insert_batch();

    Generates an insert string based on the data you supply, and runs the query. You can either pass an array or an object to the function. Here is an example using an array:

    - + $data = array(
       array(
          'title' => 'My title' ,
    @@ -544,7 +589,7 @@ $data = array(
          'name' => 'Another Name' ,
          'date' => 'Another date'
       )
    -);
    +);

    $this->db->update_batch('mytable', $data);

    @@ -670,6 +715,14 @@ You can optionally pass this information directly into the update function as a

    You may also use the $this->db->set() function described above when performing updates.

    + +

    $this->db->get_compiled_update();

    + +

    This works exactly the same way as $this->db->get_compiled_insert() except that it produces an UPDATE SQL string instead of an INSERT SQL string.

    + +

    For more information view documentation for get_compiled_insert().

    + +  

    Deleting Data

    @@ -699,11 +752,22 @@ the data to the second parameter of the function:

    $this->db->where('id', '5');
    $this->db->delete($tables);

    If you want to delete all data from a table, you can use the truncate() function, or empty_table().

    + + +

    $this->db->get_compiled_delete();

    +

    This works exactly the same way as $this->db->get_compiled_insert() except that it produces a DELETE SQL string instead of an INSERT SQL string.

    +

    For more information view documentation for get_compiled_insert().

    + + +

    $this->db->empty_table();

    Generates a delete SQL string and runs the query. $this->db->empty_table('mytable');

    // Produces
    // DELETE FROM mytable

    + + +

    $this->db->truncate();

    Generates a truncate SQL string and runs the query.

    $this->db->from('mytable');
    @@ -716,7 +780,9 @@ $this->db->truncate('mytable');

    Note: If the TRUNCATE command isn't available, truncate() will execute as "DELETE FROM table".

    -

     Method Chaining

    + +  +

    Method Chaining

    Method chaining allows you to simplify your syntax by connecting multiple functions. Consider this example:

    @@ -727,9 +793,9 @@ $query = $this->db->get();

    Note: Method chaining only works with PHP 5.

    -

     

    +  -

     Active Record Caching

    +

    Active Record Caching

    While not "true" caching, Active Record 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, all stored information is reset for the next call. With caching, you can prevent this reset, and reuse information easily.

    @@ -769,7 +835,28 @@ $this->db->get('tablename');
    //Generates: SELECT `field2` FROM (`tablename`)

    Note: The following statements can be cached: select, from, join, where, like, group_by, having, order_by, set

    -

     

    + + +  +

    Reset Active Record

    + +

    Resetting Active Record 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.

    +

    This is useful in situations where you are using Active Record to generate SQL (ex. $this->db->get_compiled_select()) but then choose to, for instance, run the query:

    + + +// Note that the second parameter of the get_compiled_select method is FALSE
    +$sql = $this->db->select(array('field1','field2'))->where('field3',5)->get_compiled_select('mytable', FALSE);
    +
    +// ...
    +// Do something crazy with the SQL code... like add it to a cron script for later execution or something...
    +// ...
    +
    +$data = $this->db->get()->result_array();
    +
    +// Would execute and return an array of results of the following query:
    +// SELECT field1, field1 from mytable where field3 = 5;
    +
    + -- cgit v1.2.3-24-g4f1b From 7611601875b619d8201633cf16a790b356182039 Mon Sep 17 00:00:00 2001 From: Kyle Farris Date: Wed, 31 Aug 2011 11:17:48 -0400 Subject: Fixed some items based on code comments by gaker. --- system/database/DB_active_rec.php | 96 ++++++++++++++++++++------------------- 1 file changed, 49 insertions(+), 47 deletions(-) diff --git a/system/database/DB_active_rec.php b/system/database/DB_active_rec.php index c36e20348..46202224b 100644 --- a/system/database/DB_active_rec.php +++ b/system/database/DB_active_rec.php @@ -28,42 +28,42 @@ */ class CI_DB_active_record extends CI_DB_driver { - private $return_delete_sql = FALSE; - private $reset_delete_data = FALSE; + protected $return_delete_sql = FALSE; + protected $reset_delete_data = FALSE; - var $ar_select = array(); - var $ar_distinct = FALSE; - var $ar_from = array(); - var $ar_join = array(); - var $ar_where = array(); - var $ar_like = array(); - var $ar_groupby = array(); - var $ar_having = array(); - var $ar_keys = array(); - var $ar_limit = FALSE; - var $ar_offset = FALSE; - var $ar_order = FALSE; - var $ar_orderby = array(); - var $ar_set = array(); - var $ar_wherein = array(); - var $ar_aliased_tables = array(); - var $ar_store_array = array(); + 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(); // Active Record Caching variables - var $ar_caching = FALSE; - var $ar_cache_exists = array(); - var $ar_cache_select = array(); - var $ar_cache_from = array(); - var $ar_cache_join = array(); - var $ar_cache_where = array(); - var $ar_cache_like = array(); - var $ar_cache_groupby = array(); - var $ar_cache_having = array(); - var $ar_cache_orderby = array(); - var $ar_cache_set = array(); + 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(); - var $ar_no_escape = array(); - var $ar_cache_no_escape = array(); + protected $ar_no_escape = array(); + protected $ar_cache_no_escape = array(); // -------------------------------------------------------------------- @@ -873,11 +873,11 @@ class CI_DB_active_record extends CI_DB_driver { */ public function limit($value, $offset = '') { - $this->ar_limit = $value; + $this->ar_limit = (int) $value; if ($offset != '') { - $this->ar_offset = $offset; + $this->ar_offset = (int) $offset; } return $this; @@ -931,7 +931,6 @@ class CI_DB_active_record extends CI_DB_driver { return $this; } - // -------------------------------------------------------------------- /** @@ -962,7 +961,6 @@ class CI_DB_active_record extends CI_DB_driver { return $select; } - // -------------------------------------------------------------------- /** @@ -1199,7 +1197,13 @@ class CI_DB_active_record extends CI_DB_driver { return FALSE; } - $sql = $this->_insert($this->_protect_identifiers($this->ar_from[0], TRUE, NULL, FALSE), array_keys($this->ar_set), array_values($this->ar_set)); + $sql = $this->_insert( + $this->_protect_identifiers( + $this->ar_from[0], TRUE, NULL, FALSE + ), + array_keys($this->ar_set), + array_values($this->ar_set) + ); if ($reset === TRUE) { @@ -1208,7 +1212,6 @@ class CI_DB_active_record extends CI_DB_driver { return $sql; } - // -------------------------------------------------------------------- @@ -1234,13 +1237,18 @@ class CI_DB_active_record extends CI_DB_driver { return FALSE; } - $sql = $this->_insert($this->_protect_identifiers($this->ar_from[0], TRUE, NULL, FALSE), array_keys($this->ar_set), array_values($this->ar_set)); + $sql = $this->_insert( + $this->_protect_identifiers( + $this->ar_from[0], TRUE, NULL, FALSE + ), + array_keys($this->ar_set), + array_values($this->ar_set) + ); $this->_reset_write(); return $this->query($sql); } - // -------------------------------------------------------------------- /** @@ -1331,7 +1339,6 @@ class CI_DB_active_record extends CI_DB_driver { return $this->query($sql); } - // -------------------------------------------------------------------- /** @@ -1364,7 +1371,6 @@ class CI_DB_active_record extends CI_DB_driver { return $sql; } - // -------------------------------------------------------------------- /** @@ -1407,7 +1413,6 @@ class CI_DB_active_record extends CI_DB_driver { $this->_reset_write(); return $this->query($sql); } - // -------------------------------------------------------------------- @@ -1449,8 +1454,7 @@ class CI_DB_active_record extends CI_DB_driver { $this->ar_from[0] = $table; } } - - + // -------------------------------------------------------------------- /** @@ -1751,7 +1755,6 @@ class CI_DB_active_record extends CI_DB_driver { return $this->query($sql); } - // -------------------------------------------------------------------- /** @@ -1832,7 +1835,6 @@ class CI_DB_active_record extends CI_DB_driver { } } - // -------------------------------------------------------------------- /** -- cgit v1.2.3-24-g4f1b From 2de2fa022253597c8f5c807218be3aa05fac340e Mon Sep 17 00:00:00 2001 From: Kyle Farris Date: Wed, 31 Aug 2011 11:52:20 -0400 Subject: Merged changes with development. --- system/database/DB_active_rec.php | 12 ++++++++---- user_guide/changelog.html | 20 +++++++++++++++++++- user_guide/database/active_record.html | 9 +++++++-- 3 files changed, 34 insertions(+), 7 deletions(-) diff --git a/system/database/DB_active_rec.php b/system/database/DB_active_rec.php index 46202224b..076cc7ce4 100644 --- a/system/database/DB_active_rec.php +++ b/system/database/DB_active_rec.php @@ -199,7 +199,7 @@ class CI_DB_active_record extends CI_DB_driver { $alias = $this->_create_alias_from_table(trim($select)); } - $sql = $type.'('.$this->_protect_identifiers(trim($select)).') AS '.$alias; + $sql = $type.'('.$this->_protect_identifiers(trim($select)).') AS '.$this->_protect_identifiers(trim($alias)); $this->ar_select[] = $sql; @@ -664,7 +664,11 @@ class CI_DB_active_record extends CI_DB_driver { $v = $this->escape_like_str($v); - if ($side == 'before') + if ($side == 'none') + { + $like_statement = $prefix." $k $not LIKE '{$v}'"; + } + elseif ($side == 'before') { $like_statement = $prefix." $k $not LIKE '%{$v}'"; } @@ -1476,7 +1480,7 @@ class CI_DB_active_record extends CI_DB_driver { { if ($this->db_debug) { - return $this->display_error('db_myst_use_index'); + return $this->display_error('db_must_use_index'); } return FALSE; @@ -2233,4 +2237,4 @@ class CI_DB_active_record extends CI_DB_driver { } /* End of file DB_active_rec.php */ -/* Location: ./system/database/DB_active_rec.php */ +/* Location: ./system/database/DB_active_rec.php */ \ No newline at end of file diff --git a/user_guide/changelog.html b/user_guide/changelog.html index 5fff21f7b..b2a892b54 100644 --- a/user_guide/changelog.html +++ b/user_guide/changelog.html @@ -66,17 +66,23 @@ Change Log
  • General Changes
    • Callback validation rules can now accept parameters like any other validation rule.
    • +
    • Ability to log certain error types, not all under a threshold.
    • +
    • Added html_escape() to Common functions to escape HTML output for preventing XSS.
  • Helpers
    • Added increment_string() to String Helper to turn "foo" into "foo-1" or "foo-1" into "foo-2".
    • +
    • Altered form helper - made action on form_open_multipart helper function call optional. Fixes (#65)
  • Database
      -
    • Added a CUBRID driver to the Database Driver. Thanks to the CUBRID team for supplying this patch.
    • +
    • Added a CUBRID driver to the Database Driver. Thanks to the CUBRID team for supplying this patch.
    • Typecast limit and offset in the Database Driver to integers to avoid possible injection.
    • +
    • + Added additional option 'none' for the optional third argument for $this->db->like() in the Database Driver. +
    • Added new Active Record methods that return the SQL string of queries without executing them: get_compiled_select(), get_compiled_insert(), get_compiled_update(), get_compiled_delete().
  • @@ -86,6 +92,8 @@ Change Log
  • Added support to set an optional parameter in your callback rules of validation using the Form Validation Library.
  • Added a Migration Library to assist with applying incremental updates to your database schema.
  • Driver children can be located in any package path.
  • +
  • Added max_filename_increment config setting for Upload library.
  • +
  • CI_Loader::_ci_autoloader() is now a protected method.
  • @@ -96,6 +104,11 @@ Change Log
  • If a config class was loaded first then a library with the same name is loaded, the config would be ignored.
  • Fixed a bug (Reactor #19) where 1) the 404_override route was being ignored in some cases, and 2) auto-loaded libraries were not available to the 404_override controller when a controller existed but the requested method did not.
  • Fixed a bug (Reactor #89) where MySQL export would fail if the table had hyphens or other non alphanumeric/underscore characters.
  • +
  • Fixed a bug (#200) where MySQL queries would be malformed after calling count_all() then db->get()
  • +
  • Fixed a bug (#181) where a mis-spelling was in the form validation language file.
  • +
  • Fixed a bug (#160) - Removed unneeded array copy in the file cache driver.
  • +
  • Fixed a bug (#150) - field_data() now correctly returns column length.
  • +
  • Fixed a bug (#8) - load_class() now looks for core classes in APPPATH first, allowing them to be replaced.
  • Version 2.0.3

    @@ -115,7 +128,12 @@ Change Log
  • Visual updates to the welcome_message view file and default error templates. Thanks to danijelb for the pull request.
  • Added insert_batch() function to the PostgreSQL database driver. Thanks to epallerols for the patch.
  • Added "application/x-csv" to mimes.php.
  • +
  • Added CSRF protection URI whitelisting.
  • Fixed a bug where Email library attachments with a "." in the name would using invalid MIME-types.
  • +
  • Added support for pem,p10,p12,p7a,p7c,p7m,p7r,p7s,crt,crl,der,kdb,rsa,cer,sst,csr Certs to mimes.php.
  • +
  • Added support pgp,gpg to mimes.php.
  • +
  • Added support 3gp, 3g2, mp4, wmv, f4v, vlc Video files to mimes.php.
  • +
  • Added support m4a, aac, m4u, xspf, au, ac3, flac, ogg Audio files to mimes.php.
  • Helpers diff --git a/user_guide/database/active_record.html b/user_guide/database/active_record.html index d53630402..874dda58e 100644 --- a/user_guide/database/active_record.html +++ b/user_guide/database/active_record.html @@ -337,7 +337,6 @@ $this->db->or_where('id >', $id);
  • Simple key/value method: $this->db->like('title', 'match'); -

    // Produces: WHERE title LIKE '%match%'

    If you use multiple function calls they will be chained together with AND between them:

    @@ -356,6 +355,13 @@ $this->db->or_where('id >', $id); $this->db->like('title', 'match', 'both');
    // Produces: WHERE title LIKE '%match%'
  • +If you do not want to use the wildcard (%) you can pass to the optional third argument the option 'none'. + + + $this->db->like('title', 'match', 'none');
    +// Produces: WHERE title LIKE 'match' +
    +
  • Associative array method: @@ -794,7 +800,6 @@ $query = $this->db->get();

    Note: Method chaining only works with PHP 5.

      -

    Active Record Caching

    While not "true" caching, Active Record 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, all stored information is reset for the next call. With caching, you can prevent this reset, and reuse information easily.

    -- cgit v1.2.3-24-g4f1b From c4234c1ad57cf0b4545c6bc553ce3c9781625505 Mon Sep 17 00:00:00 2001 From: Kyle Farris Date: Wed, 31 Aug 2011 11:57:35 -0400 Subject: Fixed some formatting and stuff. --- user_guide/changelog.html | 38 +++++++++++++++++----------------- user_guide/database/active_record.html | 1 + 2 files changed, 20 insertions(+), 19 deletions(-) diff --git a/user_guide/changelog.html b/user_guide/changelog.html index b2a892b54..a47880e68 100644 --- a/user_guide/changelog.html +++ b/user_guide/changelog.html @@ -66,23 +66,23 @@ Change Log
  • General Changes
    • Callback validation rules can now accept parameters like any other validation rule.
    • -
    • Ability to log certain error types, not all under a threshold.
    • -
    • Added html_escape() to Common functions to escape HTML output for preventing XSS.
    • +
    • Ability to log certain error types, not all under a threshold.
    • +
    • Added html_escape() to Common functions to escape HTML output for preventing XSS.
  • Helpers
    • Added increment_string() to String Helper to turn "foo" into "foo-1" or "foo-1" into "foo-2".
    • -
    • Altered form helper - made action on form_open_multipart helper function call optional. Fixes (#65)
    • +
    • Altered form helper - made action on form_open_multipart helper function call optional. Fixes (#65)
  • Database
    • Added a CUBRID driver to the Database Driver. Thanks to the CUBRID team for supplying this patch.
    • Typecast limit and offset in the Database Driver to integers to avoid possible injection.
    • -
    • - Added additional option 'none' for the optional third argument for $this->db->like() in the Database Driver. -
    • +
    • + Added additional option 'none' for the optional third argument for $this->db->like() in the Database Driver. +
    • Added new Active Record methods that return the SQL string of queries without executing them: get_compiled_select(), get_compiled_insert(), get_compiled_update(), get_compiled_delete().
  • @@ -92,8 +92,8 @@ Change Log
  • Added support to set an optional parameter in your callback rules of validation using the Form Validation Library.
  • Added a Migration Library to assist with applying incremental updates to your database schema.
  • Driver children can be located in any package path.
  • -
  • Added max_filename_increment config setting for Upload library.
  • -
  • CI_Loader::_ci_autoloader() is now a protected method.
  • +
  • Added max_filename_increment config setting for Upload library.
  • +
  • CI_Loader::_ci_autoloader() is now a protected method.
  • @@ -104,11 +104,11 @@ Change Log
  • If a config class was loaded first then a library with the same name is loaded, the config would be ignored.
  • Fixed a bug (Reactor #19) where 1) the 404_override route was being ignored in some cases, and 2) auto-loaded libraries were not available to the 404_override controller when a controller existed but the requested method did not.
  • Fixed a bug (Reactor #89) where MySQL export would fail if the table had hyphens or other non alphanumeric/underscore characters.
  • -
  • Fixed a bug (#200) where MySQL queries would be malformed after calling count_all() then db->get()
  • -
  • Fixed a bug (#181) where a mis-spelling was in the form validation language file.
  • -
  • Fixed a bug (#160) - Removed unneeded array copy in the file cache driver.
  • -
  • Fixed a bug (#150) - field_data() now correctly returns column length.
  • -
  • Fixed a bug (#8) - load_class() now looks for core classes in APPPATH first, allowing them to be replaced.
  • +
  • Fixed a bug (#200) where MySQL queries would be malformed after calling count_all() then db->get()
  • +
  • Fixed a bug (#181) where a mis-spelling was in the form validation language file.
  • +
  • Fixed a bug (#160) - Removed unneeded array copy in the file cache driver.
  • +
  • Fixed a bug (#150) - field_data() now correctly returns column length.
  • +
  • Fixed a bug (#8) - load_class() now looks for core classes in APPPATH first, allowing them to be replaced.
  • Version 2.0.3

    @@ -128,12 +128,12 @@ Change Log
  • Visual updates to the welcome_message view file and default error templates. Thanks to danijelb for the pull request.
  • Added insert_batch() function to the PostgreSQL database driver. Thanks to epallerols for the patch.
  • Added "application/x-csv" to mimes.php.
  • -
  • Added CSRF protection URI whitelisting.
  • +
  • Added CSRF protection URI whitelisting.
  • Fixed a bug where Email library attachments with a "." in the name would using invalid MIME-types.
  • -
  • Added support for pem,p10,p12,p7a,p7c,p7m,p7r,p7s,crt,crl,der,kdb,rsa,cer,sst,csr Certs to mimes.php.
  • -
  • Added support pgp,gpg to mimes.php.
  • -
  • Added support 3gp, 3g2, mp4, wmv, f4v, vlc Video files to mimes.php.
  • -
  • Added support m4a, aac, m4u, xspf, au, ac3, flac, ogg Audio files to mimes.php.
  • +
  • Added support for pem,p10,p12,p7a,p7c,p7m,p7r,p7s,crt,crl,der,kdb,rsa,cer,sst,csr Certs to mimes.php.
  • +
  • Added support pgp,gpg to mimes.php.
  • +
  • Added support 3gp, 3g2, mp4, wmv, f4v, vlc Video files to mimes.php.
  • +
  • Added support m4a, aac, m4u, xspf, au, ac3, flac, ogg Audio files to mimes.php.
  • Helpers @@ -222,7 +222,7 @@ Hg Tag: v2.0.1

  • Added $config['cookie_secure'] to the config file to allow requiring a secure (HTTPS) in order to set cookies.
  • Added the constant CI_CORE to help differentiate between Core: TRUE and Reactor: FALSE.
  • Added an ENVIRONMENT constant in index.php, which affects PHP error reporting settings, and optionally, - which configuration files are loaded (see below). Read more on the Handling Environments page.
  • + which configuration files are loaded (see below). Read more on the Handling Environments page.
  • Added support for environment-specific configuration files.
  • diff --git a/user_guide/database/active_record.html b/user_guide/database/active_record.html index 874dda58e..aa888d28f 100644 --- a/user_guide/database/active_record.html +++ b/user_guide/database/active_record.html @@ -337,6 +337,7 @@ $this->db->or_where('id >', $id);
  • Simple key/value method: $this->db->like('title', 'match'); +

    // Produces: WHERE title LIKE '%match%'

    If you use multiple function calls they will be chained together with AND between them:

    -- cgit v1.2.3-24-g4f1b From 81ef70f32951de5f7b4196c1db9ce969133362dd Mon Sep 17 00:00:00 2001 From: Kyle Farris Date: Wed, 31 Aug 2011 11:59:12 -0400 Subject: One more formatting fix. --- system/database/DB_active_rec.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/system/database/DB_active_rec.php b/system/database/DB_active_rec.php index 076cc7ce4..59cd1972c 100644 --- a/system/database/DB_active_rec.php +++ b/system/database/DB_active_rec.php @@ -664,11 +664,11 @@ class CI_DB_active_record extends CI_DB_driver { $v = $this->escape_like_str($v); - if ($side == 'none') - { - $like_statement = $prefix." $k $not LIKE '{$v}'"; - } - elseif ($side == 'before') + if ($side == 'none') + { + $like_statement = $prefix." $k $not LIKE '{$v}'"; + } + elseif ($side == 'before') { $like_statement = $prefix." $k $not LIKE '%{$v}'"; } -- cgit v1.2.3-24-g4f1b From db46d02ac23b8e0bc2416e197494d3b795b57530 Mon Sep 17 00:00:00 2001 From: Kyle Farris Date: Fri, 14 Oct 2011 15:17:09 -0400 Subject: trying to resolve some merge issues --- application/config/migration.php | 82 ++++++++++++++++++++-------------------- 1 file changed, 41 insertions(+), 41 deletions(-) diff --git a/application/config/migration.php b/application/config/migration.php index dba870010..d88554d91 100644 --- a/application/config/migration.php +++ b/application/config/migration.php @@ -1,42 +1,42 @@ -migration->latest() this is the version that schema will -| be upgraded / downgraded to. -| -*/ -$config['migration_version'] = 0; - - -/* -|-------------------------------------------------------------------------- -| Migrations Path -|-------------------------------------------------------------------------- -| -| Path to your migrations folder. -| Typically, it will be within your application path. -| Also, writing permission is required within the migrations path. -| -*/ -$config['migration_path'] = APPPATH . 'migrations/'; - - -/* End of file migration.php */ +migration->latest() this is the version that schema will +| be upgraded / downgraded to. +| +*/ +$config['migration_version'] = 0; + + +/* +|-------------------------------------------------------------------------- +| Migrations Path +|-------------------------------------------------------------------------- +| +| Path to your migrations folder. +| Typically, it will be within your application path. +| Also, writing permission is required within the migrations path. +| +*/ +$config['migration_path'] = APPPATH . 'migrations/'; + + +/* End of file migration.php */ /* Location: ./application/config/migration.php */ \ No newline at end of file -- cgit v1.2.3-24-g4f1b From 5494077cd755effc3204cdba8bfac5bd2d8ad74d Mon Sep 17 00:00:00 2001 From: Kyle Farris Date: Fri, 14 Oct 2011 16:50:14 -0300 Subject: Fixed merge error. --- application/config/migration.php | 1 - 1 file changed, 1 deletion(-) diff --git a/application/config/migration.php b/application/config/migration.php index 41b89626f..8f3a2f6c5 100644 --- a/application/config/migration.php +++ b/application/config/migration.php @@ -111,5 +111,4 @@ $config['migration_path'] = APPPATH . 'migrations/'; /* End of file migration.php */ ->>>>>>> a2125a5d830fd390b4cf35f77e9bb0558cfa2dd7:application/config/migration.php /* Location: ./application/config/migration.php */ \ No newline at end of file -- cgit v1.2.3-24-g4f1b From 02e7c8b14d53e4b4b5334c6ae64e49c211f56bf1 Mon Sep 17 00:00:00 2001 From: Kyle Farris Date: Fri, 14 Oct 2011 16:51:07 -0300 Subject: REALLY fixed merge problem. --- application/config/migration.php | 43 ---------------------------------------- 1 file changed, 43 deletions(-) diff --git a/application/config/migration.php b/application/config/migration.php index 8f3a2f6c5..3ca47f688 100644 --- a/application/config/migration.php +++ b/application/config/migration.php @@ -1,46 +1,3 @@ -<<<<<<< HEAD:application/config/migration.php -migration->latest() this is the version that schema will -| be upgraded / downgraded to. -| -*/ -$config['migration_version'] = 0; - - -/* -|-------------------------------------------------------------------------- -| Migrations Path -|-------------------------------------------------------------------------- -| -| Path to your migrations folder. -| Typically, it will be within your application path. -| Also, writing permission is required within the migrations path. -| -*/ -$config['migration_path'] = APPPATH . 'migrations/'; - - -/* End of file migration.php */ -======= Date: Fri, 14 Oct 2011 17:59:49 -0300 Subject: Updated to new documentation for new active record methods. --- user_guide_src/source/database/active_record.rst | 108 +++++++++++++++++++++++ 1 file changed, 108 insertions(+) diff --git a/user_guide_src/source/database/active_record.rst b/user_guide_src/source/database/active_record.rst index e1fc00bc5..7230812de 100644 --- a/user_guide_src/source/database/active_record.rst +++ b/user_guide_src/source/database/active_record.rst @@ -54,6 +54,36 @@ $query, which can be used to show the results:: Please visit the :doc:`result functions ` page for a full discussion regarding result generation. +$this->db->get_compiled_select() +================================ + +Compiles the selection query just like `$this->db->get()`_ but does not *run* +the query. This method simply returns the SQL query as a string. + +Example:: + + $sql = $this->db->get_compiled_select('mytable'); + echo $sql; + + // Produces string: SELECT * FROM mytable + +The second parameter enables you to set whether or not the active record 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); + // Produces string: SELECT * FROM mytable LIMIT 20, 10 + // (in MySQL. Other databases have slightly different syntax) + + echo $this->db->select('title, content, date')->get_compiled_select(); + + // Produces string: SELECT title, content, date FROM mytable + +The key thing to notice in the above example is that the second query did not +utlize `$this->db->from()`_ and did not pass a table name into the first +parameter. The reason for this outcome is because the query has not been +executed using `$this->db->get()`_ which resets values or reset directly +using `$this-db->reset_query()`_. + $this->db->get_where() ====================== @@ -540,6 +570,41 @@ object. .. note:: All values are escaped automatically producing safer queries. +$this->db->get_compiled_insert() +================================ +Compiles the insertion query just like `$this->db->insert()`_ but does not +*run* the query. This method simply returns the SQL query as a string. + +Example:: + + $data = array( + 'title' => 'My title', + 'name' => 'My Name', + 'date' => 'My date' + ); + + $sql = $this->db->set($data)->get_compiled_insert('mytable'); + echo $sql; + + // 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 +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); + + // Produces string: INSERT INTO mytable (title) VALUES ('My Title') + + echo $this->db->set('content', 'My Content')->get_compiled_insert(); + + // Produces string: INSERT INTO mytable (title, content) VALUES ('My Title', 'My Content') + +The key thing to notice in the above example is that the second query did not +utlize `$this->db->from()`_ nor did it pass a table name into the first +parameter. The reason this worked is because the query has not been executed +using `$this->db->insert()`_ which resets values or reset directly using +`$this->db->reset_query()`_. + $this->db->insert_batch() ========================= @@ -717,6 +782,14 @@ array of values, the third parameter is the where key. .. note:: All values are escaped automatically producing safer queries. +$this->db->get_compiled_update() +================================ + +This works exactly the same way as ``$this->db->get_compiled_insert()`` except +that it produces an UPDATE SQL string instead of an INSERT SQL string. + +For more information view documentation for `$this->get_compiled_insert()`_. + ************* Deleting Data @@ -784,6 +857,13 @@ Generates a truncate SQL string and runs the query. .. note:: If the TRUNCATE command isn't available, truncate() will execute as "DELETE FROM table". + +$this->db->get_compiled_delete() +================================ +This works exactly the same way as ``$this->db->get_compiled_insert()`` except +that it produces a DELETE SQL string instead of an INSERT SQL string. + +For more information view documentation for `$this->get_compiled_insert()`_. *************** Method Chaining @@ -854,3 +934,31 @@ Here's a usage example:: where, like, group_by, having, order_by, set + +******************* +Reset Active Record +******************* + +Resetting Active Record 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`_. + +This is useful in situations where you are using Active Record to generate SQL +(ex. ``$this->db->get_compiled_select()``) but then choose to, for instance, +run the query:: + + // Note that the second parameter of the get_compiled_select method is FALSE + $sql = $this->db->select(array('field1','field2')) + ->where('field3',5) + ->get_compiled_select('mytable', FALSE); + + // ... + // Do something crazy with the SQL code... like add it to a cron script for + // later execution or something... + // ... + + $data = $this->db->get()->result_array(); + + // Would execute and return an array of results of the following query: + // SELECT field1, field1 from mytable where field3 = 5; -- cgit v1.2.3-24-g4f1b From 053dbc851f4c209ae05e1f079bb6da22e629b507 Mon Sep 17 00:00:00 2001 From: Kyle Farris Date: Fri, 14 Oct 2011 18:06:52 -0300 Subject: Updated changelog to new changelog format. --- user_guide_src/source/changelog.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst index a6a2683aa..d0b935224 100644 --- a/user_guide_src/source/changelog.rst +++ b/user_guide_src/source/changelog.rst @@ -46,6 +46,9 @@ Release Date: Not Released $this->db->like() in the :doc:`Database Driver `. - Added $this->db->insert_batch() support to the OCI8 (Oracle) driver. + - Added new :doc:`Active Record ` methods that return + the SQL string of queries without executing them: get_compiled_select(), + get_compiled_insert(), get_compiled_update(), get_compiled_delete(). - Libraries -- cgit v1.2.3-24-g4f1b