Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-34660

SQL error in assignments module with Oracle Database I

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • 2.3.3
    • 2.3.1, 2.4
    • Assignment

      We start using moodle 2.3.1 on a new install (not upgrading) with Oracle 10.2 database.

      We found two erros in SQL statements in assignments modules.

      1 - After creating a assignment, when teacher click in the link to see the works sent by students the application display a error about the SQL statement (with params replaced):

      SELECT a.id       AS assignment,
        a.nosubmissions AS offline,
        g.timemodified  AS timemarked,
        g.grader        AS grader,
        g.grade         AS grade,
        s.status        AS status
      FROM mdassign a
      LEFT JOIN mdassign_grades g
      ON g.assignment = a.id
      AND g.userid    = '3'
      LEFT JOIN mdassign_submission s
      ON s.assignment = a.id
      AND s.userid    = '3'
      AND a.id        = '23'

      Looking at the sentence we found that the word "offline" is a reserved word in Oracle environment.

      Solution (for now):
      We replaced the word offline with offlinex in the file <moodlehome>/mod/assign/lib.php in then sentence:

      // get all user submissions, indexed by assignment id
      $mysubmissions = $DB->get_records_sql("SELECT a.id AS assignment, a.nosubmissions AS offline, g.timemodified AS timemarked, g.grader AS grader, g.grade AS grade, s.status AS status
                                  FROM {assign} a LEFT JOIN {assign_grades} g ON g.assignment = a.id AND g.userid = ? LEFT JOIN {assign_submission} s ON s.assignment = a.id AND s.userid = ?
                                  AND a.id $sqlassignmentids", array_merge(array($USER->id, $USER->id), $assignmentidparams));

            damyon Damyon Wiese
            maurisones Mauri
            Eloy Lafuente (stronk7) Eloy Lafuente (stronk7)
            Michael de Raadt Michael de Raadt
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.