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

MS SQL DB driver casting string to int breaks a query that should work, which breaks qtype_multichoice upgrade

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Blocker
    • Resolution: Fixed
    • Affects Version/s: 2.0
    • Fix Version/s: 2.0
    • Labels:
      None
    • Environment:
      Windows Server Server 2008, SQL 2005, FreeTDS, IIS 7
    • Database:
      MySQL
    • Affected Branches:
      MOODLE_20_STABLE
    • Fixed Branches:
      MOODLE_20_STABLE

      Description

      Upgrade from 1.9.10 to 2.0 RC1. Upgrade process gets stuck on upgrading qtype_multichoice

      Debug info: Conversion failed when converting the varchar value '<div class="text_to_html">1</d' to data type int.
      UPDATE mdl_question SET name = ? WHERE qtype = 'random' AND category = ? AND CONVERT(varchar, questiontext, 32) = ?
      [array (
      0 => 'Random (Default for 4th Form Biology Resources)',
      1 => '27',
      2 => '0',
      )]
      Stack trace:
      line 394 of \lib\dml\moodle_database.php: dml_write_exception thrown
      line 247 of \lib\dml\mssql_native_moodle_database.php: call to moodle_database->query_end()
      line 1016 of \lib\dml\mssql_native_moodle_database.php: call to mssql_native_moodle_database->query_end()
      line 46 of \question\type\multichoice\db\upgrade.php: call to mssql_native_moodle_database->set_field_select()
      line 358 of \lib\upgradelib.php: call to xmldb_qtype_multichoice_upgrade()
      line 1352 of \lib\upgradelib.php: call to upgrade_plugins()
      line 302 of \admin\index.php: call to upgrade_noncore()

      unable to fix at this time (bypassed to test)

      information:

      The varchar value '<div class="text_to_html">1</d' is the first 32 characters of the database field questiontext. I am unsure why the array being passed is trying to match the question text to '0'

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  24/Nov/10