Kbase P174931: What is the effect of the TRANSACTION DISTINCT option of the RUN statement?
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  10/8/2010 |
|
Status: Unverified
GOAL:
What is the effect of the TRANSACTION DISTINCT option of the RUN statement?
GOAL:
What is the difference between using TRANSACTION DISTINCT and not using it?
GOAL:
If a client session starts a transaction, runs a procedure on an AppServer with the TRANSACTION DISTINCT option, and then undoes the client transaction, is the AppServer transaction undone too?
FACT(s) (Environment):
All Supported Operating Systems
Progress 9.x
OpenEdge 10.x
FIX:
The TRANSACTION DISTINCT option of the RUN statement tells the OpenEdge AVM not to propagate the calling procedure's transaction to the AppServer.
If the client starts a transaction, then runs a procedure on the AppServer TRANSACTION DISTINCT, and finally the client transaction is undone, the AppServer transaction is committed. The example procedures below using the Sports2000 database demonstrate how it works:
/* client.p */
DEFINE VARIABLE hAppSrv AS HANDLE NO-UNDO.
DEFINE VARIABLE lReturn AS LOGICAL NO-UNDO.
DO TRANSACTION ON ERROR UNDO, LEAVE:
FIND Customer WHERE CustNum = 1.
MESSAGE
'in client transaction: before change'
SKIP
CustNum NAME
SKIP
Address2
VIEW-AS ALERT-BOX.
Address2 = 'client change'.
CREATE SERVER hAppSrv.
lReturn = hAppSrv:CONNECT("-AppService asbroker1").
/* Comment or uncomment TRANSACTION DISTINCT to demonstrate */
RUN appserver.p ON SERVER hAppSrv /**/ TRANSACTION DISTINCT /**/.
/* Raise an error to force the client to undo its transaction */
FIND Customer WHERE CustNum = 1000.
END.
/* Client transaction was undone */
FIND Customer WHERE CustNum = 1.
MESSAGE
'after client transaction'
SKIP
CustNum NAME
SKIP
Address2
VIEW-AS ALERT-BOX.
/* AppServer transaction was not undone */
FIND Customer WHERE CustNum = 2.
MESSAGE
'after client transaction'
SKIP
CustNum NAME
SKIP
Address2
VIEW-AS ALERT-BOX.
/* appserver.p */
DO TRANSACTION ON ERROR UNDO, LEAVE:
FIND Customer WHERE CustNum = 2.
MESSAGE
'in AppServer transaction: before change'
SKIP
CustNum NAME
SKIP
Address2
.
/* Change the assignment to observe whether the transaction is committed */
Address2 = 'AppServer change'.
END.
FIND Customer WHERE CustNum = 2.
MESSAGE
'after AppServer transaction'
SKIP
CustNum NAME
SKIP
Address2
.
There is currently no difference between running the AppServer procedure with TRANSACTION DISTINCT and running without it. The reason is that even when TRANSACTION DISTINCT is not used, client transactions are never propagated to the AppServer. Although the current version of ABL does not allow transaction propagation, future versions might. Thus, to accommodate this possibility without breaking current code, the current version of ABL provides the TRANSACTION DISTINCT option for the server handle. However, until and unless transaction propagation is i.mplemented TRANSACTION DISTINCT is essentially a no-op..