Begins a new transaction.
HRESULT StartTransaction (
ISOLEVEL isoLevel,
ULONG isoFlags,
ITransactionOptions * pOtherOptions,
ULONG * pulTransactionLevel);
Parameters
isoLevel
[in]
The isolation level to be used with this transaction. For more information, see "Isolation Levels" in Chapter 12.
Value | Description |
ISOLATIONLEVEL_ UNSPECIFIED |
Applicable only to ITransactionJoin::JoinTransaction. Invalid for ITransactionLocal or for setting isolation level while in autocommit mode. |
ISOLATIONLEVEL_ CHAOS |
Cannot overwrite the dirty data of other transactions at higher isolation levels. |
ISOLATIONLEVEL_ READUNCOMMITTED |
Read Uncommitted. |
ISOLATIONLEVEL_ BROWSE |
Synonym for ISOLATIONLEVEL_READUNCOMMITTED. |
ISOLATIONLEVEL_ READCOMMITTED |
Read Committed. |
ISOLATIONLEVEL_ CURSORSTABILITY |
Synonym for ISOLATIONLEVEL_READCOMMITTED. |
ISOLATIONLEVEL_ REPEATABLEREAD |
Repeatable Read. |
ISOLATIONLEVEL_ SERIALIZABLE |
Serializable. |
ISOLATIONLEVEL_ ISOLATED |
Synonym for ISOLATIONLEVEL_SERIALIZABLE. |
isoFlags
[in]
Must be zero.
pOtherOptions
[in]
Optionally a null pointer. If this is not a null pointer, it is a pointer to an object previously returned from GetOptionsObject called on this session instance.
pulTransactionLevel
[out]
A pointer to memory in which to return the level of the new transaction. The value of the top-level transaction is 1. If pulTransactionLevel is a null pointer, the level is not returned.
Return Code
S_OK
The method succeeded.
DB_E_OBJECTOPEN
A rowset object was open and the provider does not support starting a new transaction with existing open rowset objects.
E_FAIL
A provider-specific error occurred.
E_UNEXPECTED
An unknown error occurred and the method failed.
XACT_E_CONNECTION_DENIED
This session could not create a new transaction at the present time due to unspecified capacity issues.
XACT_E_CONNECTION_DOWN
This session is having communication difficulties with its internal implementation.
XACT_E_ISOLATIONLEVEL
Neither the requested isolation level nor a strengthening of it can be supported by this transaction implementation or isoLevel was not valid.
XACT_E_LOGFULL
A transaction could not be created because this session uses logging to a device that lacks available space.
XACT_E_NOISORETAIN
The requested semantics of retention of isolation across retaining commit and abort boundaries cannot be supported by this transaction implementation or isoFlags was not equal to zero.
XACT_E_NOTIMEOUT
A noninfinite time-out value was requested, but time-outs are not supported by this transaction.
XACT_E_XTIONEXISTS
This session can handle only one extant transaction at a time, and there is presently such a transaction.
The session supports a limited number of nested transactions, and that limit has been reached.
Comments
ITransactionLocal starts a new local transaction. If there is already an active transaction on the session (that is, StartTransaction has been called with no matching Commit or Abort), then the new transaction is started as a nested transaction below the current transaction. Calling Commit or Abort always commits or aborts the transaction at the lowest level, respectively. If the provider does not support nested transactions, calling StartTransaction when there is already an active transaction on the session returns XACT_E_XTIONEXISTS.
See Also