MDL-35155 dml: add unit test which exposes substr problem

Previously, when using parameters, substring broke on mssql.
This commit is contained in:
Dan Poltawski
2015-01-08 08:14:10 +00:00
parent 48ddb7968f
commit fa01f2b45a
+4
View File
@@ -4026,6 +4026,10 @@ class core_dml_testcase extends database_driver_testcase {
} catch (moodle_exception $e) {
$this->assertInstanceOf('coding_exception', $e);
}
$sql = "SELECT id, ".$DB->sql_substr("name", ":param1 + 1")." AS name FROM {{$tablename}}";
$record = $DB->get_record_sql($sql, array('param1' => 4));
$this->assertEquals(substr($string, 5-1), $record->name);
}
public function test_sql_length() {