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

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

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 2.0.9, 2.1.6, 2.2.3, 2.3
    • 2.1.7, 2.2.4
    • Database SQL/XMLDB
    • None
    • MOODLE_20_STABLE, MOODLE_21_STABLE, MOODLE_22_STABLE, MOODLE_23_STABLE
    • MOODLE_21_STABLE, MOODLE_22_STABLE
    • 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

    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

              stronk7 Eloy Lafuente (stronk7)
              stronk7 Eloy Lafuente (stronk7)
              Dan Poltawski Dan Poltawski
              Dan Poltawski Dan Poltawski
              David Woloszyn, Huong Nguyen, Jake Dallimore, Meirza, Michael Hawkins, Raquel Ortega, Safat Shahin, Stevani Andolo
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                9/Jul/12