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 <[email protected]>
This commit is contained in:
martinlanghoff
2007-12-04 06:07:12 +00:00
parent 0a85b6161b
commit 9dbb215cf6
+1 -1
View File
@@ -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