Naming Transactions

From InterBase

Go Up to Starting a Named Transaction


A transaction name is a programmer-supplied variable that distinguishes one transaction from another in SQL statements. If transaction names are not used in SQL statements that control transactions and manipulate data, then those statements operate only on the default transaction, GDS__TRANS.

The following C code declares and initializes two transaction names using the isc_tr_handle data type. It then starts those transactions in SET TRANSACTION statements.

. . .
EXEC SQL
BEGIN DECLARE SECTION;
isc_tr_handle t1, t2; /* declare transaction names */
EXEC SQL
END DECLARE SECTION;
. . .
t1 = t2 = (isc_tr_handle) NULL; /* initialize names to zero */
. . .
EXEC SQL
SET TRANSACTION NAME t1; /* start trans. w. default behavior */
EXEC SQL
SET TRANSACTION NAME t2; /* start trans2. w. default behavior */
. . .

Each of these steps is fully described in the following sections.

A transaction name can be included as an optional parameter in any data manipulation and transaction management statement. In multi-transaction ­programs, omitting a transaction name causes a statement to be executed for the default transaction, GDS__TRANS.

For more information about using transaction names with data manipulation statements, see Working with Data.

Topics

Advance To: