ODBC call SQLCancel is blocking if called for synchronous statements

Details

Detail name Value
Changelog Number 6946
Type Bug
Status Resolved
Affected Versions EXASOL 6.0.0
Fix Versions Exasol 6.0.13
Resolution Date 2018-11-13

Background

In ODBC, statements can be executed in synchronous (API call blocks until the server is done processing) or asynchronous mode (API call returns immediately, application polls for results). ODBC 2.0 application can call SQLCancel on synchronous statement handles to close the cursor (see docs.microsoft.com).

Problem

Exasol's implementation of SQLCancel does not return when called for a statement being processed in synchronous mode.

Fix

If SQLCancel is called while a statement is running (in asynchronous mode or from another thread), the statement will be canceled and the return code for this can be checked in the thread executing the statement.
In case no statement is running: If the application tells the driver that it needs ODBC 2.0 behavior, we map the SQLCancel call to a call of SQLFreeStmt (SQL_CLOSE) what closes the cursor. For applications that do not need ODBC 2.0 behavior, SQLCancel returns without doing anything.