DB-Library programs cancel queries and discard results with dbcanquery and dbcancel.
In Client-Library, ct_cancel takes a type parameter that allows three different types of cancel operations.
The following table compares DB-Library and Client-Library cancel operations.
DB-Library Routines |
DB-Library Functionality |
Client-Library Routines |
Client-Library Functionality |
---|---|---|---|
dbcancel( dbproc) |
Cancel the current command batch and discard any results generated by the command batch. |
ct_cancel( connection, cmd, CS_CANCEL_ALL) or |
Cancel the current command and discard any results generated by the command. |
ct_cancel( connection, cmd, CS_CANCEL_ATTN) |
Cancel the current command and discard any results when the application next reads from the server (used inside callback functions). |
||
dbcanquery( dbproc) |
Discard any rows pending from the most recently executed query. While dbcancel cancels all commands on a given dbproc, dbcanquery cancel only the one being processed. |
ct_cancel( connection, cmd, CS_CANCEL_CURRENT) |
Discard the current result set. |
There is one important difference between the scope of dbcancel and ct_cancel:
dbcancel affects the current command batch on a single DBPROCESS.
ct_cancel (CS_CANCEL_ALL or CS_CANCEL_ATTN) can be invoked at the command or connection level. If it is used at the connection level, the cancel operation applies to all command structures within that connection.