summaryrefslogtreecommitdiffstats
path: root/tests/codeigniter/database
diff options
context:
space:
mode:
authorTaufan Aditya <toopay@taufanaditya.com>2012-05-25 00:07:51 +0200
committerTaufan Aditya <toopay@taufanaditya.com>2012-05-25 00:07:51 +0200
commit98dcac7ea5f82cc1d5cecedd030c5f242f1dc652 (patch)
treeb84d86b7111e85b48c425343d404e0ca8369e531 /tests/codeigniter/database
parent6a43244e1d739db17db266456221099232d120d6 (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/database')
-rw-r--r--tests/codeigniter/database/query_builder/escape_test.php7
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