Skip to content

Commit

Permalink
MDL-42768 restore: Use sql_compare_text instead for text comparison
Browse files Browse the repository at this point in the history
  • Loading branch information
Frederic Massart committed Nov 13, 2013
1 parent 662c526 commit c7b3c10
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions backup/moodle2/restore_stepslib.php
Original file line number Diff line number Diff line change
Expand Up @@ -2210,9 +2210,15 @@ public function process_calendarevents($data) {
} 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)) {
Expand Down

0 comments on commit c7b3c10

Please sign in to comment.