EPUB | CHM | PDF

TMySQLTable.Properties.BatchModify

Top Previous Next

Insert, update or delete records without refetching data from database after every operation.

Syntax:

property BatchModify: Boolean;

Description:

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

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

tip Use TMySQLQuery for batch Insert, Update or Delete operations.

Example:

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