]> git.mjollnir.org Git - moodle.git/commitdiff
- Fixing come incompatilities with PostgreSQL.
authorwillcast <willcast>
Sat, 21 Feb 2004 13:05:38 +0000 (13:05 +0000)
committerwillcast <willcast>
Sat, 21 Feb 2004 13:05:38 +0000 (13:05 +0000)
THANKS TO ULRIK PETERSON!

mod/glossary/lib.php
mod/glossary/sql.php

index 3c2d3f59515b063540eb79d19da7c2b0c3062283..520f865cb5fafbb046b701dacae8bccc6828f39d 100644 (file)
@@ -729,17 +729,21 @@ function glossary_search($course, $searchterms, $extended = 0, $glossary = NULL)
     }
 
     /// Some differences in syntax for entrygreSQL
-    if ($CFG->dbtype == "entrygres7") {
+    switch ($CFG->dbtype) {
+    case 'postgres7':
         $LIKE = "ILIKE";   // case-insensitive
         $NOTLIKE = "NOT ILIKE";   // case-insensitive
         $REGEXP = "~*";
         $NOTREGEXP = "!~*";
-    } else {
+    break;
+    case 'mysql':
+    default:
         $LIKE = "LIKE";
         $NOTLIKE = "NOT LIKE";
         $REGEXP = "REGEXP";
         $NOTREGEXP = "NOT REGEXP";
-    }
+    break;
+    }    
 
     $conceptsearch = "";
     $definitionsearch = "";
index 46b90b67ac148d49e47f94af8c6d61fff58d6958..bd3ed71fbc6d238ea99984c020a558a2863c89d2 100644 (file)
     } 
     $count = count_records_sql("select count(*) $sqlfrom $sqlwhere");
     $sqllimit = '';
+    
     if ( $offset >= 0 ) {
-        $sqllimit = " LIMIT $offset, $entriesbypage";
+           switch ($CFG->dbtype) {
+        case 'postgres7':
+               $sqllimit = " LIMIT $entriesbypage OFFSET $offset";
+        break;
+        case 'mysql':
+               $sqllimit = " LIMIT $offset, $entriesbypage";
+        break;
+        }    
     }
+    
     $allentries = get_records_sql("$sqlselect $sqlfrom $sqlwhere $sqlorderby $sqllimit");
 
 ?>
\ No newline at end of file