Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Some fixes for postgresql

  • Loading branch information...
commit 67db6177de3254ce2aa59557422039a18a9eccad 1 parent f313361
paca70 authored
View
10 mod/glossary/edit.php
@@ -33,6 +33,12 @@
error("Course module is incorrect");
}
+if ($CFG->dbtype == 'postgres7' ) {
+ $ucase = 'upper';
+} else {
+ $ucase = 'ucase';
+}
+
if (!$glossary->studentcanpost && !isteacher($glossary->course)) {
error("You can't add/edit entries to this glossary!");
}
@@ -115,7 +121,7 @@
$permissiongranted = 1;
if ( !$glossary->allowduplicatedentries ) {
- if ($dupentries = get_records("glossary_entries","UCASE(concept)", strtoupper($newentry->concept))) {
+ if ($dupentries = get_records("glossary_entries","$ucase(concept)", strtoupper($newentry->concept))) {
foreach ($dupentries as $curentry) {
if ( $glossary->id == $curentry->glossaryid ) {
if ( $curentry->id != $e ) {
@@ -153,7 +159,7 @@
$permissiongranted = 1;
if ( !$glossary->allowduplicatedentries ) {
- if ($dupentries = get_record("glossary_entries","UCASE(concept)", strtoupper($newentry->concept), "glossaryid", $glossary->id)) {
+ if ($dupentries = get_record("glossary_entries","$ucase(concept)", strtoupper($newentry->concept), "glossaryid", $glossary->id)) {
$permissiongranted = 0;
}
}
View
8 mod/glossary/exportentry.php
@@ -24,6 +24,12 @@
$PermissionGranted = 0;
}
}
+
+ if ($CFG->dbtype == 'postgres7' ) {
+ $ucase = 'upper';
+ } else {
+ $ucase = 'ucase';
+ }
if ( !isteacher($cm->course) ) {
$PermissionGranted = 0;
@@ -59,7 +65,7 @@
} else {
if ( ! $mainglossary->allowduplicatedentries ) {
- $dupentry = get_record("glossary_entries","glossaryid", $mainglossary->id, "UCASE(concept)",strtoupper($entry->concept));
+ $dupentry = get_record("glossary_entries","glossaryid", $mainglossary->id, "$ucase(concept)",strtoupper($entry->concept));
if ( $dupentry ) {
$PermissionGranted = 0;
}
View
6 mod/glossary/import.php
@@ -222,7 +222,11 @@
if ( $newentry->casesensitive ) {
$dupentry = get_record("glossary_entries","concept",$newentry->concept,"glossaryid",$glossary->id);
} else {
- $dupentry = get_record("glossary_entries","ucase(concept)",strtoupper($newentry->concept),"glossaryid",$glossary->id);
+ if ($CFG->dbtype == 'postgres7') {
+ $dupentry = get_record("glossary_entries","upper(concept)",strtoupper($newentry->concept),"glossaryid",$glossary->id);
+ }else {
+ $dupentry = get_record("glossary_entries","ucase(concept)",strtoupper($newentry->concept),"glossaryid",$glossary->id);
+ }
}
if ($dupentry) {
$permissiongranted = 0;
View
8 mod/glossary/sql.php
@@ -94,7 +94,7 @@
} else {
$usernamefield = "u.lastname || ' ' || u.firstname";
}
- $where = "AND substr(ucase($usernamefield),1," . strlen($hook) . ") = '" . strtoupper($hook) . "'";
+ $where = "AND substr(upper($usernamefield),1," . strlen($hook) . ") = '" . strtoupper($hook) . "'";
break;
case 'mysql':
if ( $sqlsortkey == 'FIRSTNAME' ) {
@@ -129,7 +129,7 @@
if ($hook != 'ALL' and $hook != 'SPECIAL') {
switch ($CFG->dbtype) {
case 'postgres7':
- $where = 'AND substr(ucase(concept),1,' . strlen($hook) . ') = \'' . strtoupper($hook) . '\'';
+ $where = 'AND substr(upper(concept),1,' . strlen($hook) . ') = \'' . strtoupper($hook) . '\'';
break;
case 'mysql':
$where = 'AND left(ucase(concept),' . strlen($hook) . ") = '$hook'";
@@ -189,7 +189,7 @@
if ($hook != 'ALL' and $hook != 'SPECIAL') {
switch ($CFG->dbtype) {
case 'postgres7':
- $where = 'AND substr(ucase(concept),1,' . strlen($hook) . ') = \'' . strtoupper($hook) . '\'';
+ $where = 'AND substr(upper(concept),1,' . strlen($hook) . ') = \'' . strtoupper($hook) . '\'';
break;
case 'mysql':
$where = 'AND left(ucase(concept),' . strlen($hook) . ") = '" . strtoupper($hook) . "'";
@@ -208,7 +208,7 @@
}
switch ($CFG->dbtype) {
case 'postgres7':
- $where = 'AND substr(ucase(concept),1,1) NOT IN (' . strtoupper($sqlalphabet) . ')';
+ $where = 'AND substr(upper(concept),1,1) NOT IN (' . strtoupper($sqlalphabet) . ')';
break;
case 'mysql':
$where = 'AND left(ucase(concept),1) NOT IN (' . strtoupper($sqlalphabet) . ')';
Please sign in to comment.
Something went wrong with that request. Please try again.