Browse files

datalib:get_my_courses() - fix CAST() to work in MySQL - MDL-12427

MySQL does not like CAST()s to VARCHAR. Change it to a CHAR() -- note
the lack of length definition -- which will do the cast without any
padding. That's what we are after, anyway.
  • Loading branch information...
1 parent 77a53d2 commit ca6f03263d42f014073366df5bea75bd08a8e48f martinlanghoff committed Dec 4, 2007
Showing with 1 addition and 1 deletion.
  1. +1 −1 lib/datalib.php
@@ -775,7 +775,7 @@ function get_my_courses($userid, $sort=NULL, $fields=NULL, $doanything=false,$li
{$CFG->prefix}role_assignments ra
INNER JOIN {$CFG->prefix}context x ON = ra.contextid
- INNER JOIN {$CFG->prefix}course_categories a ON a.path LIKE ".sql_concat("'%/'", 'CAST(x.instanceid AS varchar(10))', "'/%'")." OR x.instanceid =
+ INNER JOIN {$CFG->prefix}course_categories a ON a.path LIKE ".sql_concat("'%/'", 'CAST(x.instanceid AS CHAR(10))', "'/%'")." OR x.instanceid =
INNER JOIN {$CFG->prefix}course c ON c.category =
ra.userid = $userid AND

0 comments on commit ca6f032

Please sign in to comment.