From 9f560a0ccb4913c8f6931bd18cb7aadf746084ef Mon Sep 17 00:00:00 2001 From: martinlanghoff Date: Wed, 19 Sep 2007 07:48:31 +0000 Subject: [PATCH] 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. --- lib/accesslib.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/accesslib.php b/lib/accesslib.php index a879f71f34..456e8cc596 100755 --- a/lib/accesslib.php +++ b/lib/accesslib.php @@ -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); } -- 2.39.5