A lightweight, file-based database engine written in C++. This project implements a simple in-memory database with persistent storage capabilities.
This database engine provides a straightforward way to store, retrieve, and manage information records. It features an in-memory data structure with file persistence, making it suitable for small to medium-sized datasets.
Database/
├── information.h # Information class declaration
├── information.cpp # Information class implementation
├── database.h # Database class declaration
├── database.cpp # Database class implementation
├── data/
│ └── data.frm # Database storage file
├── test/
│ ├── testDatabase.cpp # Database test cases
│ └── testInformation.cpp # Information test cases
├── CMakeLists.txt # CMake build configuration
└── README.md # This file
Represents an individual record with the following attributes:
- ID: Unique identifier (auto-assigned)
- First Name: Person's first name
- Last Name: Person's last name
- Age: Person's age
- Email: Person's email address
setFirstName(string)/firstName(): Set/get first namesetLastName(string)/LastName(): Set/get last namesetAge(int)/age(): Set/get agesetEmail(string)/email(): Set/get emailsetId(int)/id(): Set/get IDdisplay(): Display information record
Manages a collection of information records with the following operations:
addInformation(firstName, lastName, age, email): Add a new record to the databasegetinformation(lastName): Retrieve a record by last namedisplayAll(): Display all records in the databasewrite(): Persist database to fileread(): Load database from file
- C++ compiler with C++11 support (g++, clang++, MSVC)
- Standard C++ library
- CMake 3.10 or higher (optional, but recommended)
CMake provides a cross-platform build system that works on Windows, Linux, and macOS.
# Configure the build (first time or when CMakeLists.txt changes)
cmake -B build
# Build the project
cmake --build build
# Run tests
cd build && ctest --verboseOr on Windows with PowerShell:
# Configure and build
cmake -B build
cmake --build build
# Run tests
cd build; ctest --verboseThe executables will be in the build directory (or build/Debug on Windows with MSVC).
If you prefer not to use CMake, you can compile manually:
# Using g++
g++ -o test/testDatabase test/testDatabase.cpp database.cpp information.cpp -std=c++11
# Using clang++
clang++ -o test/testDatabase test/testDatabase.cpp database.cpp information.cpp -std=c++11
# On Windows with MSVC
cl /EHsc /Fetest\testDatabase.exe test\testDatabase.cpp database.cpp infomation.cpp- Working on implamenting a deletion method
- Working on creating a query scripts
This project is under the MIT License. See LICENSE for more information.