Skip to content

LuCC-que/miniDB

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Mini database

ACK

This is a mini database, using B-tree as the index and .db file as presistence, original version(see link below) was writtern in C, this is a re-write version in C++ following the RAII rules, and also using the CMAKE as a building and testing tool

Example

miniDB << "insert 1 user1 [email protected]",
miniDB << "select",
miniDB >> (1 user1 [email protected])

Insert many

you can find this in the tests folder

std::vector<std::string> scripts4{
        "insert 18 user18 [email protected]",
        "insert 1 user1 [email protected]",
        "insert 7 user7 [email protected]",
        "insert 10 user10 [email protected]",
        "insert 29 user29 [email protected]",
        .....
        "insert 13 user13 [email protected]",
        "insert 24 user24 [email protected]",
        "insert 25 user25 [email protected]",
        "insert 28 user28 [email protected]",
        ".btree",
        ....
    };

 Tree:
 - internal (size 3)
   - leaf (size 7)
     - 1
     - 2
     - 3
     - 4
     - 5
     - 6
     - 7
   - key 1
   - leaf (size 8)
     - 8
     - 9
     - 10
     - 11
     - 12
     - 13
     - 14
     - 15
   - key 15
   - leaf (size 7)
     - 16
     - 17
     - 18
     - 19
     - 20
     - 21
     - 22
   - key 22
   - leaf (size 8)
     - 23
     - 24
     - 25
     - 26
     - 27
     - 28
     - 29
     - 30

How to use it?

requirements:

-Linux

-GCC or LLVM

-CMAKE

Instruction:

download the code and open a terminal:

cd code_path/miniDB/src

create a folder call build

mkdir build

set up CMAKE

cmake ..

make and test the code

make
ctest

play with it

./miniDB <nameWhateverYouWant>.db

here are the commands

for insertion:

insert <key> <name> <email>

for selection

select

see the tree

.btree

see configuration

.constants

quit and write to the db

.exit

Orginal post, respect to cstack

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published