A DBMS implemented for Xidian University‘s compiler course.
To get the third party dependencies(via source code), run:
git submodule init
git submodule update
Install the following libraries on your computer
# required by rocksdb
sudo apt-get install libgflags-dev libzstd-dev libsnappy-dev zlib1g-dev libbz2-dev liblz4-dev
# required by protobuf
sudo apt-get install libprotobuf-dev protobuf-compiler
- Expression evaluation(Nested)
- SQL comment
NOT NULL
column constraint- Datatype:
INT
,FLOAT
,CHAR(N)
- Multi-line support
- sql file execution
- Line editing and sql history
- Select multiple tables
- Based on persistent key-value storage(built upon LSM-Tree)
CREATE DATABASE example;
USE example;
CREATE TABLE user (id int);
SHOW TABLES;
INSERT INTO user (id NOT NULL) VALUES (1);
SELECT id from user WHERE id = 42;
UPDATE user SET id=1 WHERE id=42;
DELETE FROM user WHERE id=42;
SELECT * from user where id=(1+2*2+(id=id)+id^id+id) AND id = id%2 AND id IS NOT NULL;
select * from t1 where id is not null;
DROP TABLE user;
More details in test.sql:
use test;
select * from test.table1,table1;-- duplicated table (It is correctly checked)
mkdir build
cd build
cmake ..
make -j4
File | Description |
---|---|
include/* | all the header files |
sql/* | intermediate representation(IR) for SQL |
executor/* | execute SQL IR |
executor/processor/* | processor for SQL expression(visitor pattern) |
parser/sql.l | lexical analysis for SQL(flex) |
parser/sql.y | syntax analysis for SQL(bison) |
third_party/* | third party dependencies, e.g., googletest, rocksdb |
test/* | unit test |
docs/* | documentation for the project |
Start xDB interactive shell (interactive mode)
# Assuming you are in build directory
./xDB