lazdbexport: what changed
Revision 0 to 1. Removed lines have a minus sign; added lines have a plus sign.
Title: lazdbexport
| Old | New | Line | |
|---|---|---|---|
| 1 | + | **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: | |
| 2 | + | ||
| 3 | + | | icon | Component | Description | | |
| 4 | + | |----|----|----| | |
| 5 | + | |  | [[TCSVExporter]] | CSV | | |
| 6 | + | |  | [[TFixedlengthExporter]] | Fixed length | | |
| 7 | + | |  | [[TSQLExporter]] | SQL | | |
| 8 | + | |  | [[fpXMLXSDExport|TXMLXSDExporter]] | XML/XSD | | |
| 9 | + | |  | [[TSimpleXMLExporter]] | XML | | |
| 10 | + | |  | [[TSimpleJSONExporter]] | json | | |
| 11 | + | |  | [[fpdbfexport|TFPDbfExport]] | dbf | | |
| 12 | + | |  | [[TTeXExporter]] | TeX | | |
| 13 | + | |  | [[TRTFExporter]] | RTF | | |
| 14 | + | |  | [[TStandardExportFormats]] | | | |
| 15 | + | |  | [[TFPDataExporter]] | | | |
| 16 | + | ||
| 17 | + | 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]] | |
| 18 | + | ||
| 19 | + | ## Import | |
| 20 | + | ||
| 21 | + | 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). | |
| 22 | + | ||
| 23 | + | DbImport is used in the [LazSQLX](http://lazsqlx.wordpress.com/) and [TurboBird](http://code.sd/products/turbobird/) database management tools for importing CSV (like) data into datasets. | |
| 24 | + | ||
| 25 | + | Another form of import is the use of [[TSQLScript]]; an exported database with [[TSQLExporter]] can be imported with the use of [[TSQLScript]]. | |
| 26 | + | ||
| 27 | + | ## Example | |
| 28 | + | ||
| 29 | + | See the examples in your FPC source directory \$(fpcdir)\source\packages\fcl-db\tests (see [[Databases|Running FPC database tests]]), specifically testdbexport.pas. | |
| 30 | + | ||
| 31 | + | Following is a simplest form of using TCSVExporter. **fpcsvexport** must be included in uses clause. | |
| 32 | + | ||
| 33 | + | ` if SaveDialog1.Execute then `\ | |
| 34 | + | ` with TCSVExporter.Create(nil) do begin`\ | |
| 35 | + | ` Dataset:= BufDataSet1;`\ | |
| 36 | + | ` FileName:= SaveDialog1.FileName;`\ | |
| 37 | + | ` Execute;`\ | |
| 38 | + | ` Free;`\ | |
| 39 | + | ` end;` | |
| 40 | + | ||
| 41 | + | --- | |
| 42 | + | *From the Free Pascal wiki, page "lazdbexport", as it stood on 2021-08-16 after a change by Egsuh, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's [[Licensing]] page. If you have concerns about this material, [message the admin](/wiki-contact).* |
