Declaring Transaction Handles

From InterBase
Jump to: navigation, search

To establish transaction handles for use, declare a variable of type isc_tr_handle for each simultaneously active transaction. The following code declares two handles:

#include <ibase.h>
. . .
isc_tr_handle tr1;
isc_tr_handle tr2;

Once a transaction is committed or rolled back, its handle can be assigned to a different transaction in a subsequent call to isc_start_transaction(). If an application uses several transactions, but only starts a subset of transactions at the same time, it is only necessary to declare as many handles as there will be simultaneously active transactions. For example, if an application starts a total of three transactions, but only runs two of them at the same time, only two transaction handles need be declared.