Which PowerScript function
Description
Allows a component to find out whether it is running on a
transaction server.
Controls
TransactionServer objects
Syntax
|
1 |
transactionserver.<span>Which</span> ( <span> </span>) |
|
Argument |
Description |
|---|---|
|
transactionserver |
Reference to the TransactionServer service |
Return Values
Integer. Returns 0 if the object is not
running on a transaction server, 1 if it is running on EAServer, or 2 if it is running
on COM+.
Usage
The Which function allows a custom class
user object to perform different processing depending on its runtime
context.
Examples
The code in the following example checks to see whether
the runtime context is a transaction server (EAServer or COM+). If
it is, it uses transaction semantics that are appropriate for a
transaction server; otherwise, it uses COMMIT and ROLLBACK to
communicate directly with the database:
|
1 |
// Instance variables: |
|
1 |
// DataStore ids_datastore |
|
1 |
// TransactionServer ts |
|
1 |
|
1 |
Integer li_rc |
|
1 |
long ll_rv |
|
1 |
|
1 |
li_rc = this.GetContextService("TransactionServer", & |
|
1 |
ts) |
|
1 |
IF li_rc <> 1 THEN |
|
1 |
// handle the error |
|
1 |
END IF |
|
1 |
... |
|
1 |
... |
|
1 |
ll_rv = ids_datastore.Update() |
|
1 |
|
1 |
IF ts.<span>Which</span>() > 0 THEN |
|
1 |
IF ll_rv = 1 THEN |
|
1 |
ts.EnableCommit() |
|
1 |
ELSE |
|
1 |
ts.DisableCommit() |
|
1 |
END IF |
|
1 |
ELSE |
|
1 |
IF ll_rv = 1 THEN |
|
1 |
COMMIT USING SQLCA; |
|
1 |
ELSE |
|
1 |
ROLLBACK USING SQLCA; |
|
1 |
END IF |
|
1 |
END IF |
See Also
Document get from Powerbuilder help
Thank you for watching.
Subscribe
Login
0 Comments
Oldest