juninhopolo
New Member
Working with transactions, I found the following problem / imagined scenario.
A record needs to be updated and for that I used strong scope, transaction and proper lock, like so:
My code was getting stuck right after the ASSIGN statement and doing some basic debug (aka MESSAGE) I found out that it was waiting for a record from another table to be available. It turns out my customer table have a trigger that updates another table (that have the record the code above "need" locked by another process / user).
Is there any way to know or trap this condition, so I can silent handle that instead of waiting for the execution resume (record available again) or crash (lock timeout)? Something along the lines of "NO-ERROR NO-WAIT".
A record needs to be updated and for that I used strong scope, transaction and proper lock, like so:
Code:
def buffer customer for customer.
do for customer trans.
find customer exclusive-lock where customer.cust-num = 1 no-error no-wait.
if avail customer then do:
assign customer.name = 'John Doe'.
end.
end.
My code was getting stuck right after the ASSIGN statement and doing some basic debug (aka MESSAGE) I found out that it was waiting for a record from another table to be available. It turns out my customer table have a trigger that updates another table (that have the record the code above "need" locked by another process / user).
Is there any way to know or trap this condition, so I can silent handle that instead of waiting for the execution resume (record available again) or crash (lock timeout)? Something along the lines of "NO-ERROR NO-WAIT".
Last edited: