A C++ DBMS from scratch with included unit testing via GTest.
- Interactive REPL
- Custom memory Pager class for data persistence
- B+ Tree key-value store for efficient lookup and insertion (
git checkout BTree) - Fully supported dynamic data types for tables (WIP)
- Custom tokenizer and parser for SQL-like language (WIP)
Clone the project
git clone https://github.com/melon64/conscious-db.gitGo to the project directory
cd conscious-dbCreate a build directory and build using CMake
mkdir build
cd build
cmake ..
make allRun the tests
cd build/tst
DBMS_tst.exe
Run the REPL
cd build/src
DBMS_run.exeCreate an empty .db file and run the REPL:
DBMS_run.exe [file.db]You should see
db > - C++ compiler (gcc, g++)
Creates a Row object in the Table instantiated by the file supplied, inserts it into the B+ Tree, and serializes it into memory. O(logN) amortized
db > insert 1 user user@gmail.com| Parameter | Type | Description |
|---|---|---|
id |
int |
any number |
username |
string |
32 character length |
email |
string |
255 character length |
Returns all the rows ordered by primary key (id). O(N)
db > select| Parameter | Type | Description |
|---|---|---|
N/A |
N/A |
N/A |
Exits the REPL and writes all serialized memory into the initial .db file. O(N)
db > .exit| Parameter | Type | Description |
|---|---|---|
N/A |
N/A |
N/A |
Formats and prints the underlying B+ Tree key-value storage. O(N)
db > .btree| Parameter | Type | Description |
|---|---|---|
N/A |
N/A |
N/A |
Prints the sizes of the B+ Tree nodes and Row in memory. O(1)
db > .constants| Parameter | Type | Description |
|---|---|---|
N/A |
N/A |
N/A |