Canceling results

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.

Table 5-14 compares DB-Library and Client-Library cancel operations.

Table 5-14: DB-Library vs. Client-Library—canceling results

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: