Some more uses of $CFG->dbfamily. MDL-7061

This commit is contained in:
stronk7
2007-01-13 00:32:19 +00:00
parent bb48a53735
commit a4bad45c2c
6 changed files with 20 additions and 19 deletions
+5 -4
View File
@@ -169,14 +169,15 @@ class data_field_latlong extends data_field_base {
function get_sort_sql($fieldname) {
global $CFG;
switch ($CFG->dbtype) {
switch ($CFG->dbfamily) {
case 'mysql': // string in an arithmetic operation is converted to a floating-point number
return '('.$fieldname.'+0.0)';
default:
case 'postgres': //cast is for PG
return 'CAST('.$fieldname.' AS REAL)';
default: //Return just the fieldname. TODO: Look behaviour under MSSQL and Oracle
return $fieldname;
}
}
}
?>
?>
+4 -3
View File
@@ -47,12 +47,13 @@ class data_field_number extends data_field_base {
function get_sort_sql($fieldname) {
global $CFG;
switch ($CFG->dbtype) {
switch ($CFG->dbfamily) {
case 'mysql': // string in an arithmetic operation is converted to a floating-point number
return '('.$fieldname.'+0.0)';
default:
case 'postgres': // cast for PG
return 'CAST('.$fieldname.' AS REAL)';
default: // the rest, just the field name. TODO: Analyse behaviour under MSSQL and Oracle
return $fieldname;
}
}