A self-taught project exploring database design using C with Catch2 testing framework.
Still need lots of refactor and performance optimization
All Support commands:
help:
exit:
create:
Create sub-commands:
- database <database name>
- table <table name> (<column name> <column type> ...)
use:
<database name>
delete:
<database name>
select:
select <column_names> from <table_name> (where <condition> ...)
insert:
insert <table_name> values <value1,value2,value3,...>
- Docker
- Build Docker Image
./scripts/build_docker_image.sh
- Run Docker Container
./scripts/run_docker_container.sh
- Build Project (compile with 8 cores)
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Release ..
cmake --build . --config Release -- -j 8
- Execute
./simple_database
create database test_db
Result:
create database test_db
Create database at: ../DB_DATA/test_db/test_db.json
use test_db
Results:
use test_db
Using database: test_db
create table test_table name STRING age INT height FLOAT
- with column name
name
,age
,height
Results:
create table test_table name STRING age INT height FLOAT
Create table at: ../DB_DATA/test_db/test_table.csv
insert test_table values John 30 170
insert test_table values Jane 25 165
insert test_table values Alice 28 180
insert test_table values Bob 31 173
insert test_table values Charlie 29 160
select name,age from test_table where age < 29 and ( name = Jane or name = Alice )
Results:
name,age
Jane,25
Alice,28
delete database test_db
Results:
Delete database: ../DB_DATA/test_db/test_db.json
Delete table: ../DB_DATA/test_db/test_table.csv
exit
Results:
Bye Bye
./tests/tests_run