API:FireDAC.Phys.MongoDBDataSet.TFDMongoDataSet.ConstraintsEnabled

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

property ConstraintsEnabled: Boolean read GetConstraintsEnabled write SetConstraintsEnabled default 0;

C++

__property ConstraintsEnabled = {default=0};

Properties

Type Visibility Source Unit Parent
property published
FireDAC.Phys.MongoDBDataSet.pas
FireDAC.Phys.MongoDBDataSet.hpp
FireDAC.Phys.MongoDBDataSet TFDMongoDataSet

Description

Specifies whether the dataset performs constraint checking.

FireDAC.Phys.MongoDBDataSet.TFDMongoDataSet.ConstraintsEnabled inherits from FireDAC.Comp.DataSet.TFDDataSet.ConstraintsEnabled. All content below this line refers to FireDAC.Comp.DataSet.TFDDataSet.ConstraintsEnabled.

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