PostgresDAC

TPSQLTable.Properties.BatchModify

Previous Next

Batch insert, update and delete records.

Syntax:

property BatchModify: Boolean;

Description:

If you want implement batch Insert, Delete or Update operations, we suggest you use BatchModify property.

This property allows you increase operation speed. When you set BatchModify to True, PostgresDAC doesn't fetch data from database after each Insert or Update operations.

Use TPSQLQuery for batch Insert, Update or Delete operations.

Example:

procedure TForm1.Button1Click(Sender: TObject);
var
  I : Integer;
begin
   PSQLTable1.BatchModify := True;
   PSQLTable1.DisableControls;
   for I := 1 to 1000 do
   begin
       PSQLTable1.Insert;
       PSQLTable1.FieldByName('ID').AsInteger := I;
       PSQLTable1.FieldByName('Name').AsString := 'name'+IntToStr(I);
       PSQLTable1.Post;
   end;
   PSQLTable1.BatchModify := False;
   PSQLTable1.EnableControls;
end;