From 7a45a5f1ecad660dbb8341450da9eb5860948ff8 Mon Sep 17 00:00:00 2001 From: Eloy Lafuente Date: Mon, 30 Aug 2010 12:05:35 +0000 Subject: [PATCH] MDL-23997 modified char comparison tests to ensure they are executed without metadata at all --- lib/dml/simpletest/testdml.php | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/lib/dml/simpletest/testdml.php b/lib/dml/simpletest/testdml.php index 61101d3dc1f..529a755d499 100755 --- a/lib/dml/simpletest/testdml.php +++ b/lib/dml/simpletest/testdml.php @@ -2848,13 +2848,20 @@ class dml_test extends UnitTestCase { $this->assertTrue($DB->insert_record($tablename, array('name' => 'bb', 'content'=>2))); - $this->assertTrue($records = $DB->get_records($tablename, array('name' => 1))); + // Conditions in CHAR colums + $sqlqm = "SELECT * + FROM {{$tablename}} + WHERE name = ?"; + $this->assertTrue($records = $DB->get_records_sql($sqlqm, array(1))); $this->assertEqual(1, count($records)); - $this->assertTrue($records = $DB->get_records($tablename, array('name' => '1'))); + $this->assertTrue($records = $DB->get_records_sql($sqlqm, array('1'))); $this->assertEqual(1, count($records)); - $this->assertTrue($records = $DB->get_records($tablename, array('name' => 2))); + $sqlnamed = "SELECT * + FROM {{$tablename}} + WHERE name = :name"; + $this->assertTrue($records = $DB->get_records_sql($sqlnamed, array('name' => 2))); $this->assertEqual(1, count($records)); - $this->assertTrue($records = $DB->get_records($tablename, array('name' => '2'))); + $this->assertTrue($records = $DB->get_records_sql($sqlnamed, array('name' => '2'))); $this->assertEqual(1, count($records)); // Conditions in TEXT columns always must be performed with the sql_compare_text -- 2.43.0