MDL-35155 database: better sql_substr() impl. for mssql/sqlsrv + unit tests
commitde12ede98ebd547e48f3cbea3f013fdf3f3c2d93
authorEloy Lafuente (stronk7) <stronk7@moodle.org>
Mon, 12 Jan 2015 17:17:36 +0000 (12 18:17 +0100)
committerEloy Lafuente (stronk7) <stronk7@moodle.org>
Mon, 12 Jan 2015 17:26:38 +0000 (12 18:26 +0100)
treedd303d12a23558b543341b5d5866af893195feb5
parent817f22818b7b45367ccdb4651254c70e68fcc981
MDL-35155 database: better sql_substr() impl. for mssql/sqlsrv + unit tests

MSSQL's substring() implementation is somehow silly/strict and unable to
perform implicit casts to integer both for the start and length parameters.

This hits Moodle badly because of another problems (MDL-23997) we decided
to cast to string all bound placeholders long ago.

So this commit just enforces the cast of the start and length parameters to
integer. And includes unit tests for using placeholders on all positions in
the sql_substr() method.
lib/dml/mssql_native_moodle_database.php
lib/dml/sqlsrv_native_moodle_database.php
lib/dml/tests/dml_test.php