From cd91db16305f60703538480eb208dca30d1f13b2 Mon Sep 17 00:00:00 2001 From: robertall Date: Tue, 13 May 2008 15:28:37 +0000 Subject: [PATCH] MDL-14442: added error checking to update_record() and insert_record() calls --- mod/data/import.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/mod/data/import.php b/mod/data/import.php index 8feb4fc7bdb..6999479abef 100755 --- a/mod/data/import.php +++ b/mod/data/import.php @@ -116,7 +116,9 @@ $content = new object(); $content->recordid = $recordid; $content->fieldid = $field->id; - insert_record('data_content', $content); + if (! insert_record('data_content', $content)) { + error("Could not insert new record ID $recordid"); + } } // Fill data_content with the values imported from the CSV file: foreach ($record as $key => $value) { @@ -137,7 +139,9 @@ } $oldcontent = get_record('data_content', 'fieldid', $field->id, 'recordid', $recordid); $content->id = $oldcontent->id; - update_record('data_content', $content); + if (! update_record('data_content', $content)) { + error("Could not update record ID $recordid"); + } } $recordsadded++; print get_string('added', 'moodle', $recordsadded) . ". " . get_string('entry', 'data') . " (ID $recordid)
\n";