Using the BDE to Cache Updates
Go Up to Using the BDE to cache updates Index
Note: The Borland Database Engine (BDE) has been deprecated, so it will not be enhanced. For instance, BDE will never have Unicode support. You should not undertake new development with BDE. Consider migrating your existing database applications from BDE to dbExpress. For information about migrating from BDE to dbExpress, see http://www.embarcadero.com/rad-in-action/migration-upgrade-center.
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 |
---|---|---|
Not needed for client datasets, which always cache updates. |
Determines whether cached updates are in effect for the dataset. | |
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. | |
Indicates whether the local cache contains updated records that need to be applied to the database. | ||
Indicates the kind of updated records to make visible when applying cached updates. | ||
Indicates if a record is unchanged, modified, inserted, or deleted. | ||
An event for handling update errors on a record-by-record basis. | ||
N/A |
An event for processing updates on a record-by-record basis. | |
ApplyUpdates (database) |
Applies records in the local cache to the database. | |
Removes all pending updates from the local cache without applying them. | ||
Clears the update cache following successful application of updates. | ||
GetNextPacket (and PacketRecords) |
Copies database records to the local cache for editing and updating. | |
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.