私はunidacコンポーネントを使用しています。そして、約1000行の高速挿入に問題があります。
var
query: TUniquery;
begin
query.SQL.Add('INSERT INTO Table (field1,field2,field3) VALUES (:b0,:b1,:b2);');
for I := 0 to 1000 do
begin
Query.ParamByName('b0').AsInteger := 1;
Query.ParamByName('b1').AsInteger := 2;
Query.ParamByName('b2').AsInteger := Random(100);
Query.Prepare;
Query.Execute; //1000 times is very slow
end;
速いです
var
query: TUniquery;
begin
for I := 0 to 1000 do
Query.SQL.Add('INSERT INTO Table (field1,field2,field3) VALUES (1,2,Random(100));');
end;
Query.Execute; //1 times - is fast add
end;
しかし、プロシージャQuery.ParamByName('b1').AsInteger := 2;で最初の形式を使用したいと思い ます。より明確で、多数の列があるため、見つけやすくなっています。
これを解決する方法について何かアイデアはありますか?
異なるデータを含む多数の行をすばやく挿入する方法が他にあるのではないでしょうか?