DBFLibDBF and FPT files for Ring

Error handling and code pages

How errors are reported, and the code page constants and names.

Error Handling#

All errors are raised using Ring's raise() mechanism. Wrap calls in try / catch / done blocks to handle them:

Ring
try
    oDbf.open("missing.dbf")
catch
    ? "Could not open file: " + cCatchError
done

Common error messages:

MessageCause
DBFLib Error: Cannot open file: <path>File not found or no read permission
DBFLib Error: Cannot create file: <path>No write permission or invalid path
DBFLib Error: File is read-onlyWrite attempted on a read-only file
DBFLib Error: Field not found: <name>Field name does not exist in the table
DBFLib Error: Field is not a memo field: <name>memoRead()/memoWrite() called on a non-memo field
DBFLib Error: No FPT file openMemo write attempted but FPT could not be found or created
DBFLib Error: Value '...' is too wide for field <name>Numeric value exceeds field width
DBFLib Error: Invalid DBF header (too short)File is corrupt or not a DBF file
DBFLib Error: No fields definedcreate() called with an empty field list
DBFLib Warning: Memo flag set but no FPT foundPrinted (not raised) when no .fpt companion file is found beside the .dbf

Code Page Reference#

Byte[29] values are sourced from Microsoft VFP9 CPZERO.PRG — the official VFP9 utility that writes codepage markers directly into DBF headers. All values have been verified to open silently in VFP9 without triggering the "Select Code Page" dialog (where applicable to the host OS).

Note

Note on OS-dependent codepages: CP1255 (Hebrew) and CP1256 (Arabic) are only shown in the VFP9 codepage dialog on their respective OS locales. A file marked (Hebrew) will open silently on a Hebrew Windows machine; a file marked (Arabic) will open silently on an Arabic Windows machine. The byte values are correct regardless.

Note

UTF-8 is not supported. The DBF format stores text in fixed-width fields; variable-width encodings are incompatible with this structure. For Arabic text use ; for Hebrew use .

No codepage marker#

ConstantValueDescription
C_CODEPAGE_NONE0x00No codepage — VFP will prompt on open

MS-DOS codepages#

ConstantValueDescription
C_CODEPAGE_DOS_4370x01DOS USA
C_CODEPAGE_DOS_8500x02DOS International
C_CODEPAGE_DOS_8520x64DOS Eastern European
C_CODEPAGE_DOS_8650x66DOS Nordic
C_CODEPAGE_DOS_8660x65DOS Russian
C_CODEPAGE_DOS_8610x67DOS Icelandic
C_CODEPAGE_DOS_8570x6BDOS Turkish
C_CODEPAGE_DOS_7370x6ADOS Greek
C_CODEPAGE_DOS_8630x6CDOS French Canadian

Macintosh codepages#

ConstantValueDescription
C_CODEPAGE_MAC_ROMAN0x04Macintosh Roman

Windows codepages#

ConstantValueDescription
C_CODEPAGE_WIN_12520x03Windows Western European (ANSI) (default)
C_CODEPAGE_WIN_8740x7CWindows/DOS Thai
C_CODEPAGE_WIN_12500xC8Windows Central European
C_CODEPAGE_WIN_12510xC9Windows Cyrillic / Russian
C_CODEPAGE_WIN_12530xCBWindows Greek
C_CODEPAGE_WIN_12540xCAWindows Turkish
C_CODEPAGE_WIN_12550x7DWindows Hebrew (Hebrew OS only)
C_CODEPAGE_WIN_12560x7EWindows Arabic (Arabic OS only)
C_CODEPAGE_WIN_12570xCCWindows Baltic

Codepages not supported by VFP9#

The following codepages have no official byte[29] assignment in VFP9 and are not included in the library: CP860 (Portuguese DOS), CP862 (Hebrew DOS), CP864 (Arabic DOS), CP775 (Baltic DOS).

DBFLib - DBF and FPT files for Ring, made with ringdoc.