This is the repo for FDU 2022 - Introduction to Database - Project 2 - MyJQL
MyJQL is a simplified redis-like key-value database, which supports three kinds of operations: get key
, set key value
, and del key
. B-Tree index is automatically created for key
.
include
andsrc
: Core implementation of MyJQL.driver
: Header and source for MyJQL driver. After compilation, you can include myjqlclient.h and link myjqlclient.lib (in Windows) or libmyjqlclient.a (in Linux). In this way, your own program will be able to store data to and retrieve data from MyJQL.main
:myjqlserver.c
is the server.myjqlshell.cpp
is the client, which also serves as an example utilizing the driver.test
: Tests for core implementation.test_myjql.cpp
is used to examine the full functionality.
MyJQL supports Windows and Linux (Ubuntu).
Shell/CMD/PowerShell (in the root directory of this repo):
mkdir build
cd build
cmake ..
cmake --build .
MSVC:
cmake --build . --config Release
gcc:
cmake .. -DCMAKE_BUILD_TYPE=Release
Change directory into build/test
(if you are currently in build
):
cd test
List tests:
ctest -N
Run tests:
-
MSVC:
ctest -C Debug ctest -C Release
-
gcc:
ctest
- Start the server:
myjqlserver
. - Start several clients:
myjqlshell
. - Input commands to the clients:
set key value
: setkey
tovalue
.get key
: get value based onkey
.del key
: delete value based onkey
.exit
: exit the client shell.
- To safely stop the server:
- Use
ctrl + c
in Windows and Linux. - In Windows, you also can close it directly.
- Use