MDL-35155 database: better sql_substr() impl. for mssql/sqlsrv + unit tests
commitd86285fb80b30bf6a0fc778f1c6372a62ba4d087
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:58 +0000 (12 18:26 +0100)
treee730996594b30803dd5137bf8d92d863924e2297
parente1dab7082dd3ddf1657c4d7c164dfa943281b971
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