Coder Social home page Coder Social logo

mini-db's Introduction

File Format:

There are 2 files:
<name>.meta - This stores the table metadata for the database
<name>.db - This stores the row information for the database

Each row is has a pack/unpack function for serialization. They are self contained, and support generics.
The structs are written to memory first before being written to the disk.


Table Struct Packing:
table size|name|field types|address of first row

Row Struct Packing:
row size|field types|fields

Strings are contained both ways, with preceeding sizes and a null terminator.

Requirements:
CMake (version 3.13 or above), GCC

Running:
Create a directory `build/` inside the root folder and `cd` into it. Run `cmake ..` followed by `make`.

A few demo SQL queries are present in test_sql.sql

NOTES:
I'm sorry this code isn't well commented. I spent a lot of time working with it and still had to finish a big part of it on Sunday.

However, I am glad the database works as I wanted to and has a lot of error checking, especially in the SQL syntax. Check out the lexer and parser for some LL(1) fun.

mini-db's People

Contributors

anishbasu avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.