AnyDAC
ContentsIndexHome
PreviousUpNext
TADStoredProc.CachedUpdates Property

Specifies whether dataset will log changes to the data without immediate applying of them to the database.

Group
Links

CachedUpdates enables (True) or disables (False) the logging of data changes (Insert/Post, Edit/Post, Delete) without immediate applying of them to the database. 

An application must explicitly apply changes from change log to the database, using ApplyUpdates method. All changes will be written in comparably small amount of time in single transaction. The main benefits of enabling cached updates are:

  • fewer transactions and shorter transaction times;
  • minimization of network traffic;
  • simplified implementation of undo / redo functionality for dataset;
  • ability to implement application offline mode or briefcase model.

The potential drawbacks of enabling cached updates are:

  • other applications can access and change the actual data on the server while users are editing local copies of the data, resulting in an update conflict when cached updates are applied to the database;
  • other applications cannot access data changes made by an application until its cached updates are applied to the database.

Note, to change CachedUpdate property value for TADTable, it must be inactive.

property CachedUpdates: Boolean;

Caching Updates, ApplyUpdates, CancelUpdates, CommitUpdates

ADQuery1.CachedUpdates := True;
...
ADQuery1.Edit;
...
ADQuery1.Post;
...
ADQuery1.Append;
...
ADQuery1.Post;
...
ADQuery1.ApplyUpdates;
ADQuery1.CommitUpdates;
ADQuery1.CachedUpdates := False;
What do you think about this topic? Send feedback!