Skip to content

SQLCancel

SQLCancel#

This function cancels the statement under proc

Syntax#

SQLRETURN  SQLCancel (
    SQLHSTMT    stmt);

Arguments#

Data Type Argument In/Output Description
SQLHSTMT stmt Input Statement handle

Return Values#

SQL_SUCCESS
SQL_SUCCESS_WITH_INFO
SQL_ERROR 
SQL_INVALID_HANDLE

Description#

SQLCancel can cancel the following statements under process:

  • Statements that need data
  • Statements under process on another thread

If the statement associated with the specified statement handle is not under process or has already completed processing, SQLCancel is ignored. If the statement which was to be canceled has already completed processing, the result of the statement is reflected in the database. If a query returns a result set, this result set can be retrieved.

Canceling Statements that Need Data#

The process of a statement can be canceled by calling SQLExecute, SQLExecDirect, SQLBulkOperations or SQLSetPos with the DATA_AT_EXEC option and then calling SQLCancel before all of the data has been sent to the server. After a statement has been canceled, functions such as SQLExecute or SQLExecDirect can be called again.

The cursor state or the current cursor position is not affected by canceling SQLBulkOperations or SQLSetPos.

Canceling Functions Under Process on Another Thread#

SQLCancel can be called to cancel a function under process on another thread in a multithread application. Using the same statement handle as the one used in the function to be canceled, the user should make a call to SQLCancel on another thread.

SA function which is canceled with SQLCancel immediately returns SQL_ERROR. Whether the given function failed to process the statement or was canceled by the user can be checked by referring to the diagnosis.

Diagnosis#

SQLSTATE Description Comments
HY000 General Error
HY001 Memory allocation error Memory required for Altibase CLI driver to process and complete the function cannot be allocated.
08S01 Communication channel error (data transmission failure) Communication channel error occurred before function process between Altibase CLI driver and DB completed.
08003 stmt was released or connection was not in a connected state.
HY010 Function sequence error Given Stmt cannot process the function. Asynchronous operations are unsupported
HY008 Operation Cancel
SQLBindParameter
SQLBulkOperations
SQLExecDirect
SQLExecute
SQLFreeStmt
SQLGetDiagField
SQLGetDiagRec
SQLParamData
SQLPutData
SQLSetPos