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

sql error when opening a scorm package

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.2.5, 2.3.1, 2.4
    • Fix Version/s: 2.2.6, 2.3.3
    • Component/s: SCORM
    • Labels:
    • Database:
      Microsoft SQL
    • Testing Instructions:
      Hide

      With an MS SQL db
      add a SCORM to your course.
      log in as a student - enter the SCORM package and make sure no errors are displayed. The above error appears on the view.php page before actually entering the scorm package by hitting the "enter" button (but it may also appear in other places before the patch)

      Show
      With an MS SQL db add a SCORM to your course. log in as a student - enter the SCORM package and make sure no errors are displayed. The above error appears on the view.php page before actually entering the scorm package by hitting the "enter" button (but it may also appear in other places before the patch)
    • Affected Branches:
      MOODLE_22_STABLE, MOODLE_23_STABLE, MOODLE_24_STABLE
    • Fixed Branches:
      MOODLE_22_STABLE, MOODLE_23_STABLE
    • Pull Master Branch:
      master_MDL-35123

      Description

      Opening a SCORM package results in the following exception (I use MS SQL as a MoodleDB and SQLSRV30 driver):

      error/invalidsqlsrvnativetype

      More information about this error

      Debug info:
      Error code: invalidsqlsrvnativetype
      $a contents: nchar
      Stack trace:
      line 663 of \lib\dml\sqlsrv_native_moodle_database.php: dml_exception thrown
      line 529 of \lib\dml\sqlsrv_native_moodle_database.php: call to sqlsrv_native_moodle_database->sqlsrvtype2moodletype()
      line 516 of \lib\dml\moodle_database.php: call to sqlsrv_native_moodle_database->get_columns()
      line 1296 of \lib\dml\moodle_database.php: call to moodle_database->where_clause()
      line 653 of \mod\scorm\locallib.php: call to moodle_database->get_record()
      line 597 of \mod\scorm\locallib.php: call to scorm_get_last_attempt()
      line 1103 of \mod\scorm\locallib.php: call to scorm_grade_user()
      line 115 of \mod\scorm\view.php: call to scorm_get_attempt_status()

        Gliffy Diagrams

          Activity

          Hide
          danmarsden Dan Marsden added a comment -

          thanks for the report - that function looks pretty nasty - I've tidied it up in the above patch but I need to check all existing usages of the function to make sure that it still works as expected. - will try to look closer next week.

          Show
          danmarsden Dan Marsden added a comment - thanks for the report - that function looks pretty nasty - I've tidied it up in the above patch but I need to check all existing usages of the function to make sure that it still works as expected. - will try to look closer next week.
          Hide
          danmarsden Dan Marsden added a comment -

          bouncing up for peer review - get_last_attempt shouldn't be returning false - it should be 1 for the "first" attempt when no attempts exist. - have checked all uses of get_last_attempt to make sure.

          Show
          danmarsden Dan Marsden added a comment - bouncing up for peer review - get_last_attempt shouldn't be returning false - it should be 1 for the "first" attempt when no attempts exist. - have checked all uses of get_last_attempt to make sure.
          Hide
          ankit_frenz Ankit Agarwal added a comment -

          Hi Dan,
          It might be a good idea to update scorm_get_last_completed_attempt() as well?

          Rest changes look good.
          Thanks

          Show
          ankit_frenz Ankit Agarwal added a comment - Hi Dan, It might be a good idea to update scorm_get_last_completed_attempt() as well? Rest changes look good. Thanks
          Hide
          danmarsden Dan Marsden added a comment -

          doh - good spotting! - slightly reformatted patch including fix for last_completed_attempt as well - thanks Ankit.

          Show
          danmarsden Dan Marsden added a comment - doh - good spotting! - slightly reformatted patch including fix for last_completed_attempt as well - thanks Ankit.
          Hide
          ankit_frenz Ankit Agarwal added a comment -

          Looks good.
          Feel free to submit for integration.
          Thanks

          Show
          ankit_frenz Ankit Agarwal added a comment - Looks good. Feel free to submit for integration. Thanks
          Hide
          stronk7 Eloy Lafuente (stronk7) added a comment -

          The main moodle.git repository has just been updated with latest weekly modifications. You may wish to rebase your PULL branches to simplify history and avoid any possible merge conflicts. This would also make integrator's life easier next week.

          TIA and ciao

          Show
          stronk7 Eloy Lafuente (stronk7) added a comment - The main moodle.git repository has just been updated with latest weekly modifications. You may wish to rebase your PULL branches to simplify history and avoid any possible merge conflicts. This would also make integrator's life easier next week. TIA and ciao
          Hide
          stronk7 Eloy Lafuente (stronk7) added a comment -

          Integrated (22, 23 & master), thanks!

          Show
          stronk7 Eloy Lafuente (stronk7) added a comment - Integrated (22, 23 & master), thanks!
          Hide
          rwijaya Rossiani Wijaya added a comment -

          This looks great.

          Test passed.

          Show
          rwijaya Rossiani Wijaya added a comment - This looks great. Test passed.
          Hide
          stronk7 Eloy Lafuente (stronk7) added a comment -

          Gutta cavat lapidem, non vi sed saepe cadendo - Ovidio

          This issue has been integrated upstream and is now available both via git and cvs (and in some hours, via mirrors and downloads).

          Thanks!

          Show
          stronk7 Eloy Lafuente (stronk7) added a comment - Gutta cavat lapidem, non vi sed saepe cadendo - Ovidio This issue has been integrated upstream and is now available both via git and cvs (and in some hours, via mirrors and downloads). Thanks!

            People

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

              Dates

              • Created:
                Updated:
                Resolved:
                Fix Release Date:
                12/Nov/12