Hi. I'm porting some code into Delphi. I'm using UniDAC components to interface SQLite. At some point I have to perform an insert query for each item in a TStringList. The list can grow to several hundred thousand entries. The performance is poor if I need to perform ExecSQL for each line. Can anyone tell me how to do some kind of bulk insert or transaction for this. This is my code now:
Code: Select all
var
myQuery : TUniQuery;
(...)
begin
myQuery:= TUniQuery.Create(nil);
myQuery.Connection:= my_db;
//
for i := 0 to origin_2SL.Count-1 do
begin
myQuery.SQL.Text:= 'insert into mytable(a,b,c,d) values(:a,:b,:c,:d)');
(...)//fill the params
//execute query
myQuery.ExecSQL
end;
//
myQuery.Free;
end;
Can anyone tell me how to improve the performance?
Thanks!