Details
-
Bug
-
Resolution: Won't Do
-
P4: Low
-
None
-
4.6.1, 4.6.2, 4.7.0
-
None
-
Windows XP
Informix 10
Informix ODBC Driver 2.90.0000
Description
When inserting strings longer than 254 characters into a varchar column using prepared statements, the ODBC driver reports the following error:
"Illegal attempt to use Text/Byte host variable".
Looking into the source code of qsql_odbc.cpp (Qt Branch 4.7, 27. 05. 2010), I find that the ODBC plugin reports SQL_LONGVARCHAR for strings longer than 254 characters, and SQL_VARCHAR otherwise ( or SQL_WLONGVARCHAR resp. SQL_WVARCHAR for unicode strings). This is a problem because the Informix ODBC driver maps SQL_LONGVARCHAR to type TEXT (see http://publib.boulder.ibm.com/infocenter/idshelp/v10/index.jsp?topic=/com.ibm.odbc.doc/odbc69.htm), which causes the mentioned error message.
In our application we would like to write varchar columns with 255 characters. AFAIK, the maximum allowed length of the SQL varchar datatype depends on the underlying DBMS. Most DBMSes allow for at least 2000 characters. Some old versions of MySql did have a limit of 255 characters (see http://dev.mysql.com/doc/refman/5.0/en/string-type-overview.html, section "VARCHAR"). Therefore, I would propose to set the limit to 255 instead of 254, or, if it makes sense, to make it configurable in the ODBC plugin.
Attachments
Issue Links
- relates to
-
QTBUG-91778 String length calculation in SQLBindParameter appears incorrect
- Reported