IsTransactionAborted PowerScript function
Description
Determines whether the current transaction, in which an EAServer component participates,
has been aborted.
Controls
TransactionServer objects
Syntax
|
1 |
transactionserver.<span>IsTransactionAborted</span> ( <span> </span>) |
|
Argument |
Description |
|---|---|
|
transactionserver |
Reference to the TransactionServer service |
Return Values
Boolean. Returns true if
the current transaction has been aborted and false if
it has not.
Usage
The IsTransactionAborted function allows
a component to verify that the current transaction is still viable
before performing updates to the database.The IsTransactionAborted function
corresponds to the isRollbackOnly transaction primitive in EAServer.
Examples
The following example checks to see whether the transaction
has been aborted. If it has not, it updates the database and calls EnableCommit.
If it has been aborted, it calls DisableCommit.
|
1 |
// Instance variables: ids_datastore, ts<br>Integer li_rc |
|
1 |
long ll_rv |
|
1 |
|
1 |
li_rc = this.GetContextService("TransactionServer", ts) |
|
1 |
IF li_rc <> 1 THEN |
|
1 |
// handle the error |
|
1 |
END IF |
|
1 |
... |
|
1 |
IF ts.<span>IsTransactionAborted</span>() = FALSE THEN |
|
1 |
ll_rv = ids_datastore.Update() |
|
1 |
IF ll_rv = 1 THEN |
|
1 |
ts.EnableCommit() |
|
1 |
ELSE |
|
1 |
ts.DisableCommit() |
|
1 |
END IF |
|
1 |
END IF |