Page 1 of 1

How preprare several set queries with TUniQuery

Posted: Fri 01 May 2020 21:20
by lcdk
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

Re: How preprare several set queries with TUniQuery

Posted: Tue 05 May 2020 07:07
by Stellar
UniDAC supports Batch Operations. In this mode, you can insert, update, or delete data arrays.
You can find out more about Batch Operations in our docs:
https://www.devart.com/unidac/docs/batchops.htm

Re: How preprare several set queries with TUniQuery

Posted: Tue 05 May 2020 11:35
by lcdk
Stellar wrote:
Tue 05 May 2020 07:07
UniDAC supports Batch Operations. In this mode, you can insert, update, or delete data arrays.
You can find out more about Batch Operations in our docs:
https://www.devart.com/unidac/docs/batchops.htm
Thank you

Re: How preprare several set queries with TUniQuery

Posted: Fri 08 May 2020 06:55
by Stellar
Please contact us if you have any additional questions about our products