RAD Studio |  |

Using the BDE to Cache Updates
See Also
Collapse All

The recommended approach for caching updates is to use a client dataset (TBDEClientDataSet) or to connect the BDE-dataset to a client dataset using a dataset provider. The advantages of using a client dataset are discussed in Using a client dataset to cache updates.

For simple cases, however, you may choose to use the BDE to cache updates instead. BDE-enabled datasets and TDatabase components provide built-in properties, methods, and events for handling cached updates. Most of these correspond directly to the properties, methods, and events that you use with client datasets and dataset providers when using a client dataset to cache updates. The following table lists these properties, events, and methods and the corresponding properties, methods and events on TBDEClientDataSet:

Properties, methods, and events for cached updates

On BDE-enabled Datasets (or TDatabase) | On TBDEClientDataSet | Purpose
CachedUpdates | Not needed for client datasets, which always cache updates. | Determines whether cached updates are in effect for the dataset.
UpdateObject | Use a BeforeUpdateRecord event handler, or, if using TClientDataSet, use the UpdateObject property on the BDE-enabled source dataset. | Specifies the update object for updating read-only datasets.
UpdatesPending | ChangeCount | Indicates whether the local cache contains updated records that need to be applied to the database.
UpdateRecordTypes | StatusFilter | Indicates the kind of updated records to make visible when applying cached updates.
UpdateStatus | UpdateStatus | Indicates if a record is unchanged, modified, inserted, or deleted.
OnUpdateError | OnReconcileError | An event for handling update errors on a record-by-record basis.
OnUpdateRecord | BeforeUpdateRecord | An event for processing updates on a record-by-record basis.
ApplyUpdates (database) | ApplyUpdates | Applies records in the local cache to the database.
CancelUpdates | CancelUpdates | Removes all pending updates from the local cache without applying them.
CommitUpdates | Reconcile | Clears the update cache following successful application of updates.
FetchAll | GetNextPacket (and PacketRecords) | Copies database records to the local cache for editing and updating.
RevertRecord | RevertRecord | Undoes updates to the current record if updates are not yet applied.

For an overview of the cached update process, see Overview of using cached updates.

The following topics describe in more detail on how to use the BDE to cache updates:

- Enabling BDE-based Cached Updates.
- Applying BDE-based Cached Updates.
- Using Update Objects to Update a Dataset.

Note: Even if you are using a client dataset to cache updates, you may want to read the section about update objects. You can use update objects in the BeforeUpdateRecord event handler of TBDEClientDataSet or TDataSetProvider to apply updates from stored procedures or multi-table queries.
See Also

BDE-based Architecture

Using TBatchMove

Tools for Working with the BDE

Using Transactions with the BDE

The Data Dictionary

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!