Skip to content

Commit

Permalink
MDL-39572: Fix sql_order_by_text() to use length argument correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
simoncoggins committed Aug 15, 2013
1 parent be4bf53 commit be8c6d7
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/dml/mssql_native_moodle_database.php
Original file line number Diff line number Diff line change
Expand Up @@ -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})";
}

/**
Expand Down
2 changes: 1 addition & 1 deletion lib/dml/sqlsrv_native_moodle_database.php
Original file line number Diff line number Diff line change
Expand Up @@ -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})";
}

/**
Expand Down

0 comments on commit be8c6d7

Please sign in to comment.