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

SUBSTR function in accesslib.php fails on MS SQL

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Critical Critical
    • 1.9.3
    • 1.9.1, 1.9.2
    • Course
    • None
    • Microsoft SQL
    • Microsoft SQL
    • MOODLE_19_STABLE
    • MOODLE_19_STABLE

      lib/accesslib.php makes a call to SQL function SUBSTR in the statement:
      $sql = "UPDATE {$CFG->prefix}context
      SET path = ".sql_concat("'$newpath'", 'SUBSTR(path, '.$len.' +1)')."
      $setdepth
      WHERE path LIKE '{$frompath}/%'";
      execute_sql($sql,false);

      but SUBSTR is not legitimate in MSSQL, SUBSTRING must be used, which is fine with MySQL except there may be a difference in the length parameter.

      Problem discussed at:
      http://moodle.org/mod/forum/discuss.php?d=106337

            stronk7 Eloy Lafuente (stronk7)
            jwhite10 John White (Inactive)
            Petr Skoda Petr Skoda
            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.