Try OpenEdge Now
skip to main content
Programming Interfaces
Data Management : Database Access : Fetching field lists : Updating and deleting with field lists
 
Updating and deleting with field lists
After fetching a field list, if your procedure updates the fetched record, the AVM always rereads the complete record before completing the update. In fact, if you fetch a field list with EXCLUSIVE–LOCK, the AVM reads the complete record anyway. This is to ensure proper operation of updates and the before-image (BI) file. (For information on BI files, see OpenEdge Deployment: Managing ABL Applications.)
Also, if you delete a record after fetching a field list for it, the AVM rereads the complete record for the following cases:
*If you delete from an OpenEdge database, the AVM always re-reads the complete record.
*If you delete from a DataServer database, the AVM rereads the complete record if the delete occurs in a subtransaction, in order to create the local before-image (LBI) note. (For information on LBI files, see OpenEdge Deployment: Managing ABL Applications.)
Thus, if you fetch with NO–LOCK or SHARE–LOCK, avoid using field lists if you expect to perform a high ratio of updates or deletes to fetches. For example, this is an inefficient construction with an OpenEdge database:
FOR EACH Customer FIELDS (Name Balance):
  DISPLAY "Deleting Customer" Customer.Name "with balance:" Customer.Balance.
  DELETE Customer.
END.
This procedure rereads the complete record for each field list that it fetches, and thus fetches twice per record. Without the field list, the same procedure fetches only once per record.
* Updating and deleting with query field lists