Permalink
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
View
@@ -775,7 +775,7 @@ function get_my_courses($userid, $sort=NULL, $fields=NULL, $doanything=false,$li
FROM
{$CFG->prefix}role_assignments ra
INNER JOIN {$CFG->prefix}context x ON x.id = ra.contextid
- INNER JOIN {$CFG->prefix}course_categories a ON a.path LIKE ".sql_concat("'%/'", 'CAST(x.instanceid AS varchar(10))', "'/%'")." OR x.instanceid = a.id
+ INNER JOIN {$CFG->prefix}course_categories a ON a.path LIKE ".sql_concat("'%/'", 'CAST(x.instanceid AS CHAR(10))', "'/%'")." OR x.instanceid = a.id
INNER JOIN {$CFG->prefix}course c ON c.category = a.id
WHERE
ra.userid = $userid AND

0 comments on commit ca6f032

Please sign in to comment.