]> git.mjollnir.org Git - moodle.git/commitdiff
Merged from MOODLE_14_STABLE: Fixing use of UCASE and LCASE in glossary which are...
authormjollnir_ <mjollnir_>
Tue, 23 Nov 2004 23:05:06 +0000 (23:05 +0000)
committermjollnir_ <mjollnir_>
Tue, 23 Nov 2004 23:05:06 +0000 (23:05 +0000)
lib/datalib.php
mod/glossary/editcategories.php

index cb4ee1466834867d5e384f2dd3af7fabcca9d514..9ae6b30a72d0a72f2df07448830f9ec7ce26fef6 100644 (file)
@@ -80,6 +80,41 @@ function begin_sql() {
     }
     return true;
 }
+
+/**
+ * returns db specific uppercase function
+ */
+function db_uppercase() {
+    global $CFG;
+    switch (strtolower($CFG->dbtype)) {
+
+    case "postgres7":
+        return "upper";
+        break;
+    case "mysql":
+    default:
+        return "ucase";
+        break;
+    }
+}
+
+/**
+ * returns db specific lowercase function
+ */
+function db_lowercase() {
+    global $CFG;
+    switch (strtolower($CFG->dbtype)) {
+
+    case "postgres7":
+        return "lower";
+        break;
+    case "mysql":
+    default:
+        return "lcase";
+        break;
+    }
+}
+
 /**
 * on DBs that support it, commit the transaction 
 */
index 4bc94c8e035d9cd93ccf901b19aa2cb0b2b68def..421461ca1773e9c708b5754f2a99693ff16eb041 100644 (file)
 
     } elseif ( $action == "add" ) {
         if ( $confirm ) {
-            $dupcategory = get_record("glossary_categories","lcase(name)",strtolower($name),"glossaryid",$glossary->id);
+            $lcase = db_lowercase();
+            $dupcategory = get_record("glossary_categories","$lcase(name)",strtolower($name),"glossaryid",$glossary->id);
             if ( $dupcategory ) {
                 echo "<p align=\"center\">" . get_string("add"). " " . get_string("category","glossary") . "<font size=\"3\">";