accesslib: fix SQL CAST()s to work on MySQL and PostgreSQL

CAST() target types aren't very portable. Use DECIMAL which works
for MySQL and Pg.

DECIMAL does seem to be supported in Oracle - but the syntax seems
different. We may still need a compat function.
This commit is contained in:
martinlanghoff
2007-09-19 07:48:31 +00:00
parent 9264620341
commit 9f560a0ccb
+2 -2
View File
@@ -4586,7 +4586,7 @@ function get_dirty_contexts($time) {
$sql = "SELECT name, value
FROM {$CFG->prefix}config_plugins
WHERE plugin='accesslib/dirtycontexts'
AND CAST(value AS integer) > $time";
AND CAST(value AS DECIMAL) > $time";
if ($ctx = get_records_sql($sql)) {
return $ctx;
}
@@ -4620,7 +4620,7 @@ function cleanup_dirty_contexts() {
global $CFG;
$sql = "plugin='accesslib/dirtycontexts' AND
CAST(value to integer) < " . time() - $CFG->sessiontimeout;
CAST(value AS DECIMAL) < " . time() - $CFG->sessiontimeout;
delete_records_select('config_plugins', $sql);
}