mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 00:46:50 +02:00
Merged from MOODLE_14_STABLE: Fixing use of UCASE and LCASE in glossary which are not postgres friendly - two new functions in datalib, db_uppercase and db_lowercase which return the database-correct functions to use. Some were already fixed in HEAD - those have been left as they were
This commit is contained in:
parent
38279ad6d8
commit
6b7f8df2ec
2 changed files with 37 additions and 1 deletions
|
@ -80,6 +80,41 @@ function begin_sql() {
|
||||||
}
|
}
|
||||||
return true;
|
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
|
* on DBs that support it, commit the transaction
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -132,7 +132,8 @@
|
||||||
|
|
||||||
} elseif ( $action == "add" ) {
|
} elseif ( $action == "add" ) {
|
||||||
if ( $confirm ) {
|
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 ) {
|
if ( $dupcategory ) {
|
||||||
echo "<p align=\"center\">" . get_string("add"). " " . get_string("category","glossary") . "<font size=\"3\">";
|
echo "<p align=\"center\">" . get_string("add"). " " . get_string("category","glossary") . "<font size=\"3\">";
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue