Consultor Eletrônico



Kbase P102507: 4GL: Can a FIND be done on a table that is being updated before the changes are committed?
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   3/24/2005
Status: Unverified

GOAL:

4GL: Can a FIND be done on a table that is being updated before the changes are committed?

FIX:

Yes, a FIND statement may be executed on a table whether its being updated or not and regardless of whether the changes have been committed or not. Doing a FIND on a record that has been updated but not yet committed results in a 'dirty read'. A Dirty read allows the reading of rows that has been inserted or modified by a transaction, but not committed. The following example starts a transaction. In this transaction, we find a customer, update the country field, find the same customer record, message the country field new value and finally, we UNDO the whole transaction (nothing is written to the database). After the transaction ends, we FIND the same record again message the original value that is retained:
DO TRANSACTION:
FIND FIRST customer.
ASSIGN Country = "alpha".
FIND FIRST customer NO-LOCK.
MESSAGE country
VIEW-AS ALERT-BOX INFO BUTTONS OK.
UNDO.
END.
FIND FIRST customer NO-LOCK.
MESSAGE country
VIEW-AS ALERT-BOX INFO BUTTONS OK.