Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-26371 Review and fix some obvious SELECT DISTINCT + TEXT column
  3. MDL-18433

Calendar Restore Error (ntext incompatible with the equal to operator)

    XMLWordPrintable

    Details

    • Type: Sub-task
    • Status: Closed
    • Priority: Minor
    • Resolution: Duplicate
    • Affects Version/s: 1.9.4
    • Fix Version/s: None
    • Component/s: Backup, Calendar
    • Labels:
      None
    • Environment:
      Windows Server 2003
      MS SQL server
      IIS 6.0
      Moodle 1.9.4
    • Database:
      Microsoft SQL
    • Difficulty:
      Easy
    • Affected Branches:
      MOODLE_19_STABLE

      Description

      When we restore a course that has calendar events we get the following...

      The data types ntext and varchar are incompatible in the equal to operator.
      SELECT * FROM mdl_event WHERE courseid=32 AND name='Cert IV Civil Construction Design - Block1' AND description='' AND timestart=1242858600

      line 686 of lib\dmllib.php: call to debugging()
      line 481 of lib\dmllib.php: call to get_recordset_sql()
      line 531 of lib\dmllib.php: call to get_record_sql()
      line 3671 of backup\restorelib.php: call to get_record_select()
      line 8008 of backup\restorelib.php: call to restore_create_events()
      line 51 of backup\restore_execute.html: call to restore_execute()
      line 175 of backup\restore.php: call to include_once()

      The problem is line 3671 of backup\restorelib.php, the call to get_record_select(), the description field is ntext, and MSSQL doesn't like the equal to operator.

      If I change that line to use the LIKE operator it works ....

      "courseid={$eve->courseid} AND name='{$eve->name}' AND description like '{$eve->description}' AND timestart=$eve->timestart");

      But I know this is not the correct way to have this fixed...

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                stronk7 Eloy Lafuente (stronk7)
                Reporter:
                trevor.johnson Trevor Johnson
                Participants:
                Component watchers:
                Adrian Greeve, Mihail Geshoski, Peter Dias, Andrew Nicols, Mathew May, Michael Hawkins, Shamim Rezaie, Simey Lameze
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: