Permalink
Browse files

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

  • Loading branch information...
1 parent f6868f9 commit a6bc89e4d236034704ba2842bceb21f9af7ac138 @simoncoggins simoncoggins committed Aug 14, 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
@@ -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})";
}
/**
@@ -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})";
}
/**

0 comments on commit a6bc89e

Please sign in to comment.