Merge pull request #1400 from toopay/db-test-suite

Escape test
diff --git a/tests/codeigniter/database/query_builder/escape_test.php b/tests/codeigniter/database/query_builder/escape_test.php
index 5068592..5d575a3 100644
--- a/tests/codeigniter/database/query_builder/escape_test.php
+++ b/tests/codeigniter/database/query_builder/escape_test.php
@@ -22,15 +22,22 @@
 	 */
 	public function test_escape_like_percent_sign()
 	{
-		$string = '\%foo'
-;
-		$this->db->select('value');
-		$this->db->from('misc');
-		$this->db->like('key', $string, 'after');
-		$res = $this->db->get();
+		// Escape the like string
+		$string = $this->db->escape_like_str('\%foo');
 
+		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(1, count($res->result_array()));
+		$this->assertEquals(1, count($res));
 	}
 
 	// ------------------------------------------------------------------------
@@ -40,15 +47,21 @@
 	 */
 	public function test_escape_like_backslash_sign()
 	{
-		$string = '\\';
+		// Escape the like string
+		$string = $this->db->escape_like_str('\\');
 
-		$this->db->select('value');
-		$this->db->from('misc');
-		$this->db->like('key', $string, 'after');
-		$res = $this->db->get();
+		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->result_array()));
+		$this->assertEquals(2, count($res));
 	}
-
 }
\ No newline at end of file