From: Bogdan D. <bog...@or...> - 2014-02-07 07:23:07
|
Hi, I found a problem with SQLCancel() function in iODBC. Normally SQLCancel() is called upon an active statement from a separate client app thread to break the execution of a long running statement. However, the current implementation (3.52.8) of SQLCancel() does not allow that. Here is the fragment from hstmt.c (lines 1135-1145): SQLRETURN SQL_API SQLCancel (SQLHSTMT hstmt) { ENTER_STMT (hstmt, trace_SQLCancel (TRACE_ENTER, hstmt)); retcode = SQLCancel_Internal (hstmt); LEAVE_STMT (hstmt, trace_SQLCancel (TRACE_LEAVE, hstmt)); } The ENTER_STMT macro checks for stmt_cip (if the call is in progress for this handle) and returns the error [S1010] "Function sequence error". For instance, MySQL ODBC driver does not use the same particular hstmt. It only gets the connection ID and opens a new connection (SQLHDBC) and a new statement (SQLHSTMT) handles to kill the running query. There are a few ways to deal with the problem, but I think that the easiest one would be introducing another macro like ENTER_STMT_ASYNC, which would take into account the asynchronous nature of SQLCancel() calls. Please let me know if you have any questions. Thanks. -- Best Regards, Bogdan Degtyariov Senior Developer MySQL/Sun/Oracle Melbourne, Australia |