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

MSSQL driver (freetds) hiding errors on insert violating unique constraints

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.0.9, 2.1.6, 2.2.3, 2.3
    • Fix Version/s: 2.1.7, 2.2.4
    • Component/s: Database SQL/XMLDB
    • Labels:
      None
    • Testing Instructions:
      Hide

      NOTE: This needs to be tested in all branches!

      For 21_STABLE and 22_STABLE:

      • Run the "Functional DB tests" for all (FIVE) databases.
      • Verify that there isn't any failure in the "test_insert_record" case. Ignore others.

      For master:

      • Prepare your site to run phpunittests.
      • Run the dml tests for all (FIVE) databases:

        cd lib/dml
        phpunit dml_testcase tests/dml_test.php

      • Verify that there isn't any failure in the "test_insert_record" case. Ignore others.

      Note: This has been tested already for:

      • mysql
      • postgresql
      • oracle
      • mssql (using freetds 0.82)

      It would be great to have it tested under:

      • mssql (using freetds 0.91)
      • sqlsrv

      Ciao

      Show
      NOTE: This needs to be tested in all branches! For 21_STABLE and 22_STABLE: Run the "Functional DB tests" for all (FIVE) databases. Verify that there isn't any failure in the "test_insert_record" case. Ignore others. For master: Prepare your site to run phpunittests. Run the dml tests for all (FIVE) databases: cd lib/dml phpunit dml_testcase tests/dml_test.php Verify that there isn't any failure in the "test_insert_record" case. Ignore others. Note: This has been tested already for: mysql postgresql oracle mssql (using freetds 0.82) It would be great to have it tested under: mssql (using freetds 0.91) sqlsrv Ciao
    • Affected Branches:
      MOODLE_20_STABLE, MOODLE_21_STABLE, MOODLE_22_STABLE, MOODLE_23_STABLE
    • Fixed Branches:
      MOODLE_21_STABLE, MOODLE_22_STABLE
    • Pull from Repository:
    • Pull Master Branch:

      Description

      Testing MDL-33326 some problems were detected under MSSQL.

      After investigating possible causes (SQL*Server versions, FreeTDS libraries...) debugging revealed that the problem was caused by one combination of the behavior of mssql_query() when running batches and the insertion of records returning ids.

      So this issue is about:

      • Change the current batch used for inserting records returning ids (SCOPE_IDENTITY), to newer and recommended OUTPUT clause and specialized handling of returned values.
      • Cover the 2 insertion cases (with and without returning ids).
      • Verify tests pass under the 5 drivers.

      Ciao

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                stronk7 Eloy Lafuente (stronk7)
                Reporter:
                stronk7 Eloy Lafuente (stronk7)
                Integrator:
                Dan Poltawski
                Tester:
                Dan Poltawski
                Participants:
                Component watchers:
                Jake Dallimore, Jun Pataleta, Ryan Wyllie
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  9/Jul/12