Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

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

  • Loading branch information...
commit a6bc89e4d236034704ba2842bceb21f9af7ac138 1 parent f6868f9
@simoncoggins simoncoggins authored
View
2  lib/dml/mssql_native_moodle_database.php
@@ -1218,7 +1218,7 @@ public function sql_length($fieldname) {
}
public function sql_order_by_text($fieldname, $numchars=32) {
- return ' CONVERT(varchar, ' . $fieldname . ', ' . $numchars . ')';
+ return " CONVERT(varchar({$numchars}), {$fieldname})";
}
/**
View
2  lib/dml/sqlsrv_native_moodle_database.php
@@ -1281,7 +1281,7 @@ public function sql_length($fieldname) {
}
public function sql_order_by_text($fieldname, $numchars = 32) {
- return ' CONVERT(varchar, '.$fieldname.', '.$numchars.')';
+ return " CONVERT(varchar({$numchars}), {$fieldname})";
}
/**
Please sign in to comment.
Something went wrong with that request. Please try again.