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

adodb-mssql_n converts empty string to NULL

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.9
    • 1.8.4, 1.9, 2.0
    • Database SQL/XMLDB
    • None
    • Microsoft SQL
    • MOODLE_19_STABLE
    • MOODLE_18_STABLE, MOODLE_19_STABLE, MOODLE_20_STABLE

    Description

      I don't know if this is specific to the mssql_n driver, but I can reproduce it with the following:

      $enroldb = ADONewConnection($CFG->dbtype);
      $enroldb->Connect($CFG->dbhost, $CFG->dbuser, $CFG->dbpass, $CFG->dbname, true);
      $enroldb->SetFetchMode(ADODB_FETCH_ASSOC);
      $enroldb->execute('set ansi_nulls on;
      set ansi_warnings on;
      set ansi_padding on;
      set concat_null_yields_null on;');
      // then examine the contents of
      $enroldb->execute('select * from mdl_config')->getArray();

      Fields that show up as being '' from tsql and MSSQL Server Management Express are NULL in the script.

      This causes a problem upgrading to 1.9 because the admin page keeps on thinking that their are new configuration settings.

      Attachments

        1. freetds_dblib.c.patch
          0.8 kB
        2. php_mssql.c.patch
          0.5 kB
        3. test.php
          0.8 kB

        Issue Links

          Activity

            People

              stronk7 Eloy Lafuente (stronk7)
              trick Alan Trick
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                11/Jan/08