BeginTransaction PowerScript function
Description
Creates an EAServer transaction
and associates it with the calling thread.
Controls
CORBACurrent objects
Syntax
|
1 |
<span>CORBACurrent</span>.<span>BeginTransaction</span> ( <span> </span>) |
|
Argument |
Description |
|---|---|
|
CORBACurrent |
Reference to the CORBACurrent service |
Return Values
Boolean. Returns true if
it succeeds and false if the transaction could
not be created.
Usage
The BeginTransaction function creates a
transaction and modifies the transaction context of the calling
thread so that it is associated with the transaction. This enables
the calling thread to obtain information about the transaction and
control commits and rollbacks. BeginTransaction 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). If the calling thread
is already associated with a transaction, BeginTransaction returns false. Nested
transactions are not supported.
Examples
This example shows the use of BeginTransaction to
create a transaction from a client:
|
1 |
// Instance variables:<br>// CORBACurrent corbcurr<br>// Connection myconnect<br>long ll_rc<br>integer li_rc1, li_rc2<br>boolean lb_success<br>ll_rc = myconnect.ConnectToServer()<br>// insert error handling ...<br>li_rc1 = this.GetContextService("CORBACurrent", &<br> corbcurr)<br>// insert error handling ...<br>li_rc2 = corbcurr.Init( myconnect )<br>// insert error handling ...<br>lb_success = corbcurr.<span>BeginTransaction</span>()<br>IF NOT lb_success THEN <br>MessageBox ("Create Transaction Failed", &<br> "The client may already be in a transaction")<br> RETURN |
|
1 |
ELSE<br> ll_rc = myconnect.CreateInstance(lcst_mybookstore)<br> // begin processing<br>... |
See Also
-
CommitTransaction, GetContextService, GetStatus, GetTransactionName, Init, ResumeTransaction, RollbackOnly, RollbackTransaction, SetTimeout, SuspendTransaction