Permalink
Browse files

datalib:get_my_courses() - fix SQL compat Oracle - MDL-12427

One of the SQL queries in gmc is concatenating ctx.path with an id field.
Oracle barfs at the idea of casting the numeric id - so we CAST() it
explicitly, lest there be any confusion.

Credit for the fix to Dennis Rochford <Dennis.Rochford@usq.edu.au>
  • Loading branch information...
1 parent 0a85b61 commit 9dbb215cf66d960b8dddcc9f546d8c689f402f87 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("'%/'", 'x.instanceid', "'/%'")." OR x.instanceid = a.id
+ 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 c ON c.category = a.id
WHERE
ra.userid = $userid AND

0 comments on commit 9dbb215

Please sign in to comment.