DBFLibDBF and FPT files for Ring

Introduction#

A pure-Ring library for reading, writing, and maintaining Visual FoxPro .dbf database files and their companion .fpt memo files.

DBFLib gives Ring programs full read/write access to Visual FoxPro .dbf and .fpt files. It handles the complete file lifecycle: creating tables, appending and updating records, soft-deleting and recalling, packing (physical removal of deleted records), and compacting memo files to reclaim orphaned FPT blocks.

All field types — including memo fields — are accessed through the same uniform API. fieldGet(), fieldPut(), and replace() work identically on character, numeric, logical, date, integer, and memo fields. The library handles FPT file I/O transparently; no special memo functions are needed for normal use.

Files produced by the library open correctly in Visual FoxPro and any other tool that reads the Visual FoxPro file format.

File format compatibility#

FeatureSupport
Visual FoxPro .dbf (no memo)Read / Write
Visual FoxPro .dbf + .fpt (with memo)Read / Write
VFP binary memo block pointersYes
VFP 263-byte backlink areaYes
FPT 64-byte block sizeYes
Code page / language driver byteYes
Deletion flag byteYes
EOF marker (0x1A)Yes

Known limitations#

No FPT block reuse on write. Every call to replace() (or memoWrite()) on a memo field appends a new block to the FPT file. The previous block becomes orphaned. Call pack() or packFpt() periodically to reclaim the space.

No index file support. locate() and locateNext() always perform a full sequential scan. For keyed random access on large tables, build an in-memory index from toList().

No transaction support. Each navigation call or close() writes the current record directly to disk with no rollback capability.

Date fields are strings. Date values are stored and returned as 8-character YYYYMMDD strings. The library does not validate, convert, or compute dates.

Single-user access. The library does not implement multi-user locking.

Where to go next#

License#

MIT License.

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