Re: Help optimize Dataset copy code
- From: "Dmitry Arefiev" <darefiev@xxxxxxxxxxx>
- Date: Fri, 9 May 2008 22:26:26 +0400
Hello
Nothing about ADO :)
But using other DAC's, like the AnyDAC, you can speedup your data loading. Following is the example of how to use
Array DML to load data from one to another of supported DBMS's:
qSrc.SQL.Text := 'select f1, f2, ... from srctab';
qSrc.FetchOptions.RowsetSize := 1000;
qSrc.FetchOptions.Unidirectional := True;
qDest.SQL.Text := 'insert into desttab values(:f1, :f2, ...)';
qDest.Params.ArraySize := 1000;
qSrc.DisableControls;
try
qSrc.Open;
iCurRow := 0;
while not qSrc.Eof do begin
qDest.Params[0].AsIntegers[iCurRow] := qSrc.Fields[0].AsInteger;
qDest.Params[1].AsStrings[iCurRow] := qSrc.Fields[0].AsString;
......
Inc(iCurRow);
if iCurRow = qDest.Params.ArraySize then begin
qDest.Execute(qDest.Params.ArraySize, 0);
iCurRow := 0;
end;
qSrc.Next;
end;
if iCurRow > 0 then
qDest.Execute(iCurRow, 0);
finally
qSrc.EnableControls;
end;
--
With best regards,
Dmitry Arefiev
AnyDAC Team
RemObjects Software
The Infrastructure Company
http://www.remobjects.com
.
- Prev by Date: Re: Help optimize Dataset copy code
- Next by Date: Re: ADOQuery exception on empty dataset
- Previous by thread: Re: Help optimize Dataset copy code
- Next by thread: Re: Help optimize Dataset copy code
- Index(es):