Details
-
Bug
-
Resolution: Done
-
P2: Important
-
5.2.1, 5.3.0
-
None
-
Windows 7
-
d153e4628e7643cf02b795f68f739c4bced15389
Description
Executing the following query on DB2:
select if (1 = 0 ) then 'a'; else 'b'; end if
generates an infinite loop generating the following message:
Warning qMakeFieldInfo: Unable to describe column 0 Error: [IBM][CLI Driver][DB2/LINUXX8664] SQL0104N An unexpected token "=" was found following "select if (1 ". Expected tokens may include: "CONCAT". SQLSTATE=42601
the index of the column is increasing constantly.
The problem seems to be that SQLSMALLINT count; is not initialized. After initializing it to zero the infinite loop and warning does not occur. Making the same query directly to db without Qt works fine.
qsql_db2.cpp in bool QDB2Result::exec()
.. SQLSMALLINT count; r = SQLNumResultCols(d->hStmt, &count;); if (count) { setSelect(true); for (int i = 0; i < count; ++i) { d->recInf.append(qMakeFieldInfo(d, i)); } } else { setSelect(false); }