From: stronk7 Date: Mon, 21 Apr 2008 18:10:09 +0000 (+0000) Subject: Replace custom casting code by proper sql_cast_char2int() core function. MDL-12893... X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=ce7373f85c62200fd34f6b827aa04ee156e596e7;p=moodle.git Replace custom casting code by proper sql_cast_char2int() core function. MDL-12893 ; merged from 19_STABLE --- diff --git a/mod/data/field/date/field.class.php b/mod/data/field/date/field.class.php index 50236392de..2bf672251c 100755 --- a/mod/data/field/date/field.class.php +++ b/mod/data/field/date/field.class.php @@ -113,18 +113,8 @@ class data_field_date extends data_field_base { } function get_sort_sql($fieldname) { - global $CFG; - - switch ($CFG->dbfamily) { - case 'postgres': - case 'mssql': - return 'CAST('.$fieldname.' AS bigint)'; - case 'oracle': - return 'TO_NUMBER('.$fieldname.')'; - case 'mysql': - default: - return 'CAST('.$fieldname.' AS signed)'; - } + + return sql_cast_char2int($fieldname, true); }