Skip to content

Commit

Permalink
message/lib.php: use sql_ilike()
Browse files Browse the repository at this point in the history
  • Loading branch information
martinlanghoff committed Sep 26, 2006
1 parent d2715c7 commit 6eb7722
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions message/lib.php
Expand Up @@ -665,7 +665,7 @@ function message_search_users($courseid, $searchtext, $sort='', $exceptions='')
global $CFG; global $CFG;


$fullname = sql_fullname(); $fullname = sql_fullname();
$LIKE = sql_like(); $LIKE = sql_ilike();


if (!empty($exceptions)) { if (!empty($exceptions)) {
$except = ' AND u.id NOT IN ('. $exceptions .') '; $except = ' AND u.id NOT IN ('. $exceptions .') ';
Expand Down Expand Up @@ -720,15 +720,13 @@ function message_search($searchterms, $fromme=true, $tome=true, $courseid='none'
/// If no userid sent then assume current user /// If no userid sent then assume current user
if ($userid == 0) $userid = $USER->id; if ($userid == 0) $userid = $USER->id;


/// Some differences in syntax for PostgreSQL /// Some differences in SQL syntax
$LIKE = sql_ilike();
$NOTLIKE = 'NOT ' . $LIKE;
if ($CFG->dbtype == "postgres7") { if ($CFG->dbtype == "postgres7") {
$LIKE = "ILIKE"; // case-insensitive
$NOTLIKE = "NOT ILIKE"; // case-insensitive
$REGEXP = "~*"; $REGEXP = "~*";
$NOTREGEXP = "!~*"; $NOTREGEXP = "!~*";
} else { } else {
$LIKE = "LIKE";
$NOTLIKE = "NOT LIKE";
$REGEXP = "REGEXP"; $REGEXP = "REGEXP";
$NOTREGEXP = "NOT REGEXP"; $NOTREGEXP = "NOT REGEXP";
} }
Expand Down

0 comments on commit 6eb7722

Please sign in to comment.