diff options
author | Andrey Andreev <narf@devilix.net> | 2016-03-11 20:04:43 +0100 |
---|---|---|
committer | Andrey Andreev <narf@devilix.net> | 2016-03-11 20:04:43 +0100 |
commit | a190d78a0238a0a6abd463823321bef15713e312 (patch) | |
tree | a4e49327f8e6ca1660018cebf3b06131ae3e5faf /user_guide_src/source/database | |
parent | 3b74f57cfa6c43eab4c7cce440a454d095974a45 (diff) | |
parent | 4f9b20ae507dda7379d392386fb7ce5702626a91 (diff) |
Merge branch '3.0-stable' into develop
Resolved conflicts:
system/core/CodeIgniter.php
user_guide_src/source/changelog.rst
user_guide_src/source/conf.py
user_guide_src/source/installation/downloads.rst
user_guide_src/source/installation/upgrading.rst
Diffstat (limited to 'user_guide_src/source/database')
-rw-r--r-- | user_guide_src/source/database/db_driver_reference.rst | 7 | ||||
-rw-r--r-- | user_guide_src/source/database/queries.rst | 8 |
2 files changed, 14 insertions, 1 deletions
diff --git a/user_guide_src/source/database/db_driver_reference.rst b/user_guide_src/source/database/db_driver_reference.rst index 75d1538bd..db0c67118 100644 --- a/user_guide_src/source/database/db_driver_reference.rst +++ b/user_guide_src/source/database/db_driver_reference.rst @@ -226,6 +226,13 @@ This article is intended to be a reference for them. and ``_`` wildcard characters, so that they don't cause false-positives in LIKE conditions. + .. important:: The ``escape_like_str()`` method uses '!' (exclamation mark) + to escape special characters for *LIKE* conditions. Because this + method escapes partial strings that you would wrap in quotes + yourself, it cannot automatically add the ``ESCAPE '!'`` + condition for you, and so you'll have to manually do that. + + .. php:method:: primary($table) :param string $table: Table name diff --git a/user_guide_src/source/database/queries.rst b/user_guide_src/source/database/queries.rst index 43a0a30bf..d4ffd16cf 100644 --- a/user_guide_src/source/database/queries.rst +++ b/user_guide_src/source/database/queries.rst @@ -123,7 +123,13 @@ this: $search = '20% raise'; $sql = "SELECT id FROM table WHERE column LIKE '%" . - $this->db->escape_like_str($search)."%'"; + $this->db->escape_like_str($search)."%' ESCAPE '!'"; + +.. important:: The ``escape_like_str()`` method uses '!' (exclamation mark) + to escape special characters for *LIKE* conditions. Because this + method escapes partial strings that you would wrap in quotes + yourself, it cannot automatically add the ``ESCAPE '!'`` + condition for you, and so you'll have to manually do that. ************** |