Skip to content
Code reading for sqlite backend
Branch: master
Clone or download
Latest commit a7a7c29 Feb 23, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
core Btree implemetation and tests Nov 25, 2018
test Add move first btree impl Feb 17, 2019
CMakeLists.txt Btree implemetation and tests Nov 25, 2018
LICENSE Create LICENSE Feb 23, 2019
README.md Update README.md with installation instruction Dec 31, 2018
main.c Add move first btree impl Feb 17, 2019

README.md

Simple SQLite Backend

This repository is to understand the basic backend implementation of SQLite database. Codes are extracted from SQLite 2.5.0 version and initial implementation may have changed. Here, testing codes are added into the test directory and all SQLite implementation are included into the core directory. Tests included to test VFS, Pager and Btree functionality.

Compile and running instructions for Unix

  1. Take a clone of this project into your local folder
    git clone https://github.com/madushadhanushka/simple-sqlite.git
  2. Move inside the repository
    cd simple-sqlite
  3. Build the project with cmake
    cmake -DCMAKE_BUILD_TYPE=Debug
  4. Build with make
    make
  5. Run test
    ./simple-sqlite

Use as your own Paging library

You can use paging functionality to create your own file accessing implementation. You can find out sample usecase in pager.c.

Open pager with the given file name
int sqlitepager_open(Pager **ppPager,const char *zFilename,int nPage,int nEx);

Get page specified by the page number
int sqlitepager_get(Pager *pPager, Pgno pgno, void **ppPage);

Start to write data into a page specified in pData
int sqlitepager_write(void *pData);

Commit page changes into the file
int sqlitepager_commit(Pager*);

Close the connection to the file
int sqlitepager_close(Pager *pPager);

Contribute!

If you see somthing wrong, Inclomplete content or improvement, you are welcome to create issue or send pull request to this repository in order to improve the code quality and the readability.

You can’t perform that action at this time.