From 1919471ec062dbe7ec7fe800c628628b78a32b36 Mon Sep 17 00:00:00 2001 From: Frederic Massart Date: Wed, 13 Nov 2013 11:22:09 +0800 Subject: [PATCH] MDL-42768 restore: Use sql_compare_text instead for text comparison --- backup/moodle2/restore_stepslib.php | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/backup/moodle2/restore_stepslib.php b/backup/moodle2/restore_stepslib.php index aff143f5194..14e1c354f9c 100644 --- a/backup/moodle2/restore_stepslib.php +++ b/backup/moodle2/restore_stepslib.php @@ -2197,9 +2197,15 @@ class restore_calendarevents_structure_step extends restore_structure_step { } else { $params['instance'] = 0; } - $sql = 'SELECT id FROM {event} WHERE name = ? AND courseid = ? AND - repeatid = ? AND modulename = ? AND timestart = ? AND timeduration =? - AND ' . $DB->sql_compare_text('description', 255) . ' = ' . $DB->sql_compare_text('?', 255); + $sql = "SELECT id + FROM {event} + WHERE " . $DB->sql_compare_text('name', 255) . " = " . $DB->sql_compare_text('?', 255) . " + AND courseid = ? + AND repeatid = ? + AND modulename = ? + AND timestart = ? + AND timeduration = ? + AND " . $DB->sql_compare_text('description', 255) . " = " . $DB->sql_compare_text('?', 255); $arg = array ($params['name'], $params['courseid'], $params['repeatid'], $params['modulename'], $params['timestart'], $params['timeduration'], $params['description']); $result = $DB->record_exists_sql($sql, $arg); if (empty($result)) {