FireDAC.Comp.DataSet.TFDDataSet.BeginBatch
Delphi
procedure BeginBatch(ARegular: Boolean = False);
C++
void __fastcall BeginBatch(bool ARegular = false);
Contents
Properties
| Type | Visibility | Source | Unit | Parent | 
|---|---|---|---|---|
| procedure function | public | FireDAC.Comp.DataSet.pas FireDAC.Comp.DataSet.hpp | FireDAC.Comp.DataSet | TFDDataSet | 
Description
Optimizes dataset functionality for batch updates.
Use the BeginBatch method to disable resource-consuming operations and set up the dataset to perform updates at maximum speed of execution. The BeginBatch call disables:
- Data-aware controls refreshing.
- Constraints updating.
- Aggregates maintaining.
- Wait cursor showing.
- Similar resources consuming processing in DatS objects, which is not controlled through dataset APIs.
If a batch algorithm calls the Delete method, then set AWithDelete to True. It is prohibited to call Refresh inside a batch. The BeginBatch calls cannot be nested, although FireDAC does not raise exceptions on consequent calls. After finishing the updates, call the EndBatch method.
Example
FDQuery1.BeginBatch;
try
  FDQuery1.AppendRecord([...]);
  FDQuery1.AppendRecord([...]);
  FDQuery1.AppendRecord([...]);
  ......
finally
  FDQuery1.EndBatch;
end;