MDL-39572: Fix sql_order_by_text() to use length argument correctly

This commit is contained in:
Simon Coggins 2013-08-15 11:54:19 +12:00
parent be4bf53d6d
commit be8c6d7bc8
2 changed files with 2 additions and 2 deletions

View File

@ -1220,7 +1220,7 @@ class mssql_native_moodle_database extends moodle_database {
}
public function sql_order_by_text($fieldname, $numchars=32) {
return ' CONVERT(varchar, ' . $fieldname . ', ' . $numchars . ')';
return " CONVERT(varchar({$numchars}), {$fieldname})";
}
/**

View File

@ -1281,7 +1281,7 @@ class sqlsrv_native_moodle_database extends moodle_database {
}
public function sql_order_by_text($fieldname, $numchars = 32) {
return ' CONVERT(varchar, '.$fieldname.', '.$numchars.')';
return " CONVERT(varchar({$numchars}), {$fieldname})";
}
/**