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

quiz->report->statistics sql error in oracle and mssql

    Details

    • Database:
      Microsoft SQL, Oracle
    • Testing Instructions:
      Hide

      1) Run the database unit tests in as many DBs as possible.
      2) TEST: No test fails in the test_get_records_sql_complicated() unit test.
      3) Also, in as many DBs as possible, navigate to ( or create ) one quiz with multiple attempts by various students
      4) Go to the statistics report (from the Navigation menu)
      5) TEST: Select "calculate statistics from first attempt". No error.
      6) TEST: Select "calculate statistics from all attempts". No error.
      7) TEST: Click on "recalculate now" button (if present). No error.

      Show
      1) Run the database unit tests in as many DBs as possible. 2) TEST: No test fails in the test_get_records_sql_complicated() unit test. 3) Also, in as many DBs as possible, navigate to ( or create ) one quiz with multiple attempts by various students 4) Go to the statistics report (from the Navigation menu) 5) TEST: Select "calculate statistics from first attempt". No error. 6) TEST: Select "calculate statistics from all attempts". No error. 7) TEST: Click on "recalculate now" button (if present). No error.
    • Affected Branches:
      MOODLE_20_STABLE, MOODLE_21_STABLE, MOODLE_22_STABLE
    • Fixed Branches:
      MOODLE_20_STABLE, MOODLE_21_STABLE
    • Pull from Repository:
    • Pull Master Branch:

      Description

      in Quiz->results->statistics page,
      i'm getting oracle error:

      Debug info: ORA-00907: missing right parenthesis
      SELECT (CASE WHEN attempt=1 THEN 1 ELSE 0 END) AS isfirst, COUNT(1) AS countrecs, SUM(sumgrades) AS total FROM m_quiz_attempts qa WHERE qa.quiz = :quizid AND qa.preview=0 AND qa.timefinish !=0 GROUP BY (attempt=1)
      [array (
      'quizid' => '1',
      )]
      Stack trace:
      line 391 of \lib\dml\moodle_database.php: dml_read_exception thrown
      line 268 of \lib\dml\oci_native_moodle_database.php: call to moodle_database->query_end()
      line 1042 of \lib\dml\oci_native_moodle_database.php: call to oci_native_moodle_database->query_end()
      line 464 of \mod\quiz\report\statistics\report.php: call to oci_native_moodle_database->get_records_sql()
      line 594 of \mod\quiz\report\statistics\report.php: call to quiz_statistics_report->quiz_stats()
      line 97 of \mod\quiz\report\statistics\report.php: call to quiz_statistics_report->quiz_questions_stats()
      line 90 of \mod\quiz\report.php: call to quiz_statistics_report->display()

      and MSSQL error:

      Debug info: Incorrect syntax near '='.
      SELECT (CASE WHEN attempt=1 THEN 1 ELSE 0 END) AS isfirst, COUNT(1) AS countrecs, SUM(sumgrades) AS total FROM mdl_quiz_attempts qa WHERE qa.quiz = ? AND qa.preview=0 AND qa.timefinish !=0 GROUP BY (attempt=1)
      [array (
      0 => '2',
      )]
      Stack trace:
      line 391 of /lib/dml/moodle_database.php: dml_read_exception thrown
      line 255 of /lib/dml/mssql_native_moodle_database.php: call to moodle_database->query_end()
      line 707 of /lib/dml/mssql_native_moodle_database.php: call to mssql_native_moodle_database->query_end()
      line 736 of /lib/dml/mssql_native_moodle_database.php: call to mssql_native_moodle_database->get_recordset_sql()
      line 464 of /mod/quiz/report/statistics/report.php: call to mssql_native_moodle_database->get_records_sql()
      line 594 of /mod/quiz/report/statistics/report.php: call to quiz_statistics_report->quiz_stats()
      line 97 of /mod/quiz/report/statistics/report.php: call to quiz_statistics_report->quiz_questions_stats()
      line 90 of /mod/quiz/report.php: call to quiz_statistics_report->display()

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  10/Oct/11