From 3d1885af1e7ad42bd8fb88ce2bda3f95786895e9 Mon Sep 17 00:00:00 2001 From: moodler Date: Wed, 13 Sep 2006 08:09:18 +0000 Subject: [PATCH] Added some checking that should not be necessary but I had notices in one extreme situation --- lib/dmllib.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/dmllib.php b/lib/dmllib.php index ae4d50a61e..da36bc89d6 100644 --- a/lib/dmllib.php +++ b/lib/dmllib.php @@ -593,6 +593,10 @@ function get_recordset_sql($sql, $limitfrom=null, $limitnum=null) { global $CFG, $db; + if (empty($db)) { + return false; + } + if (defined('MDL_PERFDB')) { global $PERF ; $PERF->dbqueries++; }; if ($limitfrom || $limitnum) { @@ -994,6 +998,10 @@ function insert_record($table, $dataobject, $returnid=true, $primarykey='id') { global $db, $CFG, $empty_rs_cache; + if (empty($db)) { + return false; + } + /// DIRTY HACK: Implement one cache to store meta data (needed by Oracle inserts) /// TODO: Possibly make it global to benefit other functions needing it (update_record...) if (!isset($metadatacache)) { -- 2.39.5