Permalink
Browse files

MDL-29912 course search - oracle inabilities with concats, empties, n…

…ulls and type-restrictions
  • Loading branch information...
1 parent 21c5b22 commit d21cdb8b3c98c83b42ce2fbd35f79de859b3ca99 @stronk7 stronk7 committed with Sam Hemelryk Oct 26, 2011
Showing with 6 additions and 1 deletion.
  1. +6 −1 lib/datalib.php
View
7 lib/datalib.php
@@ -717,7 +717,12 @@ function get_courses_search($searchterms, $sort='fullname ASC', $page=0, $record
$params = array();
$i = 0;
- $concat = $DB->sql_concat("COALESCE(c.summary, '". $DB->sql_empty() ."')", "' '", 'c.fullname', "' '", 'c.idnumber', "' '", 'c.shortname');
+ // Thanks Oracle for your non-ansi concat and type limits in coalesce. MDL-29912
+ if ($DB->get_dbfamily() == 'oracle') {
+ $concat = $DB->sql_concat('c.summary', "' '", 'c.fullname', "' '", 'c.idnumber', "' '", 'c.shortname');
+ } else {
+ $concat = $DB->sql_concat("COALESCE(c.summary, '". $DB->sql_empty() ."')", "' '", 'c.fullname', "' '", 'c.idnumber', "' '", 'c.shortname');
+ }
foreach ($searchterms as $searchterm) {
$i++;

0 comments on commit d21cdb8

Please sign in to comment.