SynDBSQLite3: SQLite3 direct access
By A.Bouchez on 2011, Friday July 22, 17:14 - Open Source libraries - Permalink
For our ORM framework, we implemented an efficient SQLite3 wrapper, joining statically (i.e. without any external dll) the SQLite3 engine to the executable. SQLite3 is in fact used as the DB kernel of the framework. For instance, thanks to its unique virtual table mechanism, even tables in other databases (like Oracle or MSSQL) are available as if they were SQLite3 tables.
We just made this wrapper independent from our ORM, in a new dedicated unit,
named
SynSQLite3.pas.
It was an easy task to let this unit be called from our SynDB database abstract classes.
That is, you'll have a generic class hierarchy, able to access:
- Any OleDB providers (including latest version of MSSQL, or good old Access/Jet);
- Any ODBC provider (including e.g. MySQL / FireBird);
- Oracle via direct access to the OCI layer;
- and now SQLite3, statically embedded to the executable.
As a result, the SynDBExplorer sample tool is now able to select a SQLite3 database as source, in addition to the OleDB, ODBC or Oracle/OCI database types.

Select "Sqlite3" as the database type when creating a new connection,
and specify the full SQLite3 database as "Server name". Other properties
(Database name, User ID, Password) are just ignored.
The SynDBExplorer tool is a multi-tabbed software able to list
all tables, and also column names and types - including indexes. It can also
export all result content into csv, json, text or pdf files. And you have some
popup-menus to help you enter field names or values into your SQL
statement.
You can download this free tool from this direct link.
As you can see in the SynSQLite3.pas source code, adding such another Database to the SynDB classes model is just a very thin layer, calling the new shared SynSQLite3 unit.
Now I will work on integrating all those SynDB classes into our main framework, which is now named mORMot (at least in the source code).
Feedback and comments are welcome on our forum.
