A tiny and dummy database built by myself.
tinydb
is the simplest prototype of database, it only contains ONE table (seetable_t
androw_t
in source filetypes.h
), whose schema isid(uint32_t), username(string), email(string)
.id(int)
is the primary key of our table, we will implement index via B+Tree.
This project is inspired by sqlite.
Interface
SQL Command
Processor
Virtual Machine
B-Tree
Pager
OS Interface
Tokenizer
Parser
Code
Generator
Utilities
Test Code
Core
Backend
SQL Compiler
Accessories
This project has only one .c
file. And you can build it by:
$ make run
And it will enter our REPL (Read, Evaluate, Print, Loop) program:
tinydb > insert 1 1 1
Executed.
tinydb > insert 2 2 2
Executed.
tinydb > insert 3 3 3
Executed.
tinydb > update 1 a a
Executed.
tinydb > delete 3
Executed.
tinydb > select
(1, a, a)
(2, 2, 2)
total 2 rows
Executed.
tinydb >
From so far, tinydb
supports these sql statement:
insert
select
delete
update
commit
rollback
And it also support some meta commands (for debugging):
.help
.exit
.constants
.btree
$ bundle exec rspec