diff options
author | Kyle Farris <kylefarris@gmail.com> | 2011-08-31 17:52:20 +0200 |
---|---|---|
committer | Kyle Farris <kylefarris@gmail.com> | 2011-08-31 17:52:20 +0200 |
commit | 2de2fa022253597c8f5c807218be3aa05fac340e (patch) | |
tree | 43f87056b43d4b75b5e8062d9ecdb84b28f8dc62 | |
parent | 7611601875b619d8201633cf16a790b356182039 (diff) |
Merged changes with development.
-rw-r--r-- | system/database/DB_active_rec.php | 12 | ||||
-rw-r--r-- | user_guide/changelog.html | 20 | ||||
-rw-r--r-- | 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 <li>General Changes <ul> <li class="reactor">Callback validation rules can now accept parameters like any other validation rule.</li> + <li class="reactor">Ability to log certain error types, not all under a threshold.</li> + <li class="reactor">Added html_escape() to <a href="general/common_functions.html">Common functions</a> to escape HTML output for preventing XSS.</li> </ul> </li> <li>Helpers <ul> <li class="reactor">Added <samp>increment_string()</samp> to <a href="helpers/string_helper.html">String Helper</a> to turn "foo" into "foo-1" or "foo-1" into "foo-2".</li> + <li>Altered form helper - made action on form_open_multipart helper function call optional. Fixes (#65)</li> </ul> </li> <li>Database <ul> - <li class="reactor">Added a <a href="http://www.cubrid.org/" target="_blank">CUBRID</a> driver to the <a href="libraries/database.html">Database Driver</a>. Thanks to the CUBRID team for supplying this patch.</li> + <li class="reactor">Added a <a href="http://www.cubrid.org/" target="_blank">CUBRID</a> driver to the <a href="database/index.html">Database Driver</a>. Thanks to the CUBRID team for supplying this patch.</li> <li class="reactor">Typecast limit and offset in the <a href="database/queries.html">Database Driver</a> to integers to avoid possible injection.</li> + <li class="reactor"> + Added additional option 'none' for the optional third argument for <kbd>$this->db->like()</kbd> in the <a href="database/active_record.html">Database Driver</a>. + </li> <li class="reactor">Added new <a href="database/active_record.html">Active Record</a> methods that return the SQL string of queries without executing them: <kbd>get_compiled_select()</kbd>, <kbd>get_compiled_insert()</kbd>, <kbd>get_compiled_update()</kbd>, <kbd>get_compiled_delete()</kbd>. </ul> </li> @@ -86,6 +92,8 @@ Change Log <li class="reactor">Added support to set an optional parameter in your callback rules of validation using the <a href="libraries/form_validation.html">Form Validation Library</a>.</li> <li class="reactor">Added a <a href="libraries/migration.html">Migration Library</a> to assist with applying incremental updates to your database schema.</li> <li class="reactor">Driver children can be located in any package path.</li> + <li class="reactor">Added max_filename_increment config setting for Upload library.</li> + <li><samp>CI_Loader::_ci_autoloader()</samp> is now a protected method.</li> </ul> </li> </ul> @@ -96,6 +104,11 @@ Change Log <li class="reactor">If a config class was loaded first then a library with the same name is loaded, the config would be ignored.</li> <li class="reactor">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.</li> <li class="rector">Fixed a bug (Reactor #89) where MySQL export would fail if the table had hyphens or other non alphanumeric/underscore characters.</li> + <li class="reactor">Fixed a bug (#200) where MySQL queries would be malformed after calling <samp>count_all()</samp> then <samp>db->get()</samp></li> + <li>Fixed a bug (#181) where a mis-spelling was in the form validation language file.</li> + <li>Fixed a bug (#160) - Removed unneeded array copy in the file cache driver.</li> + <li>Fixed a bug (#150) - <samp>field_data()</samp> now correctly returns column length.</li> + <li>Fixed a bug (#8) - <samp>load_class()</samp> now looks for core classes in <samp>APPPATH</samp> first, allowing them to be replaced.</li> </ul> <h2>Version 2.0.3</h2> @@ -115,7 +128,12 @@ Change Log <li>Visual updates to the welcome_message view file and default error templates. Thanks to <a href="https://bitbucket.org/danijelb">danijelb</a> for the pull request.</li> <li class="reactor">Added <samp>insert_batch()</samp> function to the PostgreSQL database driver. Thanks to epallerols for the patch.</li> <li class="reactor">Added "application/x-csv" to mimes.php.</li> + <li class="reactor">Added CSRF protection URI whitelisting.</li> <li>Fixed a bug where <a href="libraries/email.html">Email library</a> attachments with a "." in the name would using invalid MIME-types.</li> + <li>Added support for pem,p10,p12,p7a,p7c,p7m,p7r,p7s,crt,crl,der,kdb,rsa,cer,sst,csr Certs to mimes.php.</li> + <li>Added support pgp,gpg to mimes.php.</li> + <li>Added support 3gp, 3g2, mp4, wmv, f4v, vlc Video files to mimes.php.</li> + <li>Added support m4a, aac, m4u, xspf, au, ac3, flac, ogg Audio files to mimes.php.</li> </ul> </li> <li>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); <li><strong>Simple key/value method:</strong> <code>$this->db->like('title', 'match'); - <br /><br />// Produces: WHERE title LIKE '%match%' </code> <p>If you use multiple function calls they will be chained together with <var>AND</var> between them:</p> @@ -356,6 +355,13 @@ $this->db->or_where('id >', $id); $this->db->like('title', 'match', 'both'); <br /> // Produces: WHERE title LIKE '%match%' </code> </li> +If you do not want to use the wildcard (%) you can pass to the optional third argument the option 'none'. + +<code> + $this->db->like('title', 'match', 'none'); <br /> +// Produces: WHERE title LIKE 'match' +</code> + <li><strong>Associative array method:</strong> <code> @@ -794,7 +800,6 @@ $query = $this->db->get();</code> <p class="important"><strong>Note:</strong> Method chaining only works with PHP 5.</p> <a name="caching"> </a> - <h1>Active Record Caching</h1> <p>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.</p> |