env txn [-nosync] [-nowait] [-parent txnid] [-sync]
The env txn command begins a transaction. The returned transaction handle is bound to a Tcl command of the form env.txnX, where X is an integer starting at 0 (for example, env0.txn0 and env0.txn1). It is through this Tcl command that the script accesses the transaction methods.
The options are as follows:
-nosync
Do not synchronously flush the log when this transaction commits or prepares. This means the transaction will exhibit the ACI (atomicity, consistency, and isolation) properties, but not D (durability); that is, database integrity will be maintained, but it is possible that this transaction may be undone during recovery instead of being redone.
This behavior may be set for an entire Berkeley DB environment as part of the berkdb env call.
-nowait
If a lock is unavailable for any Berkeley DB operation performed in the context of this transaction, throw a Tcl error immediately instead of blocking on the lock.
-parent txnid
Create the new transaction as a nested transaction, with the specified transaction indicated as its parent. Transactions may be nested to any level.
-sync
Synchronously flush the log when this transaction commits or prepares. This means the transaction will exhibit all of the ACID (atomicity, consistency, isolation, and durability) properties.
This behavior is the default for Berkeley DB environments unless the -nosync option was specified to the berkdb env call.
The env txn command returns a transaction handle on success.
In the case of error, a Tcl error is thrown.