Uploaded image for project: 'MariaDB Connector/ODBC'
  1. MariaDB Connector/ODBC
  2. ODBC-433

SQLMoreResults may pick other statements results

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Critical
    • Resolution: Fixed
    • 3.2.2
    • 3.2.3
    • General
    • 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));
      

      Attachments

        Activity

          People

            Lawrin Lawrin Novitsky
            Lawrin Lawrin Novitsky
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.