How i do know if a trx was undone

tdi

Progress Fan
Hi you all!.
I faced this problem now, and haven't find a solution.
i have something like:
<code>
do:
inner-loop:
do transaction:
find x.
for each y of x exclusive-lock.
find z of y no-lock no-error.
if not available z then undo inner-loop, leave inner-loop.
....
end.
.....
end. /*trx*/
/* here i want to know if the block was undone */
if ... what? .... then do:
message "error".
end.
 

rich_t

New Member
How about:

<BLOCKQUOTE><font size="1" face="Arial, Verdana">code:</font><HR><pre>

DEF VAR c-status as char no-undo.

.
.
.
ASSIGN c-status = "".
INNER-LOOP:
DO:
.
.
.
IF NOT AVAILABLE(whatever) THEN DO:
ASSIGN c-status="error".
UNDO INNER-LOOP. LEAVE INNER-LOOP.
END.

END. /* inner loop */

IF c-status = "error" THEN ....

[/code]

I haven't even looked to see if there a Progress function to test for this, but this is how I have done it for years, and don't forget to make your VAR "NO-UNDO" ...

HTH
Rich
 

tdi

Progress Fan
Hi Rich.

That's good. I have used that construction too.
But there's some problem with it.
The example you gave takes on accout the use of NO-ERROR, but what about a trigger returnig you an error?, in fact my question was about a condition where the error cames from outside the code.

Thanks.
 
U

Unregistered

Guest
That's the trouble with triggers. I suppose the glib reply would be to make sure you don't have any triggers that do Bad Things to your code in the first place.

In the example you give, you could define a logical variable with an initial value of true and then set it to false as the last statement of the transaction. If the block was left before that point for any reason (including a trigger returning an error) then the variable would still be true.

But I still say that's quite an overhead, because you will end up having to do that for every single transaction in your application!

Maybe the glib answer is the best one after all: look into avoiding having triggers that return an error condition...
 
Top