Controlling transactions from a client – PB Docs 125

Controlling transactions from a client

PowerBuilder clients can exercise explicit control of a transaction
on a COM+ server by using a variable of type OleTxnObject
instead of OLEObject to connect to the COM object.

note.png Requires COM+ installation

The ConnectToNewObject call on an OleTxnObject
fails if COM+ is not installed on the client computer.

The OleTxnObject object, derived from the OLEObject object,
provides two additional functions (SetComplete and SetAbort)
that enable the client to participate in transaction control. When
the client calls SetComplete, the transaction
is committed if no other participant in the transaction has called SetAbort or
otherwise failed. If the client calls SetAbort,
the transaction is always aborted.

Example

In this example, the clicked event on a button creates a variable
of type OleTxnObject, connects to a COM object on a server, and
calls some methods on the object. When all the methods have returned,
the client calls SetComplete and disconnects
from the object.

This f_dowork function on the
COM object on the server creates an instance of the transaction
context service and calls its DisableCommit method
to prevent the transaction from committing prematurely between method
calls. After completing some work, the function calls SetAbort if
the work was not successfully completed and SetComplete if
it was.

The SetComplete call on the client commits
the transaction if all of the methods in the
transaction called SetComplete or EnableCommit.


Document get from Powerbuilder help
Thank you for watching.
Was this article helpful?
Subscribe
Notify of
guest
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x