[yunqa.de] Re: DISQLite3DatasetImporter

  • From: Delphi Inspiration <delphi@xxxxxxxx>
  • To: yunqa@xxxxxxxxxxxxx
  • Date: Fri, 02 May 2014 10:50:52 +0200

On 01.05.2014 16:31, Alfred Vink wrote:

I need to convert some databases, is there a DatasetImporter example or
demo somewhere ?

Usage is really simple, I do not think that a demo project is necessary.

However, I have extended the TDISQLite3DataSetImporter class documentation as follows. It now contains a code snippet as a working example.

Please find the new text below. It will be part of the next version's DISQLite3 documentation. Let me know if you find something missing.

Ralf

-----------------------

class TDISQLite3DataSetImporter

Syntax:    type TDISQLite3DataSetImporter = class(TComponent)
Hierarchy: TDISQLite3DataSetImporter > TComponent

Description:

Import data from a TDataSet instance into a DISQLite3 database.

Point DataSet to the TDataSet instance from which to import data.

Use Database and TableName to specify where to store the TDataSet data. If a table with that name does not yet exists, it is created. An existing table is dropped and recreated.

After setting up all properties, call Execute to import the data.

Depending on the size of the data, the import take some time. The OnStateChange and OnProgress events are available to track import progress.

Here is an example:

procedure ImportDataset(
  const Database: TDISQLite3Database;
  const DataBase: TDataSet;
  const TableName: UnicodeString
var
  Importer: TDISQLite3DataSetImporter;
begin
  Importer := TDISQLite3DataSetImporter.Create(nil);
  try
    Importer.Database := Database;
    Importer.DataSet := DataSet;
    Importer.TableName := TableName;
    Importer.Execute;
  finally
    Importer.Free;
  end;
end;
_______________________________________________
Delphi Inspiration mailing list
yunqa@xxxxxxxxxxxxx
//www.freelists.org/list/yunqa



Other related posts: