Difference between revisions of "lazdbexport"
(9 intermediate revisions by 4 users not shown) | |||
Line 1: | Line 1: | ||
− | + | {{lazdbexport}} | |
− | {| class=" | + | '''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: | |
+ | |||
+ | {| class="wikitable sortable" | ||
+ | ! icon || Component || Description | ||
|- | |- | ||
− | | [[ | + | | [[image:tcsvexporter.png]] || [[TCSVExporter]] || CSV |
|- | |- | ||
− | | [[TFixedlengthExporter]] | + | | [[image:tfixedlengthexporter.png]] || [[TFixedlengthExporter]] || Fixed length |
|- | |- | ||
− | | [[TSQLExporter]] | + | | [[image:tsqlexporter.png]] || [[TSQLExporter]] || SQL |
|- | |- | ||
− | | [[ | + | | [[image:txmlxsdexporter.png]] || [[fpXMLXSDExport|TXMLXSDExporter]] || XML/XSD |
|- | |- | ||
− | | [[ | + | | [[image:tsimplexmlexporter.png]] || [[TSimpleXMLExporter]] || XML |
|- | |- | ||
− | | [[ | + | | [[image:tsimplejsonexporter.png]] || [[TSimpleJSONExporter]] || json |
|- | |- | ||
− | | [[ | + | | [[image:tfpdbfexport.png]] || [[fpdbfexport|TFPDbfExport]] || dbf |
|- | |- | ||
− | | [[ | + | | [[image:ttexexporter.png]] || [[TTeXExporter]] || TeX |
|- | |- | ||
− | | [[ | + | | [[image:trtfexporter.png]] || [[TRTFExporter]] || RTF |
|- | |- | ||
− | | [[ | + | | [[image:tstandardexportformats.png]] || [[TStandardExportFormats]] || |
|- | |- | ||
− | | [[ | + | | [[image: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#Dataset export |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 [http://lazsqlx.wordpress.com/ LazSQLX] and [http://code.sd/products/turbobird/ 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]]. | ||
+ | |||
+ | == Example == | ||
+ | See the examples in your FPC source directory $(fpcdir)\source\packages\fcl-db\tests (see [[Databases#Running_FPC_database_tests|Running FPC database tests]]), specifically testdbexport.pas. | ||
+ | |||
+ | Following is a simplest form of using TCSVExporter. '''fpcsvexport''' must be included in uses clause. | ||
+ | |||
+ | if SaveDialog1.Execute then | ||
+ | with TCSVExporter.Create(nil) do begin | ||
+ | Dataset:= BufDataSet1; | ||
+ | FileName:= SaveDialog1.FileName; | ||
+ | Execute; | ||
+ | Free; | ||
+ | end; |
Latest revision as of 11:50, 16 August 2021
│
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 | CSV | |
TFixedlengthExporter | Fixed length | |
TSQLExporter | SQL | |
TXMLXSDExporter | XML/XSD | |
TSimpleXMLExporter | XML | |
TSimpleJSONExporter | json | |
TFPDbfExport | dbf | |
TTeXExporter | TeX | |
TRTFExporter | RTF | |
TStandardExportFormats | ||
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
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.
Another form of import is the use of TSQLScript; an exported database with TSQLExporter can be imported with the use of TSQLScript.
Example
See the examples in your FPC source directory $(fpcdir)\source\packages\fcl-db\tests (see Running FPC database tests), specifically testdbexport.pas.
Following is a simplest form of using TCSVExporter. fpcsvexport must be included in uses clause.
if SaveDialog1.Execute then with TCSVExporter.Create(nil) do begin Dataset:= BufDataSet1; FileName:= SaveDialog1.FileName; Execute; Free; end;