ClientDataSet records into SQLite table - HOW?

Discussion of open issues, suggestions and bugs regarding UniDAC (Universal Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
w.weiss
Posts: 3
Joined: Wed 20 Feb 2019 14:11

ClientDataSet records into SQLite table - HOW?

Post by w.weiss » Fri 24 May 2019 09:20

Hello!

I want to copy (insert) all the records from a TClientDataSet into a TUniTable (SQLite).
Data structure is the same of both sources.

Currently I am looping row by row, column by column and insert each value manually.
So is there a better (faster) way? I just need to transfer the data 1:1 into the target table (target table is empty).

Any ideas??

MaximG
Devart Team
Posts: 1822
Joined: Mon 06 Jul 2015 11:34

Re: ClientDataSet records into SQLite table - HOW?

Post by MaximG » Fri 24 May 2019 16:02

To solve your task, you can use the CRBatchMove class that comes with our components: https://www.devart.com/unidac/docs/deva ... chmove.htm
For example :

Code: Select all

uses CRBatchMove;
...
var
  crBatchMove: TCRBatchMove;
  CDS : TClientDataSet;
  UniQuery : TUniQuery;
begin
  ...
  crBatchMove := TCRBatchMove.Create(nil);
  try
    crBatchMove.Source := CDS;
    crBatchMove.Destination := UniQuery;
    crBatchMove.Execute;
  finally
    crBatchMove.Free;
  end;
end;

Post Reply