Skip to content
Browse files

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

  • Loading branch information...
1 parent be4bf53 commit be8c6d7bc8e6fc9d261c72366180119ef6bf3397 @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
@@ -1220,7 +1220,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})";
}
/**

0 comments on commit be8c6d7

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