wattlebirdaz / simpledb

A C++ version of SimpleDB originally written in Java by Edward Sciore. The structure of SimpleDB is explained in detail in the book Database Design and Implementation.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

simpledb

A C++ version of SimpleDB originally written in Java by Edward Sciore. The structure of SimpleDB is explained in detail in the book Database Design and Implementation.

About The Project

Gif

simpledb is a database engine that can handle a subset of SQL. The following is the examples of commands which can be accepted by simpledb.

  • select F1, F2 from T1, T2 where F3=F4
  • insert into T(F1, F2, F3) values ('a', 'b', 'c')
  • delete from T where F1=F2
  • update T set F1='a' where F1=F2
  • create table T(F1 int, F2 varchar(9))
  • create view V as select F1, F2 from T1, T2 where F3=F4
  • create index I on T(F)

The list of major features mentioned by the book and whether it has been implemented in this project are shown in the following table.

Book Chapter Feature Implemented
3 File Manager ✔️
4 Log Manager ✔️
4 Buffer Manager ✔️
5 Recovery Manager ✔️
5 Concurrency Manager ✔️
5 Transaction ✔️
6 Record Pages ✔️
6 Table Scans ✔️
7 Metadata Manager ✔️
8 Select Scans, Project Scans, Product Scans ✔️
9 Parser ✔️
10 Planner ✔️
11 Embedded JDBC Interface ✔️
11 Remote JDBC Interface
12 Static Hash Indexes ✔️
12 Btree Indexes ✔️
13 Materialization and Sorting ✔️
14 MultiBuffer Sorting/Product ✔️
15 Query Optimization ✔️

Currently the only major feature mentioned but has not been implemented is the Remote JDBC Interface. (This is due to the difference between Java and C++. Java has RMI (Remote Method Invocation) which allows to implement remote server easily, on the other hand in C++, since there are no standard libraries for remote procedure calls, it becomes more complex to implement it.)

Getting Started

Build

Clone this repository.

mkdir build
cd build
cmake ..
make

Then the executables will be generated in the build/bin folder.

Usage

cd build/bin

To create a sample database with student records, run

./createstudentdb

This will create some tables which will be stored in root:password@localhost folder. To see the records, run

./server
Connect> root:password@localhost
SQL> select sid, sname, majorid, gradyear from student
SQL> select did, dname from dept
SQL> select sid, sname, gradyear, dname from student, dept where did = majorid

To run tests, run

./simpledb_test

About

A C++ version of SimpleDB originally written in Java by Edward Sciore. The structure of SimpleDB is explained in detail in the book Database Design and Implementation.


Languages

Language:C++ 88.8%Language:Python 6.8%Language:CMake 4.5%