FireDAC.Comp.DataSet.TFDDataSet.ConstraintsEnabled

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

property ConstraintsEnabled: Boolean read GetConstraintsEnabled

C++

__property bool ConstraintsEnabled = {read=GetConstraintsEnabled, write=SetConstraintsEnabled, 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 performs constraint checking.

Use ConstraintsEnabled to get or set the flag that controls the automatic record-level constraints enforcement. 

When ConstraintsEnabled is False (the default), the dataset does not check Constraints. This allows the dataset to perform large data updates without the overhead of checking constraints. When ConstraintsEnabled is True, the dataset checks Constraints at the end of data editing (Post / AppendRecord / InsertRecord). 

If the application needs to perform batch updates to the dataset, then set ConstraintsEnabled to False before the updates, and return to the original value after the updates. Also, see the BeginBatch and EndBatch methods.

Example

var
  lPrevConsEnabled: Boolean;
...
lPrevConsEnabled := FDQuery1.ConstraintEnabled;
FDQuery1.ConstraintEnabled := False;
try
  // perform updates here, without checking client constraints
finally
  FDQuery1.ConstraintEnabled := lPrevConsEnabled;
end;

See Also