SQLite as an application file format is one of the suggested uses
for SQLite at http://www.sqlite.org/whentouse.html.  I've done
this (though using Tcl/Tk as the programming language, not C++)
and it has worked *very* well.

I use it as the native format in BitPim. BitPim is written in
Python. The original versions of BitPim use Python dictionaries
(known as hash tables or maps in other languages) with a fairly
complex data structure (the values can include lists of other
hash tables). These were dumped as is to plain text files on the disk.


It was fairly easy to write some code that can convert a complex
Python dictionary into various tables, only adding new rows if
values have changed.  That means the rest of the code continues
to operate on Python dictionaries, while one module dumps them
into or out of the SQLite database instead of plain text files.

The one thing I don't store in the database is images and ringtones.
They average 8 to 50KB.  I just use the filesystem for that.  They
would store perfectly in a SQLite database as a blob, but there
doesn't seem to be any point since users typically won't care
about old values as they would with phonebook and calendar entries.

One *really* important feature that SQLite gives me is the
ability to safely run multiple copies of my program.  I frequently
log into the same computer concurrently in two different ways.
For example I may be logged in on the console, and also via
network display (VNC for Linux, Terminal Services for Windows)
and nothing winds me up more than programs that refuse to have
two instances even if they are on different displays.  SQLite
lets you safely access the data from as many concurrent instances
of your program as you want.

Roger

Reply via email to