How to prevent Delphi ADO from loading the entire table into memory?

前端 未结 7 2173
后悔当初
后悔当初 2021-02-09 01:22

I am not a Delphi programmer, but I I got an old Delphi 7 application that I need to fix and it is using ADO.

The database table (MS Accesss) contains +100,000 rows and

7条回答
  •  长发绾君心
    2021-02-09 01:32

    You could use that adoTable with an Server OpenForwardOnly cursor and an TCLientDataset with PacketRecords set to nonzero value. Worked wonderfully when I had to write an app to pump data from MSSQL to Oracle on a customized way with tables with millions of records.

    EDIT -> It would be something on the lines of this:

    procedure ConfigCDSFromAdoQuery(p_ADOQ: TADOQuery; p_CDS: TClientDataset; p_Prov: TDatasetProvider);
    begin
      If p_ADOQ.Active then p_ADOQ.Close;
      p_ADOQ.CursorLocation := clServer;
      p_ADOQ.CursorType := ctOpenForwardOnly;
      p_Prov.Dataset := p_ADOQ;
      p_CDS.SetProvider(p_Prov);
      p_CDS.PacketRecords := 100;
      p_CDS.Open; 
    end ;
    

    I've done this all by code, but most of that you can do in design-time.

提交回复
热议问题