Declares that a transaction on a transaction server should be rolled back.
Description
Declares that the current transaction should be rolled back.
Applies to
OLETxnObject objects
Syntax
oletxnobject.SetAbort ( )
Argument |
Description |
---|---|
oletxnobject |
The name of the OLETxnObject variable that is connected to the COM object |
Return value
Integer.
Returns 1 if it succeeds and -1 if an error occurs.
Usage
Call the SetAbort function from the client to force a COM+ transaction to be rolled back. The default is to complete the transaction if all participants in the transaction on the COM+ server have called SetComplete or EnableCommit.
Examples
The following example shows the use of SetAbort in a component method that performs database updates:
integer li_rc OleTxnObject lotxn_obj lotxn_obj = CREATE OleTxnObject li_rc = lotxn_obj.ConnectToNewObject("pbcom.n_test") IF li_rc <> 0 THEN Messagebox( "Connect Error", string(li_rc) ) // handle error END IF lotxn_obj.f_dowork() lotxn_obj.f_domorework() IF /* test for client satisfaction */ THEN lotxn_obj.SetComplete() ELSE lotxn_obj.SetAbort() END IF lotxn_obj.DisconnectObject()
See also
Description
Declares that a component cannot complete its work for the current transaction and that the transaction should be rolled back. The component instance are deactivated when the method returns.
Applies to
TransactionServer objects
Syntax
transactionserver.SetAbort ( )
Return value
Integer.
Returns 1 if it succeeds and -1 if an error occurs.
Usage
The SetAbort function corresponds to the rollbackWork transaction primitive in EAServer.
Any component that participates in a transaction can roll back the transaction by calling the rollbackWork primitive. Only the action of the root component (the component instance that began the transaction) determines when EAServer commits the transaction.
Examples
The following example shows the use of SetAbort in a component method that performs database updates:
// Instance variables: // DataStore ids_datastore // TransactionServer ts Integer li_rc long ll_rv li_rc = this.GetContextService("TransactionServer", ts) IF li_rc <> 1 THEN // handle the error END IF ... ... ll_rv = ids_datastore.Update() IF ll_rv = 1 THEN ts.SetComplete() ELSE ts.SetAbort() END IF
See also
IsInTransaction (obsolete)
IsTransactionAborted (obsolete)