Skip to content

Commit

Permalink
MDL-45205 backup: avoid oracle incompatible query
Browse files Browse the repository at this point in the history
Instead of aliasing column name with sql, use the backup API.
  • Loading branch information
danpoltawski committed Apr 21, 2014
1 parent 085c68d commit 452ef53
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions backup/moodle2/backup_stepslib.php
Original file line number Diff line number Diff line change
Expand Up @@ -379,13 +379,7 @@ protected function define_structure() {
$section->add_child($formatoptions);

// Define sources.
// The 'availability' field needs to be renamed because it clashes with
// the old nested element structure for availability data.
$section->set_source_sql("
SELECT *, availability AS availabilityjson
FROM {course_sections} WHERE id = ?",
array('id' => backup::VAR_SECTIONID));

$section->set_source_table('course_sections', array('id' => backup::VAR_SECTIONID));
$formatoptions->set_source_sql('SELECT cfo.id, cfo.format, cfo.name, cfo.value
FROM {course} c
JOIN {course_format_options} cfo
Expand All @@ -395,6 +389,9 @@ protected function define_structure() {

// Aliases
$section->set_source_alias('section', 'number');
// The 'availability' field needs to be renamed because it clashes with
// the old nested element structure for availability data.
$section->set_source_alias('availability', 'availabilityjson');

// Set annotations
$section->annotate_files('course', 'section', 'id');
Expand Down

0 comments on commit 452ef53

Please sign in to comment.