Framework of Sqlite
In our last blog we gave an Overview about Sqlite and a brief description about its File system. Now we will move on towards the Sqlite Framework. The Sqlite is composed of seven major modules that is grouped into two subsystems: The Front End and The Back End. These modules extend help in simplifying the query processing and performs compiling, execution, and interfacing like an assembly line. Let’s have a look on this article Framework of Sqlite:
The Front End System in Sqlite Framework
The front end performs the job of preprocessing the SQL and Sqlite statements that are entered as an input by the application. It thoroughly analyzes the statements, optimize them, and creates a byte code that is further executed by the backend. The Sqlite framework front end is made up of three major modules:
Tokenizer: This component is responsible for dividing the task into smaller parts. That means, it splits the statement into small tokens so that they can be easily processed.
Parser: This works as analyzer of the tokens that are produced by the Tokenizer and produces a parse tree. The parser further optimizes the parse tree and will find an equivalent tree to get a bytecode program.
Code Generator: The code generator traverses through the parse tree and then creates an internal Sqlite byte code program.
The Backend System of Sqlite Framework
The backend system of Sqlite framework is responsible for interpreting the byte code and it is where the database is actually processed. It is divided into four modules:
Virtual Machine: This works as an interpreter for the byte code program that is created by the code generator. Its main job is to process the SQL statements. It considers the database as a set of tables and index where the table is a made of records or tuples.
B+ Tree: The tables are organized into the B+Tree structure while the indexes are arranged as B- Tree. This will be helpful to the Virtual Machine to traverse through the tables and perform actions like insert, delete, or search for tuples within the tree.
Pager: It is responsible for handling the pages that are the part of B+ and B- trees. Along with this, tasks like file locking or journalings are performed by it that helps in implementing the ACID property of a transaction.
Operating System Interface: This framework of Sqlite architecture provides a uniform framework for the varied Operating Systems. Although, operations like file locking are executed differently in different OS, but with this interface, an abstraction layer is created that hides all these differences from other modules. This is the reason why Sqlite porting is easy on different Operating Systems.
The above deliberated depiction of Sqlite and its Framework is excellent, but after reading the content you feel an ease to visualize these Sqlite Framework and its structure to explore about Sqlite in depth. So to resolve this issue you can go for Sqlite Viewer which will facilitate you to explore more about Sqlite and its components by enabling to view Sqlite files and its components for FREE.