Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-24100

qsql_odbc.cpp and NULL pointer in the method qGetStringData () the first call to SQLGetData ()

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Incomplete
    • Icon: P2: Important P2: Important
    • None
    • 4.3.0, 4.3.1, 4.3.2, 4.3.3, 4.3.4, 4.3.5, 4.4.0, 4.4.1, 4.4.2, 4.4.3, 4.5.0, 4.5.1, 4.5.2, 4.5.3, 4.6.0, 4.6.1, 4.6.2, 4.6.3, 4.7.0, 4.7.1, 4.7.2, 4.7.3, 4.7.4
    • SQL Support
    • Tested on Fedora 16, Ubuntu 10.10, 11.04, 11.10 afflicts both versions 32bit 64bit ones.

      Since many Linux distributions rose iODBC to unixODBC (starting from QT Approximately 4.3.0), the QODBC plugin has stopped working properly with some drivers like to access databases on IBM iSeries.
      The problem is the reading of the fields that contain text strings.

      The error returned is:
      gfat-bin: gconv.c: 75: __ gconv: Assertion "outbuf! = ((void *) 0) && * outbuf! = ((void *) 0) 'failed.

      I have already reported the bug, but I did not know what component concern.

      Not getting answers, I began to search for the BUG analyzing the sources of QT 4.7.4.

      Finally I discovered that an error is generated at line 374 of file qsql_odbc.cpp.

      The following method call:

      r = SQLGetData(hStmt,
      column+1,
      SQL_C_TCHAR,
      NULL,
      0,
      &lengthIndicator);

      generates the BUG.
      Will not accept a NULL pointer.

      In attacched file i found a more elegant solution.

      I added a static function to control max lenght of UTF-8 and UTF-16 chars, so buffer can be preallocated correctly.

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            mondinmr Mondin Marco
            mondinmr Mondin Marco
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes