Skip to content

sinkinben/tinydb

Repository files navigation

tinydb

Code Grade Code Quality Score

A tiny and dummy database built by myself.

Introdution

  • tinydb is the simplest prototype of database, it only contains ONE table (see table_t and row_t in source file types.h), whose schema is id(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

Build

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

Test

$ bundle install
$ bundle exec rspec

Recommend Readings

About

A tiny and dummy database built by myself.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published