How preprare several set queries with TUniQuery
Posted: Fri 01 May 2020 21:20
I need add 10-1000 row. I try use function Prepare but not work perfekly. Only one row added
(...)
UniQuery.SQL.Clear;
UniQuery.SQL.Add('INSERT INTO Table (field1,field2,field3) VALUES (:b0,:b1,:b2);');
for I := 0 to 1000 do
begin
UniQuery.ParamByName('b0').AsInteger := 1;
UniQuery.ParamByName('b1').AsInteger := 2;
UniQuery.ParamByName('b2').AsInteger := Random(100);
UniQuery.Prepare;
end;
UniQuery.Execute;
What is the fastest way to add 1000 rows? Executing the "Execute" command 1000 times is slow
(...)
UniQuery.SQL.Clear;
UniQuery.SQL.Add('INSERT INTO Table (field1,field2,field3) VALUES (:b0,:b1,:b2);');
for I := 0 to 1000 do
begin
UniQuery.ParamByName('b0').AsInteger := 1;
UniQuery.ParamByName('b1').AsInteger := 2;
UniQuery.ParamByName('b2').AsInteger := Random(100);
UniQuery.Prepare;
end;
UniQuery.Execute;
What is the fastest way to add 1000 rows? Executing the "Execute" command 1000 times is slow