Class Reference
IRIS for UNIX 2019.2
InterSystems: The power behind what matters   
Documentation  Search
  [%SYS] >  [%Library] >  [Transaction]
Private  Storage   

%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!


Parameters Properties Methods Queries Indices ForeignKeys Triggers
3 8



%AddToSaveSet %ClassIsLatestVersion %ClassName %ConstructClone
%DispatchClassMethod %DispatchGetModified %DispatchGetProperty %DispatchMethod
%DispatchSetModified %DispatchSetMultidimProperty %DispatchSetProperty %Extends
%GetParameter %IsA %IsModified %New
%NormalizeObject %ObjectModified %OriginalNamespace %PackageName
%RemoveFromSaveSet %SerializeObject %SetModified %ValidateObject
Commit IncludeObject RemoveAllObjects RemoveObject
Rollback Start


• property debug as %Boolean [ InitialExpression = 0 ];


• 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.

Copyright (c) 2019 by InterSystems Corporation. Cambridge, Massachusetts, U.S.A. All rights reserved. Confidential property of InterSystems Corporation.