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#
| Feature | Support |
|---|---|
Visual FoxPro .dbf (no memo) | Read / Write |
Visual FoxPro .dbf + .fpt (with memo) | Read / Write |
| VFP binary memo block pointers | Yes |
| VFP 263-byte backlink area | Yes |
| FPT 64-byte block size | Yes |
| Code page / language driver byte | Yes |
| Deletion flag byte | Yes |
| 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#
- Getting started: install and the first table.
- Field types and constants: the field types, the constants and the field definitions.
- Complete example: create, fill, search, update, export, pack and close a table.
- Samples: the 3 programs of the package.
- API reference: Files, navigation and fields, Records, memos, maintenance and export, Error handling and code pages.
License#
MIT License.