FireDAC.Comp.DataSet.TFDDataSet.CachedUpdates

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

property CachedUpdates: Boolean read GetCachedUpdates write SetCachedUpdates default False;

C++

__property bool CachedUpdates = {read=GetCachedUpdates, write=SetCachedUpdates, default=0};

Properties

Type Visibility Source Unit Parent
property public
FireDAC.Comp.DataSet.pas
FireDAC.Comp.DataSet.hpp
FireDAC.Comp.DataSet TFDDataSet

Description

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

CachedUpdates enables (True) or disables (False) the logging of data changes (Insert/Post, Edit/Post, Delete) without immediately applying them to the database.   An application must explicitly apply changes from the change log to the database, using the ApplyUpdates method. All the changes are written in a small amount of time per 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 the dataset.
  • Ability to implement applications in 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 the CachedUpdate property value for TFDTable, it must be inactive.

Example

FDQuery1.CachedUpdates := True;
...
FDQuery1.Edit;
...
FDQuery1.Post;
...
FDQuery1.Append;
...
FDQuery1.Post;
...
FDQuery1.ApplyUpdates;
FDQuery1.CommitUpdates;
FDQuery1.CachedUpdates := False;

See Also