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

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

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • 2.1.7, 2.2.4
    • 2.0.9, 2.1.6, 2.2.3, 2.3
    • 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

      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

            stronk7 Eloy Lafuente (stronk7)
            stronk7 Eloy Lafuente (stronk7)
            Dan Poltawski Dan Poltawski
            Dan Poltawski Dan Poltawski
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.