From RAD Studio API Documentation
Jump to: navigation, search


procedure ApplyUpdates(const DataSets: array of TDBDataSet);


void __fastcall ApplyUpdates(TDBDataSet* const *DataSets, const int DataSets_High);


Type Visibility Source Unit Parent
Bde.DBTables TDatabase


Posts pending cached updates for specified datasets to the database server.

Call ApplyUpdates to post pending cached updates for a specific set of open datasets to the database server. ApplyUpdates is only meaningful if the CachedUpdates property of a specified dataset is true.

DataSets is a list of dataset names specifying the datasets for which to post pending updates. DataSets need not list every currently open dataset. For each listed dataset, ApplyUpdates calls the dataset's ApplyUpdates and CommitUpdates methods to post that dataset's pending cached updates.

Applying updates is a two-phase process that takes place within the context of the database component's transaction control. When an application calls ApplyUpdates, the following events take place:

  1. A database transaction starts.
  2. Cached updates are written to the database (Phase 1).

If the database write is successful:

  1. Database changes are committed, ending the transaction.
  2. CachedUpdates are committed, clearing the internal cache buffer (Phase 2).

If the database write fails, database changes are rolled back, ending the transaction.

The two-phased approach allows for effective error recovery, especially when updating multiple and interrelated datasets (for example, the datasets associated with a master/detail form).

See Also