Merge branch 'MDL-35155-master' of git://github.com/danpoltawski/moodle
This commit is contained in:
@@ -1257,7 +1257,7 @@ class mssql_native_moodle_database extends moodle_database {
|
||||
s only returning name of SQL substring function, it now requires all parameters.');
|
||||
}
|
||||
if ($length === false) {
|
||||
return "SUBSTRING($expr, $start, (LEN($expr) - $start + 1))";
|
||||
return "SUBSTRING($expr, $start, LEN($expr))";
|
||||
} else {
|
||||
return "SUBSTRING($expr, $start, $length)";
|
||||
}
|
||||
|
||||
@@ -1324,7 +1324,7 @@ class sqlsrv_native_moodle_database extends moodle_database {
|
||||
}
|
||||
|
||||
if ($length === false) {
|
||||
return "SUBSTRING($expr, $start, (LEN($expr) - $start + 1))";
|
||||
return "SUBSTRING($expr, $start, LEN($expr))";
|
||||
} else {
|
||||
return "SUBSTRING($expr, $start, $length)";
|
||||
}
|
||||
|
||||
@@ -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() {
|
||||
|
||||
Reference in New Issue
Block a user