Marks the successful completion of a transaction.
marks the successful end of a transaction initiated by the corresponding TSTART
decrements the value of the $TLEVEL
special variable. InterSystems IRIS terminates the transaction only if $TLEVEL
goes to 0. Usually this is when TCOMMIT
has been called as many times as TSTART
. Changes made during nested transactions are not committed until $TLEVEL
An optional postconditional expression. InterSystems IRIS executes the command if the postconditional expression is true (evaluates to a nonzero numeric value). InterSystems IRIS does not execute the command if the postconditional expression is false (evaluates to zero). For further details, refer to Command Postconditional Expressions
in Using ObjectScript
Nested TSTART / TCOMMIT
InterSystems IRIS supports the nesting of the TSTART
commands, so that modules can issue their TSTART
pairs correctly, independent of any other TSTART
issued in the modules that called them or in the modules they call. The current nesting level of the transaction is tracked by the special variable $TLEVEL
. The transaction is committed when the outermost matching TCOMMIT
is issued; that is, when $TLEVEL
goes back to 0.
You can roll back individual nested transactions by calling TROLLBACK 1
or roll back all current transactions by calling TROLLBACK
rolls back the whole transaction that is in effect no matter how many levels of TSTART
were issued and sets $TLEVEL
command requests a flush of the journal data involved in that transaction to disk. Whether to wait for this disk write operation to complete is a configurable option.
SQL and Transactions
ObjectScript and SQL transaction commands are fully compatible and interchangeable, with the following exception:
and SQL START TRANSACTION
both start a transaction if no transaction is current. However, START TRANSACTION
does not support nested transactions. Therefore, if you need (or may need) nested transactions, it is preferable to start the transaction with TSTART
. If you need compatibility with the SQL standard, use START TRANSACTION
ObjectScript transaction processing provides limited support for nested transactions. SQL transaction processing supplies support for savepoints within transactions.
Content Date/Time: 2019-04-10 14:45:56