Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
1.9.5
-
None
-
Solaris + Oracle
-
Oracle
-
MOODLE_19_STABLE
-
MOODLE_19_STABLE
-
Easy
Description
When creating a backup of a course the questions aren't included in the moodle.xml. When we activate the debug tool the followings error are showed:
ERROR 1 - ORA-00918: column ambiguously defined
To solve the problem it's necessary to revise the SQL sentence in the question/backuplib.php file (line 167) to add "q." before the id ordering field (as following):
$questions = get_records_sql("SELECT q.* FROM {$CFG->prefix}backup_ids bk, {$CFG->prefix}question q ".
"WHERE q.category= $category AND ".
"bk.old_id=q.id AND ".
"bk.backup_code = {$preferences->backup_unique_code} ".
"ORDER BY parent ASC, q.id"); // <----- This is where it's necessary to change id for q.id
ERROR2 - ORA-01400: cannot insert NULL into ("USU8"."MLBACKUP_IDS"."INFO")
To solve this problem it's necessary to revise also another SQL sentence in the question/backuplib.php file (line 464) to add a space in the info value:
$status = execute_sql("INSERT INTO {$CFG->prefix}backup_ids
(backup_code, table_name, old_id, info)
SELECT '$backup_unique_code', 'question', q.id, ' ' // <----- This is where it's necessary to change '' for ' '
FROM {$CFG->prefix}question q, {$CFG->prefix}backup_ids bk
WHERE q.category = bk.old_id AND bk.table_name = 'question_categories'
AND " . sql_compare_text('bk.info') . " = '$info'
AND bk.backup_code = '$backup_unique_code'", false);
Could you include this improvement to the main branch to solve the question backup problem in the following versions?