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

ODBC: qGetStringData calculates wrong length in non-unicode mode when SQL_SUCCESS_WITH_INFO is returned

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P4: Low
    • 5.12.0 Beta 1
    • 5.9.1
    • SQL Support
    • None
    • a3e8b92d971aef58174aefaa60741d16af8271ae

    Description

      When SQLGetData returns SQL_SUCCESS_WITH_INFO, the colSize includes a terminating \0 byte (see documentation at https://docs.microsoft.com/en-us/sql/odbc/reference/syntax/sqlgetdata-function#retrieving-variable-length-data-in-parts ). This is handled correctly within fromSQLTCHAR() function (although the comment in qsql_odbc.cpp:394 is very misleading, should be moved to fromSQLTCHAR / line 74) but not in the case when unicode is false (qsql_odbc.cpp:436). This leads to a wrong string returned when the driver does not support unicode and SQLGetData returns SQL_SUCCESS_WITH_INFO.

      This happens only with a very old informix odbc driver which somehow doesn't return a valid length when the string contains non-ascii chars ...

      This bug was introduced 2010 with c55a99965d8c08d5f924d49db4fe4aa49df80961 (qt4 repo)

       

      Attachments

        1. qtbug62406.diff
          0.9 kB
        2. with_patch_2.png
          with_patch_2.png
          0.5 kB
        3. without_patch_2.png
          without_patch_2.png
          0.5 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            andysh Andy Shaw
            chehrlic Christian Ehrlicher
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes