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

SQL Error with Postgres 7.4.16 - Results in SCORM entry page not being show and no API adapter available to the SCO.

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Trivial
    • Resolution: Fixed
    • 1.7.1, 1.8
    • 1.8, 1.9
    • SCORM
    • None
    • PostgreSQL
    • MOODLE_17_STABLE, MOODLE_18_STABLE
    • MOODLE_18_STABLE, MOODLE_19_STABLE

    Description

      Symptoms:

      When launching a freshly added SCORM 2004 package it will go straight to the SCORM Player (showing the contents of the first SCO), it does not go to the SCORM Entry page where it lists the table of content and the options such as Browse, Review, Enter Course...

      The first time you run the SCORM package it appears to work pretty normally, but if you complete the SCORM and go back to Review it you will receive messages from the SCO that it cannot find the API Adapter (SCO Generated Messages), this is because it is not there.

      If you then go to Admin/Server/Debugging and set the level to developer you will receive the following messages.

      ERROR: zero-length delimited identifier at or near """" at character 57
      SELECT * FROM mdl_scorm_scoes WHERE scorm=1 AND launch""

      ERROR: invalid input syntax for type bigint: ""
      SELECT scorm FROM mdl_scorm_scoes WHERE id = ''

      ERROR: syntax error at or near "AND" at character 63
      SELECT * FROM mdl_scorm_scoes_track WHERE userid=2 AND scoid= AND attempt=1 ORDER BY element ASC

      The first message is the important one, the other errors are created as a result of the first error.

      The problem is that Postgres doesn't like the double quotes for (launch<>""), changing the double quote for escaped single quotes appears to solve the problem (launch<>\'\')

      I think this is also ok for MySQL but I haven't had chance to check.

      Below is a snippet from the modified locallib.php file which corrects the problem.

      file: moodle/mod/scorm/locallib.php
      function scorm_simple_play($scorm,$user) {
      $result = false;
      $scoes = get_records_select('scorm_scoes','scorm='.$scorm->id.' AND launch<>\'\'');
      if (count($scoes) == 1) {
      if ($scorm->skipview >= 1) {
      $sco = current($scoes);
      if (scorm_get_tracks($sco->id,$user->id) === false)

      { header('Location: player.php?a='.$scorm->id.'&scoid='.$sco->id); $result = true; }

      else if ($scorm->skipview == 2)

      { header('Location: player.php?a='.$scorm->id.'&scoid='.$sco->id); $result = true; }

      }
      }
      return $result;
      }

      This appears to still be a problem in 1.8 in the stable branch at least, but I haven't checked this in detail.

      One the database error was resolved with the code change mentioned the SCORM packages then behaved correctly, the user would be presented with the SCORM Entry page where they could chose to Browse, Review, Enter the course.

      Attachments

        Activity

          People

            mpecero Maximino Pecero Sánchez
            paulmlewis Paul Lewis
            Dan Marsden, Matteo Scaramuccia, Ilya Tregubov, Kevin Percy, Mathew May, Mihail Geshoski, Shamim Rezaie
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              31/Mar/07