Details
-
Bug
-
Resolution: Done
-
P4: Low
-
5.9.1
-
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)