RollbackOnly PowerScript function
Description
Modifies an EAServer transaction
associated with a calling thread so that the only possible outcome
is to roll back the transaction.
Controls
CORBACurrent objects
Syntax
1 |
<span>CORBACurrent</span>.<span>RollbackOnly</span> ( <span> </span>) |
Argument |
Description |
---|---|
CORBACurrent |
Reference to the CORBACurrent service |
Return Values
Integer. Returns 0 if it succeeds and
one of the following negative values if an error occurs:
-
-1
Failed for unknown reason
-
-2
No transaction is associated with the calling thread
Usage
RollbackTransaction is typically called
by the originator of the transaction. Another participant in a client-
or OTS style transaction can call RollbackOnly to
vote that the transaction should be rolled back.
RollbackOnly can be called by a client
or a component that is marked as OTS style. EAServer must be using the two-phase
commit transaction coordinator (OTS/XA).
Examples
In this example, a participant in a transaction has
determined that it should be rolled back. It creates and initializes
an instance of the CORBACurrent service object and votes to roll
back the transaction:
1 |
// Instance variable:<br>// CORBACurrent corbcurr<br>int li_rc<br> <br>li_rc = this.GetContextService("CORBACurrent", &<br> corbcurr)<br>IF li_rc <> 1 THEN<br>// handle the error<br>END IF<br> <br>li_rc = corbcurr.Init() |
1 |
IF li_rc <> 0 THEN<br>// handle the error<br>ELSE<br> corbcurr.<span>RollbackOnly</span>()<br>END IF |