RollbackTransaction PowerScript function
Description
Rolls back the EAServer transaction
associated with the calling thread.
Controls
CORBACurrent objects
Syntax
|
1 |
<span>CORBACurrent</span>.<span>RollbackTransaction</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
-
-3
The calling thread does not have permission to commit the
transaction -
-4
The HeuristicCommit exception was raised
Usage
The RollbackTransaction function rolls
back the transaction associated with the calling thread. The call
fails if the HeuristicCommit exception is raised. Heuristic decisions
are usually made when normal processing cannot continue, such as
when a communications failure occurs. The HeuristicCommit exception
is raised when all relevant updates have been committed.
RollbackTransaction 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
This example shows the use of RollbackTransaction to
roll back a transaction when an update does not succeed:
|
1 |
// Instance variables:<br>// CORBACurrent corbcurr<br>int li_rc1, li_rc2<br>long ll_rc<br> <br>this.GetContextService("CORBACurrent", corbcurr)<br>li_rc1 = corbcurr.Init()<br>IF li_rc1 <> 1 THEN<br> // handle the error<br>ELSE<br> ll_rc = CreateInstance(mycomp)<br> // invoke methods on the instantiated component<br> // test return values and roll back |
|
1 |
// if unsatisfactory |
|
1 |
<br> IF li_rc2 = 1 THEN<br> corbcurr.CommitTransaction()<br> ELSE<br> corbcurr.<span>RollbackTransaction</span>()<br> END IF |
|
1 |
END IF |
See Also
-
BeginTransaction, CommitTransaction, GetContextService, GetStatus, GetTransactionName, Init, ResumeTransaction, RollbackOnly, SetTimeout, SuspendTransaction