Local Transactions

Local transactions refer to transactions running in the context of a resource manager. A provider that supports transactions exposes ITransactionLocal on the session. A call to the ITransactionLocal::StartTransaction method begins a transaction on the session. A session can be inside or outside of a transaction at any time. When created, a session is outside of a transaction and all the work done under the scope of the session is immediately committed on each OLE DB method call. When a session enters a local or coordinated transaction, all the work done under the session — between the StartTransaction and ITransaction::Commit or ITransaction::Abort method calls, including other objects created underneath it (commands or rowsets) — are part of the transaction.

StartTransaction supports various isolation levels that consumers can request when creating a transaction. OLE DB providers do not need to support all possible transaction options defined. A consumer can interrogate the transaction capabilities of a provider through IDBProperties.

For providers that support nested transactions, calling StartTransaction within an existing transaction begins a new nested transaction below the current transaction. Calling the Commit or Abort method commits or aborts, respectively, the transaction at the lowest level.