Starting a Named Transaction

From InterBase
Jump to: navigation, search

Go Up to Working with Transactions

A single application can start simultaneous transactions. InterBase extends transaction management and data manipulation statements to support transaction names, unique identifiers that specify which transaction controls a given statement among those transactions that are active.

Transaction names must be used to distinguish one transaction from another in programs that use two or more transactions at a time. Each transaction started while other transactions are active requires a unique name and its own SET TRANSACTION statement. SET TRANSACTION can include optional parameters that modify a behavior of a transaction.

There are four steps for using transaction names in a program:

1. Declare a unique host-language variable for each transaction name. In C and C++, transaction names should be declared as long pointers.
2. Initialize each transaction name to zero.
3. Use SET TRANSACTION to start each transaction using an available transaction name.
4. Include the transaction name in subsequent transaction management and data manipulation statements that should be controlled by a specified transaction.
Important: Using named transactions in dynamic SQL statements is somewhat different. For information about named transactions in DSQL, see Working with Multiple Transactions in DSQL.

For additional information about creating multiple transaction programs, see Working with Multiple Transactions.


Advance To: