Sqlite Interface with OS And Browsers
In the last blog we discussed about the Command Line shell for Sqlite, So know taking the series forward we will discuss about Sqlite interface and Browser Interface. Owing to the robust features like Zero configuration and portability, Sqlite is implemented at a very large scale by different browsers and operating systems. It can be easily complied and run in operating systems like Windows, Linux, and Solaris and on embedded platforms such as Palm OS and Windows CE, as well. It works in an unseamed way with large and small endian byte orders on 16 bit, 32- bit and 64-bit architectures. Sqlite serves different purposes in different operating systems and browsers. In Mac OS X, Sqlite is implemented as a framework for core data application. In Sun’s Solaris OS environment, it serves to back up the Service Management Facility.
Data Processing In Sqlite
Data in Sqlite is processed via passing through different stages of Sqlite graphical interface architecture. The eight modules of Sqlite are grouped together in 3 different subsystems. The first subsystem compiles the queries, the middle module executes them and the third module acts as an interface with the operating system. We will basically focus on this interface in this write up.
Tokenizer and Parser are responsible for starting the compilation process of the user queries, followed by Code Generator which changes the queries in a Sqlite specific assembly language. This mini-program in assembly language is handed off to the virtual machine for further processing.
The virtual machine is basically responsible for working on byte code as a scripting language interpreter. Each instruction in the virtual machine is executed to perform a specific operation.
The last subsystem is combined of B-Tree, page cache and the OS Interface. The B-Tree maintains the order of the bits of information that are transferred in the form of database pages. The pager works in synchronization with the B-Tree and transfers the pages to and fro the storage disk. At last we come to the OS Interface which performs functions as database locking, transaction management, etc. on different Sqlite graphical intereface and browsers. File locking functions differently in different operating systems and the OS interface is responsible for hiding these differences with the help of an abstraction layer.
OS Interface In Relation With Other Sqlite Modules
The module which makes Sqlite portable across different operating systems and browsers is none other than OS Interface, also designated as Virtual File System (VFS). At times when the other modules of Sqlite database need to communicate with the OS, they conjure the request to the VFS. Ultimately the operating specific code is evoked by the VFS in order to fulfill the request of the concerned module. Hence porting the Sqlite to a new OS or a browser just requires creation of a new layer of OS Interface. The VFS in UNIX and Windows OS is available by default under the source tree. Also sqlite3_vfs_register () interface can be used to add new VFS at run-time or start-time.
In the above section we have discussed about the Sqlite interface with the browsers and OS. In case the users want to get a complete view of the data residing within the Sqlite data files, they can rely on a third party application, Free Sqlite Viewer. It gives a complete preview of all the database components of Sqlite database files. Also in case due to any corruption issue, if your Sqlite database gets corrupted or deleted somehow, you can take assistance of Sqlite Database Recovery software that efficaciously recovers the entire items of the Sqlite database.