BreezeDB is a lightweight, modern C++ in-memory relational database designed for learning, prototyping, and rapid experimentation. It features a simple SQL-like interface, modular architecture, and robust error handling.
| Component | Responsibility |
|---|---|
Database |
Manages all tables and orchestrates SQL statement execution |
Table |
Stores schema and row data for each table |
Row |
Represents a single record in a table |
Parser |
Converts SQL-like strings into executable statement objects |
Statement |
Abstract base for all SQL operations (CREATE, INSERT, SELECT, etc.) |
- All data is stored in memory (no persistence)
- SQL commands are parsed and mapped to C++ objects
- Supports basic relational operations, conditions, and inner joins
- Modular & Extensible: Each SQL command is implemented as a separate Statement class, making it easy to add new features.
- Polymorphic Execution: All statements inherit from a common interface and are executed via a unified method.
- Robust Error Handling: Invalid SQL or operations throw clear exceptions.
- Test Coverage: Core functionality is covered with Catch2 unit tests.
- Written in modern C++20
- In-memory only (no disk persistence)
- SQL-like syntax for ease of use
- Supports WHERE, AND, OR, and INNER JOIN operations
Compile the main program from the src directory:
g++ -std=c++20 -I../include *.cpp statements/*.cpp -o main
# Then
./src/mainRun tests
g++ -std=c++20 -Wall -Wextra -Iinclude tests/test_breezedb.cpp src/Database.cpp src/Parser.cpp src/Row.cpp src/Table.cpp src/Condition.cpp src/statements/*.cpp -o tests/test_breezedb
# Then
./tests/test_breezedbrm -rf build
# CMake
cmake -S . -B build
cmake --build build && ctest --test-dir build --output-on-failureCREATE TABLE users (id int, name str, age int);
INSERT INTO users (id, name, age) VALUES (1, "Ali", 25), (2, "Veli", 30), (3, "Ayşe", 28);
SELECT * FROM users;
UPDATE users SET age = 26 WHERE name = "Ali";
SELECT * FROM users;
DELETE FROM users WHERE id = 2;
SELECT * FROM users;
-- CONDITIONS
SELECT * FROM users WHERE age >= 25;
SELECT * FROM users WHERE age <= 28;
SELECT * FROM users WHERE age > 20 AND age < 30;
SELECT * FROM users WHERE name != "Ali" OR age = 30;
-- INNER JOIN
CREATE TABLE users (id int, name str);
CREATE TABLE orders (id int, user_id int, amount int);
INSERT INTO users (id, name) VALUES (1, "Ali"), (2, "Veli");
INSERT INTO orders (id, user_id, amount) VALUES (1, 1, 100), (2, 1, 200), (3, 2, 300);
SELECT users.name, orders.amount FROM users INNER JOIN orders ON users.id = orders.user_id;| id | name | age |
|---|---|---|
| 1 | Ali | 25 |
| 2 | Veli | 30 |
| 3 | Ayşe | 28 |
MIT License © 2025