Relational database model built in C++, written as a learning project.
Eggshell could support concurrent read and write operations. It utilizes a readers-writer lock.
It could also support atomicity, as previous pages are logged before they are modified.
The project includes two basic SQL commands,
INSERT INTO table_name VALUES (value1, value2, ...);
SELECT column1, column2 FROM table_name;
The library is broken down into two sections, compiler
and storage
, where the compiler
composes inputs into
commands and storage
is responsible for storing data.
Must have C++-17 installed along with CMake.
Before the first build, run
cmake -S . -B ./build
To build, run
cmake --build build
To run the REPL, first create an empty file, e.g., touch example.db
, then run
build/repl example.db
Some features to be implemented in the future are
JOIN
clauses- Immutable B+ tree for complete atomic transactions
- Distributed database
- Error system (for now, we are just using
exit
on failure)
eggshell uses Google Test, which is simple to configure and run. To test, run the following command after building:
ctest --test-dir build
or alternatively,
build && ctest
To run a specific test, do
build/{TEST_FILE_NAME}
If intellisense is having trouble finding gtest, make sure to add the gtest onto the include path.
For VSCode, c_cpp_properties.json
should have something like the following
{
"configurations": [
{
"includePath": [
"${workspaceFolder}/_deps/googletest-src/googletest/include"
],
}
]
}
As someone who had no previous knowledge of databases, I have used numerous resources for this project that I would love to share.
Let's Build a Simple Database (C)