SaveRecord

See Also: Understanding File Buffers and DDO Field Buffers, Attach, Lock, Reread, Save

Purpose

To save changes made to a record buffer to the database on disk without updating fields that relate to other tables with data from those tables. This command is usually not used when working with Data Dictionaries.

Syntax

SaveRecord table [...table]

table is the logical name or filelist number used to identify the table.

What It Does

Saverecord saves data in the buffer for table to the disk and updates all indexes. If the record buffer was active (contained an existing record) prior to the saverecord, that record is edited. If the record buffer was inactive, a new record is created.

Saverecord transfers all data in the record buffer to the disk. It does not do an automatic attach.

find ge boxcars by 2

If (found) begin

   reread boxcars

   move sNew_owner to boxcars.owner

   saverecord boxcars

   unlock

end

In this example, a record in Database File boxcars is found, and the value of a field is changed. Then a saverecord writes the changed data back to the table. The record will retain the same record number and all other fields will remain unchanged.

clear boxcars

Move sId to item boxcars.id

Move sLocation to boxcars.location

saverecord boxcars

This example starts with a clear (new-record) buffer, fills it with data, and does a saverecord. This will create a new record in Database File boxcars, and update all on line indexes.

Where table relates to one or more parent tables, and data in the field(s) on which such relationship(s) is (are) based may be changed, you must use save rather than saverecord, unless you include an attach with the saverecord.

Notes

 

saverecord thisTable thatTable

//is exactly the same as:

saverecord thisTable

saverecord thatTable