Skip to content
Browse files

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

  • Loading branch information...
1 parent b9d4087 commit d16c91e919dea0e2601f2287922d8b9c460787dc @simoncoggins simoncoggins committed Aug 15, 2013
Showing with 2 additions and 2 deletions.
  1. +1 −1 lib/dml/mssql_native_moodle_database.php
  2. +1 −1 lib/dml/sqlsrv_native_moodle_database.php
View
2 lib/dml/mssql_native_moodle_database.php
@@ -1227,7 +1227,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
@@ -1289,7 +1289,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})";
}
/**

0 comments on commit d16c91e

Please sign in to comment.
Something went wrong with that request. Please try again.