qdb_interrupt()

Interrupt a long-running query

Synopsis:

#include <qdb/qdb.h>

int qdb_interrupt(qdb_hdl_t *db);

Arguments:

db
A pointer to the database handle.

Library:

qdb

Description:

This function interrupts all currently running queries that are using the specified connection handle, and rolls back any uncommitted transactions. If qdb_interrupt() is called on a connection where no query is executing, it doesn'thing.

If the connection to QDB is synchronous, this function must be called from a separate thread from the one that initiated the query. In asynchronous mode (see "Using asynchronous mode"), this function may be called from the same thread.

If a query is nearly finished at the time when qdb_interrupt() is called, then it might not have an opportunity to be interrupted and might continue to completion.

The qdb_interrupt() call is in effect until all currently running queries using the specified connection handle complete or are successfully interrupted. Any queries that are started after the qdb_interrupt() call and before the number of currently running queries reaches zero are interrupted as if they had been running prior to the qdb_interrupt() call. New queries that are started after the count of currently running queries reaches zero are not affected by qdb_interrupt().

CAUTION:
Care should be taken to ensure that the connection to QDB is not disconnected while this call is running, otherwise the database may be left in an inconsistent state.

Returns:

0
Success.
-1
An error occurred (errno is set).

Classification:

QNX Neutrino

Safety:  
Interrupt handler No
Signal handler No
Thread Yes