juninhopolo
New Member
Imagine the following scenario:
I have a client who only needs to be updated if they meet certain criteria based on their own data. I can only update the record if it meets the criteria (so I only lock the record after the IF statements, when necessary) and the data I was based on cannot have been changed (this is the part I got stuck on).
What can I do to ensure that the registry has not been updated and still use separate buffers / strong scope?
I have a client who only needs to be updated if they meet certain criteria based on their own data. I can only update the record if it meets the criteria (so I only lock the record after the IF statements, when necessary) and the data I was based on cannot have been changed (this is the part I got stuck on).
Code:
DEF BUFFER find-customer FOR customer.
DO FOR find-customer.
FIND FIRST find-customer WHERE find-customer.cust-num = 1 NO-ERROR.
IF AVAIL find-customer THEN DO.
//if statement based on the customer data.
//if statement based on the customer data.
//if statement based on the customer data.
//that's why I don't lock the record right up there.
DEF BUFFER upd-customer FOR customer.
DO FOR upd-customer TRANS.
FIND CURRENT find-customer NO-LOCK.
//I imagine that in here a lot of things can happen (in others sessions), right?
FIND FIRST upd-customer EXCLUSIVE-LOCK WHERE ROWID(upd-customer) = ROWID(find-customer) NO-ERROR NO-WAIT.
IF AVAIL find-customer AND NOT CURRENT-CHANGED find-customer AND AVAIL upd-customer THEN DO.
//update customer.
END.
END.
END.
END.
What can I do to ensure that the registry has not been updated and still use separate buffers / strong scope?
Last edited: