]> git.mjollnir.org Git - moodle.git/commitdiff
questions: MDL-20280 oracle compatibility in question backup.
authortjhunt <tjhunt>
Mon, 14 Sep 2009 17:48:51 +0000 (17:48 +0000)
committertjhunt <tjhunt>
Mon, 14 Sep 2009 17:48:51 +0000 (17:48 +0000)
Problem and fix thanks to Sara Arjona

question/backuplib.php

index 876ea343499bbd716a31f4a1d57ee957de49ef29..bfff37790f661f452006a3c4c8d67948f4194752 100644 (file)
                                             WHERE q.category= ? AND
                                                   bk.old_id=q.id AND
                                                   bk.backup_code = ?
-                                         ORDER BY parent ASC, id", array($category, $preferences->backup_unique_code));
+                                         ORDER BY parent ASC, q.id", array($category, $preferences->backup_unique_code));
         //If there are questions
         if ($questions) {
             //Write start tag
         global $CFG,$DB;
         //put the ids of the questions from all these categories into the db.
         $status = $DB->execute("INSERT INTO {backup_ids} (backup_code, table_name, old_id, info)
-                                SELECT '$backup_unique_code', 'question', q.id, ''
+                                SELECT ?, 'question', q.id, ?
                                   FROM {question} q, {backup_ids} bk
                                  WHERE q.category = bk.old_id AND bk.table_name = 'question_categories'
                                        AND " . $DB->sql_compare_text('bk.info') . " = ?
-                                       AND bk.backup_code = ?", array($info, $backup_unique_code));
+                                       AND bk.backup_code = ?",
+                array($backup_unique_code, $DB->sql_empty(), $info, $backup_unique_code));
         return $status;
     }