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 2014-12-31 15:12:34 +00:00
parent e53364b62f
commit 9581dff081

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() {