Skip to main content

%Library.Transaction

%Library.Transaction is a system class that allows an application to include local database activity with remote activity into a single transaction. Creating an instance of this performs a TSTART. If the transaction object is destroyed before committing, it is automatically rolled back. A transaction object can be used multiple times. A new transaction can be initiated simply by calling Start(). Start() will not start a new transaction if one is already active. The Transaction maintains a list of top-level objects that are part of the transaction set. It is the developer's job to add objects to this set. Calling Commit() on the transaction does the following: - We call %Save() on each object in the transaction set - If all Saves succeed, then we will call an additional Commit method for each connection object. TODO: We should try to make use of XA (2 phase) logic either automatically or via a setting in the transaction object. The tricky part here is that it should be possible to control an XA transaction among N data sources even if ONE of the sources does not support XA!

Property Inventory

Method Inventory

Properties

property debug as %Boolean [ InitialExpression = 0 ];
Property methods: debugDisplayToLogical(), debugGet(), debugIsValid(), debugLogicalToDisplay(), debugNormalize(), debugSet()

Methods

method Commit() as %Status
Commit the current transaction. If the transaction is not active then an error is returned and no work is done. If the transaction encounters an error during commit then it is rolled back and the error returned.
method IncludeObject(pObject As %RegisteredObject) as %Status
Include the pObject in the current transaction set.
method RemoveAllObjects() as %Status
Remove the pObject from the current transaction set.
method RemoveObject(pObject As %RegisteredObject) as %Status
Remove the pObject from the current transaction set.
method Rollback() as %Status
Roll back the current transaction if the transaction is active. If the transaction is not active or if an error occurs during rollback then an error is returned.
method Start() as %Integer
Start a new transaction if one is not already active.

Inherited Members

Inherited Methods

FeedbackOpens in a new tab