fpDBExport

From Lazarus wiki
Revision as of 16:04, 15 November 2014 by BigChimp (talk | contribs) (Import)

Overview

fpdbexport lets you export datasets to various formats.

FPC

fpdbexport is part of the FreePascal FCL database modules.

It provides a template class for descendants that can provide export of datasets. Also included are various ready-made descendants for:

  • CSV format
  • DBF format; see fpdbfexport
  • Fixed with text files
  • RTF/rich text format
  • Simple JSON
  • Simple XML format
  • SQL insert statements
  • TeX format
  • Various XML formats; see fpXMLXSDExport

Extensibility

As indicated, developers can write their own export classes using the fpdbexport framework. An example of this is the Excel/spreadsheet format exporter in FPSpreadsheet

Import

There is no corresponding import to dataset code in FPC/Lazarus, but there is third party code like dbimport (https://bitbucket.org/reiniero/smalltools/src, directory dbimport).

DbImport is used in the LazSQLX and TurboBird database management tools for importing CSV (like) data into datasets.

Lazarus

In Lazarus, the export components are not installed by default. Installation gives a Data Export tab.

DataExportTab.png


Example

See the examples in your FPC source directory $(fpcdir)\source\packages\fcl-db\tests (see Databases#Running_FPC_database_tests), specifically testdbexport.pas.

See also