Skip to content

hemonserrat/libdbase3

Repository files navigation

libdbase3

libdbase3 is a C++17 DBASE III+ compatible database engine. It provides a static library, dBASE III .NDX index support, test executables, and small tools for working with legacy DBF data.

The project keeps the file format stable while modernizing the implementation with RAII, standard containers, fixed-width public types, and Result<T> error handling.

Features

  • DBASE III+ file compatibility.
  • dBASE III .NDX indexes for lookup and ordered traversal.
  • Text database support through TextDatabase.
  • Text, number, date, boolean, and memo fields.
  • CMake package and pkg-config install metadata.
  • Catch-based test suite.

Requirements

  • CMake 3.16 or newer.
  • A C++17 compiler.

Build and Test

cmake -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build
ctest --test-dir build --output-on-failure

For focused work:

cmake --build build --target dbase3_test
./build/dbase3_test

Install

cmake --install build --prefix /usr/local

Installed consumers can use either CMake:

find_package(libdbase3 CONFIG REQUIRED)
target_link_libraries(my_program PRIVATE libdbase3::dbase3)

or pkg-config:

c++ -std=c++17 main.cpp $(pkg-config --cflags --libs libdbase3)

See INSTALL.md for details.

Example

#include <library.hpp>

using namespace dbase;

int main()
{
    auto table_result = open_table("people.dbf", DatabaseFormat::dbase3);
    if (table_result.failed()) {
        return 1;
    }

    TableHandle table = table_result.value();

    if (is_new(table)) {
        create_field(table, "NAME", FieldType::text, 30);
        create_field(table, "AGE", FieldType::number, 3);
    }

    auto record_result = create_record_buffer(table);
    if (record_result.failed()) {
        close_table(table);
        return 1;
    }

    RecordHandle record = record_result.value()->id;
    FieldHandle name = get_field_handle(table, "NAME").value();
    FieldHandle age = get_field_handle(table, "AGE").value();

    put_text(record, name, "Ada Lovelace");
    put_number(record, age, 36.0);
    save_record(record);

    delete_record_buffer(record);
    close_table(table);
    return 0;
}

The tools/demo.cpp program contains a longer end-to-end example.

Repository Layout

inc/       public and internal headers
src/       library implementation
test/      Catch-based test suites
tools/     demo and inspection utilities

Documentation

  • CHANGELOG.md: release history.
  • ERROR_HANDLING_GUIDE.md: Result<T> and error patterns.
  • CONTRIBUTING.md: patch guidelines.

License

Copyright (C) 1996-2026 Hernan Monserrat.

libdbase3 is free software under the GNU General Public License, version 3 or later. See LICENSE.

About

DBASE III+ compatible database engine with B-tree indexing support.

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors