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

Error on Oracle DB operations caused by placeholders longer than 28 chars

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.0.3, 2.1.1, 2.2
    • Fix Version/s: 2.0.5, 2.1.2
    • Component/s: Database SQL/XMLDB
    • Labels:
    • Environment:
      Oracle 11
    • Database:
      Oracle
    • Testing Instructions:
      Hide

      TEST1:

      1) Using Oracle and 21_STABLE, create some multiple choice question, verify that "partially correct feedback" is created and updated ok.
      2) Using Oracle, import questions from another course. Must work without any "identifier too long" error.

      TEST2:

      1) Install Moodle 2.0.x under Oracle. Create at least one course with some multiple choice questions.
      2) Upgrade to Moodle 2.1.x. Must work without error.

      TEST3:

      1) Run the DB functional test against mysql, pgsql, mssql, sqlsrv and oracle. Confirm that no failures happen in test_tweak_param_names() or test_fix_sql_params().

      TEST4:

      1. Using Oracle, Create a database table with a column whose name is 30 char, as allowed by our coding guidelines.
      2. Use $DB->insert_record to try to insert a row. Should work without error.

      Show
      TEST1: 1) Using Oracle and 21_STABLE, create some multiple choice question, verify that "partially correct feedback" is created and updated ok. 2) Using Oracle, import questions from another course. Must work without any "identifier too long" error. TEST2: 1) Install Moodle 2.0.x under Oracle. Create at least one course with some multiple choice questions. 2) Upgrade to Moodle 2.1.x. Must work without error. TEST3: 1) Run the DB functional test against mysql, pgsql, mssql, sqlsrv and oracle. Confirm that no failures happen in test_tweak_param_names() or test_fix_sql_params(). TEST4: 1. Using Oracle, Create a database table with a column whose name is 30 char, as allowed by our coding guidelines. 2. Use $DB->insert_record to try to insert a row. Should work without error.
    • Workaround:
      Hide

      Our Moodle admin suspects that the identifier labeled "o_partiallycorrectfeedbackformat" is too long for Oracle. He commented out the following line:

      //$options->partiallycorrectfeedbackformat = $question->partiallycorrectfeedback['format'];

      within the file:

      /question/type/multichoice/questiontype.php

      And this allows us to create and import multiple choice questions in our Moodle 2.0.3 installation.

      The side effect is that the field titled "For any partially correct response" is ignored. For now we are patching our 2.0.3 installation with that line commented out and informing our faculty participants not to use that field when creating quiz questions.

      Show
      Our Moodle admin suspects that the identifier labeled "o_partiallycorrectfeedbackformat" is too long for Oracle. He commented out the following line: //$options->partiallycorrectfeedbackformat = $question->partiallycorrectfeedback ['format'] ; within the file: /question/type/multichoice/questiontype.php And this allows us to create and import multiple choice questions in our Moodle 2.0.3 installation. The side effect is that the field titled "For any partially correct response" is ignored. For now we are patching our 2.0.3 installation with that line commented out and informing our faculty participants not to use that field when creating quiz questions.
    • 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

      On our local install of Moodle 2.0.3, with Oracle 11 as the database server, creating a simple multiple choice question leads to a critical database/PHP error, leaving the question in a broken state. This same error occurs when trying to import questions from another course (e.g. from a 2.0.2 installation), or when trying to publish questions using Respondus.

      According to the stack trace, the error results from a dml_write_exception thrown from /lib/dml/moodle_database.php. In addition, the debug info seems to implicate an identifier as being too long – but it's not clear which identifier is causing the problem. See testing instructions below, stack trace is as follows:

      Debug info: ORA-00972: identifier is too long
      UPDATE m_question_multichoice SET question = :o_question,correctfeedback = :o_correctfeedback,partiallycorrectfeedback = :o_partiallycorrectfeedback,incorrectfeedback = :o_incorrectfeedback,answers = :o_answers,single = :o_single,answernumbering = :o_answernumbering,shuffleanswers = :o_shuffleanswers,correctfeedbackformat = :o_correctfeedbackformat,partiallycorrectfeedbackformat = :o_partiallycorrectfeedbackformat,incorrectfeedbackformat = :o_incorrectfeedbackformat WHERE id=:o_id
      [array (
      'o_question' => 729,
      'o_correctfeedback' => '',
      'o_partiallycorrectfeedback' => '',
      'o_incorrectfeedback' => '',
      'o_answers' => '2232,2233',
      'o_single' => '1',
      'o_answernumbering' => 'abc',
      'o_shuffleanswers' => '1',
      'o_correctfeedbackformat' => '1',
      'o_partiallycorrectfeedbackformat' => '1',
      'o_incorrectfeedbackformat' => '1',
      'o_id' => 508,
      )]
      Stack trace:
      line 394 of /lib/dml/moodle_database.php: dml_write_exception thrown
      line 268 of /lib/dml/oci_native_moodle_database.php: call to moodle_database->query_end()
      line 1285 of /lib/dml/oci_native_moodle_database.php: call to oci_native_moodle_database->query_end()
      line 1318 of /lib/dml/oci_native_moodle_database.php: call to oci_native_moodle_database->update_record_raw()
      line 134 of /question/type/multichoice/questiontype.php: call to oci_native_moodle_database->update_record()
      line 384 of /question/type/questiontype.php: call to question_multichoice_qtype->save_question_options()
      line 251 of /question/question.php: call to default_questiontype->save_question()

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

                People

                • Votes:
                  4 Vote for this issue
                  Watchers:
                  9 Start watching this issue

                  Dates

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