Remove ternary
diff --git a/tests/codeigniter/database/query_builder/escape_test.php b/tests/codeigniter/database/query_builder/escape_test.php
index 5df812c..5d575a3 100644
--- a/tests/codeigniter/database/query_builder/escape_test.php
+++ b/tests/codeigniter/database/query_builder/escape_test.php
@@ -13,9 +13,6 @@
Mock_Database_Schema_Skeleton::create_tables();
Mock_Database_Schema_Skeleton::create_data();
-
- $this->pre = (strpos(DB_DRIVER, 'pgsql') === FALSE) ? '`' : '"';
- $this->esc = (strpos(DB_DRIVER, 'mysql') === FALSE) ? '!' : '';
}
// ------------------------------------------------------------------------
@@ -25,9 +22,17 @@
*/
public function test_escape_like_percent_sign()
{
+ // Escape the like string
$string = $this->db->escape_like_str('\%foo');
- $sql = "SELECT {$this->pre}value{$this->pre} FROM {$this->pre}misc{$this->pre} WHERE {$this->pre}key{$this->pre} LIKE '$string%' ESCAPE '$this->esc';";
+ if (strpos(DB_DRIVER, 'mysql') !== FALSE)
+ {
+ $sql = "SELECT `value` FROM `misc` WHERE `key` LIKE '$string%' ESCAPE '';";
+ }
+ else
+ {
+ $sql = 'SELECT "value" FROM "misc" WHERE "key" LIKE \''.$string.'%\' ESCAPE \'!\';';
+ }
$res = $this->db->query($sql)->result_array();
@@ -42,14 +47,21 @@
*/
public function test_escape_like_backslash_sign()
{
+ // Escape the like string
$string = $this->db->escape_like_str('\\');
- $sql = "SELECT {$this->pre}value{$this->pre} FROM {$this->pre}misc{$this->pre} WHERE {$this->pre}key{$this->pre} LIKE '$string%' ESCAPE '$this->esc';";
+ if (strpos(DB_DRIVER, 'mysql') !== FALSE)
+ {
+ $sql = "SELECT `value` FROM `misc` WHERE `key` LIKE '$string%' ESCAPE '';";
+ }
+ else
+ {
+ $sql = 'SELECT "value" FROM "misc" WHERE "key" LIKE \''.$string.'%\' ESCAPE \'!\';';
+ }
$res = $this->db->query($sql)->result_array();
// Check the result
$this->assertEquals(2, count($res));
}
-
}
\ No newline at end of file