Implementing UPDATE for VDATA
When existing records are changed, the sequence is:
▪The Provider creates the Command object.
▪The Provider adds bindings for the variables for which it wants to change data, and any other variables it needs to inspect in order to know whether a particular records needs to be changed.
▪The Provider calls MoveFirst/MoveNext (and the CDSC fills in the Value objects as necessary) until it finds a record that it wants to change. Note that up to this point, the behavior is identical to that for SELECT, but from this point onwards, for the records that are to be changed, the behavior is the same as the writing of data in a new record by AddNew.
▪The Provider changes the values in the Value objects.
▪The Provider calls Update and the CDSC writes the data from the Value objects.
▪The Provider repeatedly calls MoveNext, and for any other records that need changing, it changes the Values and calls Update.
When writing data, the CDSC should not change the data for any variables that were not bound. For efficiency, it might be worth avoiding writing data for any bound variables whose values were not changed.
The major differences between adding new records and changing existing records are:
▪how the Provider finds the record to be written: either creating a new record with AddNew or navigating to an existing record.
▪how many records can be affected: updating can change multiple records in a single pass through the data whereas new records must be added one at a time.
See also