From Free Pascal wiki
Jump to: navigation, search

English (en) français (fr)

lazdbexport is a package that supplies components to facilitate database export. It is delivered with lazarus and may be installed by using [Package|Install/Uninstall packages]. After install the components are accessible via the Data Export tab. It provides a template class for descendants that can provide export of datasets. Also included are various ready-made descendants for:

icon Component Description
tcsvexporter.png TCSVExporter CSV
tfixedlengthexporter.png TFixedlengthExporter Fixed length
tsqlexporter.png TSQLExporter SQL
txmlxsdexporter.png TXMLXSDExporter XML/XSD
tsimplexmlexporter.png TSimpleXMLExporter XML
tsimplejsonexporter.png TSimpleJSONExporter json
tfpdbfexport.png TFPDbfExport dbf
ttexexporter.png TTeXExporter TeX
trtfexporter.png TRTFExporter RTF
tstandardexportformats.png TStandardExportFormats
tfpdataexporter.png TFPDataExporter

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


There is no corresponding import to dataset code in FPC/Lazarus, but there is third party code like dbimport (, directory dbimport).

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

Another form of import is the use of TSQLScript; an exported database with TSQLExporter can be imported with the use of TSQLScript.


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