procedure TDBThread.Execute;
var I : Integer;
StartTime : TDateTime;
SQl :
String;
begin
StartTime := Now;
DBQuery.Edit;
for I := 1
to Amount
do begin
Inc(Counter);
DBQuery.FieldByName('
ID').AsInteger := Counter;
DBQuery.FieldByName('
PROP01').AsFloat := Random(10000);
DBQuery.FieldByName('
PROP02').AsFloat := Random(10000);
DBQuery.FieldByName('
PROP03').AsFloat := Random(10000);
DBQuery.FieldByName('
PROP04').AsFloat := Random(10000);
DBQuery.FieldByName('
PROP05').AsFloat := Random(10000);
DBQuery.FieldByName('
PROP06').AsFloat := Random(10000);
DBQuery.FieldByName('
PROP07').AsFloat := Random(10000);
DBQuery.FieldByName('
PROP08').AsFloat := Random(10000);
DBQuery.FieldByName('
PROP09').AsFloat := Random(10000);
DBQuery.FieldByName('
PROP10').AsFloat := Random(10000);
DBQuery.FieldByName('
DateTime').AsSQLTimeStamp := DateTimeToSQLTimeStamp(Now);
DBQuery.Append;
end;
TimeMS := MilliSecondsBetween(Now, StartTime);
Form2.Memo1.Lines.Add('
1 Time : ' + IntToStr(TimeMS) + '
ms');
StartTime := Now;
for I := 1
to Amount
do begin
Inc(Counter);
SQl := '
INSERT Into ' + Table;
SQl :=
SQl + '
(ID, PROP01, PROP02, PROP03, PROP04, PROP05, PROP06, PROP07, PROP08, PROP09, PROP10)';
SQl :=
SQl + '
VALUES (' + IntToStr(Counter) + '
, ';
SQl :=
SQl + FloatToStr(Random(10000) ) + '
, ';
SQl :=
SQl + FloatToStr(Random(10000) ) + '
, ';
SQl :=
SQl + FloatToStr(Random(10000) ) + '
, ';
SQl :=
SQl + FloatToStr(Random(10000) ) + '
, ';
SQl :=
SQl + FloatToStr(Random(10000) ) + '
, ';
SQl :=
SQl + FloatToStr(Random(10000) ) + '
, ';
SQl :=
SQl + FloatToStr(Random(10000) ) + '
, ';
SQl :=
SQl + FloatToStr(Random(10000) ) + '
, ';
SQl :=
SQl + FloatToStr(Random(10000) ) + '
, ';
SQl :=
SQl + FloatToStr(Random(10000) ) + '
);';
//SQl := SQl + SQLTimeStampToStr('ddd d of mmm yyyy', DateTimeToSQLTimeStamp(Now)) + ');';
DBQuery.SQL.Text :=
SQL;
DBQuery.ExecSQL;
end;
TimeMS := MilliSecondsBetween(Now, StartTime);
Form2.Memo1.Lines.Add('
2 Time : ' + IntToStr(TimeMS) + '
ms');
StartTime := Now;
for I := 1
to Amount
do begin
Inc(Counter);
DBQuery.SQL.Text := '
INSERT Into ' + Table + '
(ID, PROP01, PROP02, PROP03, PROP04, PROP05, PROP06, PROP07, PROP08, PROP09, PROP10) VALUES (:wert1, :wert2, :wert3, :wert4, :wert5, :wert6, :wert7, :wert8, :wert9, :wert10, :wert11);';
DBQuery.Prepare;
DBQuery.Params[0].AsInteger := Counter;
DBQuery.Params[1].AsFloat := Random(10000);
DBQuery.Params[2].AsFloat := Random(10000);
DBQuery.Params[3].AsFloat := Random(10000);
DBQuery.Params[4].AsFloat := Random(10000);
DBQuery.Params[5].AsFloat := Random(10000);
DBQuery.Params[6].AsFloat := Random(10000);
DBQuery.Params[7].AsFloat := Random(10000);
DBQuery.Params[8].AsFloat := Random(10000);
DBQuery.Params[9].AsFloat := Random(10000);
DBQuery.Params[10].AsFloat := Random(10000);
DBQuery.ExecSQL;
end;
TimeMS := MilliSecondsBetween(Now, StartTime);
Form2.Memo1.Lines.Add('
3 Time : ' + IntToStr(TimeMS) + '
ms')
end;