Nested Transactions

A nested transaction occurs when a database-transaction object (the parent transaction) sets up a transaction. Changes made within the inner transaction are completely invisible to the outer transaction until the inner transaction is committed. Even then, the changes are not visible outside the outer transaction until that transaction is committed. The inner transaction object must be released before the parent can be released.

Providers that expose ITransactionLocal may support a limited number of nested transactions, including zero. For providers that support nested transactions, calling ITransactionLocal::StartTransaction with an existing transaction begins a new transaction nested below the current transaction. StartTransaction returns the level of the new transaction, starting with *pulTransactionLevel = 1 for the root transaction. Calling ITransactionLocal::Commit or ITransactionLocal::Abort commits or aborts the transaction at the current (lowest) level. If the fRetaining flag is set to TRUE, a new unit of work for the nested transaction is begun; if the fRetaining flag is set to FALSE, no new nested transaction is begun and additional work is done within the scope of the parent transaction.