fpdbfexport: what changed
Revision 0 to 1. Removed lines have a minus sign; added lines have a plus sign.
Title: fpdbfexport
| Old | New | Line | |
|---|---|---|---|
| 1 | + | ## Overview | |
| 2 | + | ||
| 3 | + | ### FPC | |
| 4 | + | ||
| 5 | + | The fpdbfexport module is part of [[fpDBExport]] in the FreePascal FCL database modules. | |
| 6 | + | ||
| 7 | + | This export module provides export to DBF formats (e.g. DBase IV format). The format is still fairly popular because it is simple, and - opposed to e.g. [[CSV]] - is clear about what data type is enclosed in its fields. Many spreadsheet and database programs can import DBF files. | |
| 8 | + | ||
| 9 | + | ### Lazarus | |
| 10 | + | ||
| 11 | + | In Lazarus, the DBF export component is located on the *Data Export* tab. | |
| 12 | + | ||
| 13 | + |  | |
| 14 | + | ||
| 15 | + | ## Limitations and known bugs | |
| 16 | + | ||
| 17 | + | In FPC before 2.6.4/Lazarus before 1.2.2, exporting to e.g. dbase IV format - that has a 10 character field length limit - of fields with longer field names will throw an error unless you populate the export fieldname mapping yourself. | |
| 18 | + | ||
| 19 | + | ## Example | |
| 20 | + | ||
| 21 | + | See the examples in your FPC source directory \$(fpcdir)\source\packages\fcl-db\tests (see [[Databases|Databases#Running_FPC_database_tests]]), specifically testdbexport.pas. | |
| 22 | + | ||
| 23 | + | The various export formats are run in | |
| 24 | + | ||
| 25 | + | - TestDBFExport_DBaseIV | |
| 26 | + | - TestDBFExport_DBaseVII | |
| 27 | + | - TestDBFExport_FoxPro | |
| 28 | + | - TestDBFExport_VisualFoxpro | |
| 29 | + | ||
| 30 | + | etc. | |
| 31 | + | ||
| 32 | + | The procedure TTestDBExport.GenericExportTest shows how you can export to only supported field types (handy if you do not know in advance what field types are used in a dataset). | |
| 33 | + | ||
| 34 | + | Another useful example is the the dbftool example included in FPC 2.6.4+: | |
| 35 | + | ||
| 36 | + | - creating DBF files | |
| 37 | + | - using DBF files | |
| 38 | + | - exporting data (to DBF and other formats) using db export | |
| 39 | + | ||
| 40 | + | The source is also downloadable via <http://svn.freepascal.org/svn/fpc/trunk/packages/fcl-db/examples/> | |
| 41 | + | ||
| 42 | + | ## See also | |
| 43 | + | ||
| 44 | + | - [[Lazarus Tdbf Tutorial]] Tutorial and documentation on TDBF, the DBF support in FPC SQLDB (which is also used in Lazarus). Link to official TDBF documentation. | |
| 45 | + | - [[fpDBExport]] | |
| 46 | + | - [[fpXMLXSDExport]] Similar module that exports to various XML formats. | |
| 47 | + | ||
| 48 | + | --- | |
| 49 | + | *From the Free Pascal wiki, page "fpdbfexport", as it stood on 2017-06-30 after a change by E-ric, 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).* |
