How preprare several set queries with TUniQuery

Discussion of open issues, suggestions and bugs regarding UniDAC (Universal Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
lcdk
Posts: 4
Joined: Sun 24 Nov 2019 22:37

How preprare several set queries with TUniQuery

Post by lcdk » 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

Stellar
Devart Team
Posts: 384
Joined: Tue 03 Oct 2017 11:00

Re: How preprare several set queries with TUniQuery

Post by Stellar » 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

lcdk
Posts: 4
Joined: Sun 24 Nov 2019 22:37

Re: How preprare several set queries with TUniQuery

Post by lcdk » Tue 05 May 2020 11:35

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

Stellar
Devart Team
Posts: 384
Joined: Tue 03 Oct 2017 11:00

Re: How preprare several set queries with TUniQuery

Post by Stellar » Fri 08 May 2020 06:55

Please contact us if you have any additional questions about our products

Post Reply