Details
-
Bug
-
Status: Closed (View Workflow)
-
Critical
-
Resolution: Fixed
-
3.2.2
-
None
Description
In case of text protocol(i.e. SQLExecDirect by default and optionally in SQLPrepare+SQLExecute case) if we have query with cached/finished fetching last result, and another query with multiple results has been executed, the SQLMoreResults on first statement handle will pick those pending results from 2nd query.
There is a subcase of this case that maybe even worse - the same will happen if instead of calling SQLMoreResults on first statement, close its cursor(SQLFreeStmt(SQL_CLOSE). That operation read all pending results of the closed statement if there are such. In this case it will skip results of the 2nd statement.
To repeat:
OK_SIMPLE_STMT(Stmt, "SELECT 100"); |
/*Fetching result for the case of streaming*/ |
CHECK_STMT_RC(Stmt, SQLFetch(Stmt));
|
EXPECT_STMT(Stmt, SQLFetch(Stmt), SQL_NO_DATA);
|
|
OK_SIMPLE_STMT(Stmt1, "SELECT 3;SELECT 2 UNION SELECT 4"); |
|
CHECK_STMT_RC(Stmt1, SQLFetch(Stmt1));
|
EXPECT_STMT(Stmt1, SQLFetch(Stmt1), SQL_NO_DATA);
|
EXPECT_STMT(Stmt, SQLMoreResults(Stmt), SQL_NO_DATA); // <-- This will fail |
CHECK_STMT_RC(Stmt1, SQLMoreResults(Stmt1));
|