Caching Updates

From InterBase
Jump to: navigation, search

Go Up to Understanding Databases and Datasets


InterBase Express (IBX) provides support for caching updates. When you cache updates, your application retrieves data from a database, makes all changes to a local, cached copy of the data, and applies the cached changes to the dataset as a unit. Cached updates are applied to the database in a single transaction.

Caching updates can minimize transaction times and reduce network traffic. However, cached data is local to your application and is not under transaction control. This means that while you are working on your local, in-memory, copy of the data, other applications can be changing the data in the underlying database table. They also cannot see any changes you make until you apply the cached updates. Because of this, cached updates may not be appropriate for applications that work with volatile data, as you may create or encounter too many conflicts when trying to merge your changes into the database.

You can tell datasets to cache updates using the CachedUpdates property. When the changes are complete, they can be applied by the dataset component, by the database component, or by a special update object. When changes cannot be applied to the database without additional processing (for example, when working with a joined query), you must use the OnUpdateRecord event to write changes to each table that makes up the joined view.

For more information on caching updates, see Working with Cached Updates.

Note: If you are caching updates, you may want to consider moving to a multi-tiered model to have greater control over the application of updates. For more information about the multi-tiered model, see Creating multi-tiered applications in the Delphi Developer’s Guide.

Advance To: