diff options
author | Taufan Aditya <toopay@taufanaditya.com> | 2012-05-25 00:07:51 +0200 |
---|---|---|
committer | Taufan Aditya <toopay@taufanaditya.com> | 2012-05-25 00:07:51 +0200 |
commit | 98dcac7ea5f82cc1d5cecedd030c5f242f1dc652 (patch) | |
tree | b84d86b7111e85b48c425343d404e0ca8369e531 /tests/codeigniter | |
parent | 6a43244e1d739db17db266456221099232d120d6 (diff) |
Alter the escape like test, since it use raw SQL via query(), the sql statement would need to add ESCAPE clause for database(s) other than mysql
Diffstat (limited to 'tests/codeigniter')
-rw-r--r-- | tests/codeigniter/database/query_builder/escape_test.php | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/tests/codeigniter/database/query_builder/escape_test.php b/tests/codeigniter/database/query_builder/escape_test.php index f2d1b84ca..5dd2da058 100644 --- a/tests/codeigniter/database/query_builder/escape_test.php +++ b/tests/codeigniter/database/query_builder/escape_test.php @@ -23,7 +23,9 @@ class Escape_test extends CI_TestCase { public function test_escape_like_percent_sign() { $string = $this->db->escape_like_str('\%foo'); - $sql = "SELECT `value` FROM `misc` WHERE `key` LIKE '$string%';"; + $sql = "SELECT `value` FROM `misc` WHERE `key` LIKE '$string%'"; + $sql .= (strpos(DB_DRIVER, 'mysql') !== FALSE) ? ";" : "ESCAPE '!';"; + $res = $this->db->query($sql)->result_array(); // Check the result @@ -38,7 +40,8 @@ class Escape_test extends CI_TestCase { public function test_escape_like_backslash_sign() { $string = $this->db->escape_like_str('\\'); - $sql = "SELECT `value` FROM `misc` WHERE `key` LIKE '$string%';"; + $sql = "SELECT `value` FROM `misc` WHERE `key` LIKE '$string%'"; + $sql .= (strpos(DB_DRIVER, 'mysql') !== FALSE) ? ";" : "ESCAPE '!';"; $res = $this->db->query($sql)->result_array(); // Check the result |