Bde.DBTables.TDatabase.ApplyUpdates
Delphi
procedure ApplyUpdates(const DataSets: array of TDBDataSet);
C++
void __fastcall ApplyUpdates(TDBDataSet* const *DataSets, const int DataSets_High);
Properties
Type | Visibility | Source | Unit | Parent |
---|---|---|---|---|
procedure function |
public | Bde.DBTables.pas Bde.DBTables.hpp |
Bde.DBTables | TDatabase |
Description
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:
- A database transaction starts.
- Cached updates are written to the database (Phase 1).
If the database write is successful:
- Database changes are committed, ending the transaction.
- 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).