$InTransaction
Documentation | Blog | Demos | Support
$InTransaction
0 out of 5 stars
5 Stars | 0% | |
4 Stars | 0% | |
3 Stars | 0% | |
2 Stars | 0% | |
1 Stars | 0% |
Indicates if an explicit transaction is in progress.
Syntax
$intransaction
Return Value
“1” ($True), or “0” ($False). Can be reset by an application program.
Description
$InTransaction acts as a flag, indicating if the software is currently processing an explicit transaction.
$InTransaction is set to “1” ($True) if a TRANSACTION (or BEGIN WORK) command has started an explicit transaction. It is set to “0” ($False) when an ENDTRANSACTION or QUITTRANSACTION (or COMMIT WORK or ROLLBACK WORK) command has closed the explicit transaction in progress.
The variable is unaffected by deadlock or implicit transactions.
Example
on deadlock if $intransaction = $true goto RetryAdd else goto previous endif endon ... other commands ... RetryAdd: transaction ... commands in the transaction ... endtransaction
In the above example, when a deadlock occurs, $InTransaction determines the course of action that the exception handler takes: restart the explicit transaction (when true) or retry the command that caused the deadlock (when false).
procedure UpdateCode (NewCode) local (DoEndTrans) if $intransaction = $false transaction let DoEndTrans = $true endif ... other commands ... if DoEndTrans = $true endtransaction endif endprocedure
In the above example, $InTransaction starts an explicit transaction if one is not already in progress.
See Also
0 out of 5 stars
5 Stars | 0% | |
4 Stars | 0% | |
3 Stars | 0% | |
2 Stars | 0% | |
1 Stars | 0% |