[fpc-pascal] DBF Field name length and fpdbfexport

Reinier Olislagers reinierolislagers at gmail.com
Fri Sep 2 12:00:16 CEST 2011

Hi all,

If I Googled correctly, the following field size limits are present for
the various DBase formats:
3: DBase III: 10 characters
4: DBase IV: 10 characters
7: DBase VII: 32 characters
8: FoxPro: 10 characters

3,4: http://www.clicketyclick.dk/databases/xbase/format/dbf.html#DBF_STRUCT

7: IIRC, from http://www.dbase.com/KnowledgeBase/int/db7_file_fmt.htm
(forwarded by Wikipedia), but that page is down now

Apparently Visual FoxPro 8 has 27 characters in a DBC (Database
container) file, but only 10 in a DBF file.

Is that correct?
The reason I ask:

In packages\fcl-db\src\export\fpdbfexport.pp
These tablelevels/formats are defined:
  TTableFormat = (tfDBaseIII,tfDBaseIV,tfDBaseVII,tfFoxPro);

In function
function TFPCustomDBFExport.BindFields: Boolean;
there is this part (line 136):
  If FormatSettings.AutoRenameFields and
(FormatSettings.TableFormat=tfDbaseIII) then

1. Shouldn't this be amended to (don't know if you can use in in this way):
  If FormatSettings.AutoRenameFields and (FormatSettings.TableFormat in
[tfDbaseIII,tfDbaseIV,FoxPro]) then

Characters allowed seem to be for standard Xbase DBF tables that are
compatible with CA-Clipper DBF tables, Microsoft FoxPro DBF tables, and
dBASE III+ DBF tables:

may only contain the letters ‘a’-‘z’ and ‘A’-‘Z’, digits ‘0’-‘9’, and
the underscore ‘_’ character

Presumably the CheckExportFieldNames could be amended for that, too, right?


More information about the fpc-pascal mailing list