Navigation: ABC Library Reference > TransactionManager > TransactionManager Methods >====== Start (start the transaction) ====== | |
Start( ),BYTE,VIRTUAL
Start | Begin the transaction process. |
Start is a virtual method used to begin the TransactionManager transaction process. Start makes sure that a transaction is not already running, clears the target RelationManager's internal UseLogout property, manages and issues a LOGOUT for all active tables contained in the target RelationManagers maintained by the TransactionManager.
If the initialization and LOGOUT statement are successful, Start returns a Level:Benign error level. If the Start method is for any reason unsuccessful, a Level:Fatal error level is returned.
Return Value: BYTE
Implementation:
In a form (update) procedure, the Start method is called just prior to the Window Manager's TakeCompleted method. In a process procedure that implements the TransactionManager, the Start method can be called for each individual method processed, or can be called for a specified number of records processed.
Example:
!In a Form procedure
IF SELF.Request<;>ViewRecord
ReturnValue = Transaction.Start()
IF ReturnValue<;>Level:Benign THEN RETURN ReturnValue.
END
ReturnValue = PARENT.TakeCompleted()
! A ReturnValue other than Level:Benign will rollback the transaction
IF SELF.Request<;>ViewRecord
Transaction.Finish(ReturnValue)
END
!In a process procedure that individually processes each record
ThisWindow.OpenReport PROCEDURE
ReturnValue BYTE,AUTO
CODE
ReturnValue = PARENT.OpenReport()
IF ReturnValue = Level:Benign
ReturnValue = Transaction.Start()
END
RETURN ReturnValue
!In a process procedure that processes a batch of records
ThisProcess.TakeRecord PROCEDURE
ReturnValue BYTE,AUTO
CODE
ReturnValue = PARENT.TakeRecord()
! —————————————————-
!
! Transaction Check Point
! The transaction will be saved till this point
! and a new one will be started
!
IF SELF.RecordsProcessed % 100 = 0
Transaction.Finish(ReturnValue)
IF ReturnValue = Level:Benign
ReturnValue = Transaction.Start()
END
END
! —————————————————-
PUT(Process:View)
IF ERRORCODE()
GlobalErrors.ThrowFile(Msg:PutFailed,'Process:View')
ThisWindow.Response = RequestCompleted
ReturnValue = Level:Fatal
END
RETURN ReturnValue
See Also: Finish