Thursday, 21 November 2013

SQLite là một C library!

SQLite nói một cách chính xác, là một C library, là một RDBMS không cần server process.

Theo SQLite homepage

SQLite is a software library that implements a self-contained, serverless, zero-configuration, transactional SQL database engine. SQLite is the most widely deployed SQL database engine in the world. The source code for SQLite is in the public domain.
Theo Python docs
SQLite is a C library that provides a lightweight disk-based database that doesn’t require a separate server process and allows accessing the database using a nonstandard variant of the SQL query language. Some applications can use SQLite for internal data storage. It’s also possible to prototype an application using SQLite and then port the code to a larger database such as PostgreSQL or Oracle.

The sqlite3 module was written by Gerhard Häring. It provides a SQL interface compliant with the DB-API 2.0 specification described by PEP 249.
Trên Ubuntu 12.04
~$ dpkg -s libsqlite3-0
Package: libsqlite3-0
Status: install ok installed
Multi-Arch: same
Priority: standard
Section: libs
Installed-Size: 770
Maintainer: Ubuntu Developers <>
Architecture: amd64
Source: sqlite3
Version: 3.7.9-2ubuntu1.1
Depends: libc6 (>= 2.14)
Pre-Depends: multiarch-support
Description: SQLite 3 shared library
 SQLite is a C library that implements an SQL database engine.
 Programs that link with the SQLite library can have SQL database
 access without running a separate RDBMS process.
Một số library khác cũng implement database engine như:
- BDB / HDB: phổ biết nhất khi dùng với OpenLDAP
- Tokyo/Kyoto Carbinet
- Nhiều dbm successors khác

Fun fact:
Python depends  on libsqlite3

$ apt-cache depends python2.7
  Depends: python2.7-minimal
  Depends: mime-support
  Depends: libbz2-1.0
  Depends: libc6
  Depends: libdb5.1
  Depends: libexpat1
  Depends: libgcc1
  Depends: libncursesw5
  Depends: libreadline6
  Depends: libsqlite3-0
  Depends: libtinfo5
  Suggests: python2.7-doc
  Suggests: binutils
  Conflicts: <python-profiler>
  Conflicts: <python-profiler:i386>
  Replaces: <python-profiler>
  Replaces: <python-profiler:i386>
  Conflicts: python2.7:i386