With upcoming revision 1.18 of the framework, our
SynSQlite3.pas unit is able to access the SQLite3 engine
in two ways:
- Either statically linked within the project executable;
- Or from an external
sqlite3.dll library file.
The SQLite3 APIs and constants are defined in
SynSQlite3.pas, and accessible via a
class definition. It defines a global
sqlite3 variable as
To use the
SQLite3 engine, an instance of
TSQLite3Library class shall be assigned to this global variable.
Then all mORMot's calls will be made through it, calling e.g.
sqlite3.open() instead of
There are two implementation classes:
|Statically linked engine (
.obj within the
|Instantiate an external
SynSQLite3Static.pas in the
clause of your project is enough to link the
.obj engine into your
Warning - breaking change: before version 1.18 of the framework,
link of static
.obj was forced - so you must add a reference to
SynSQLite3Static in your project
uses clause to work
In order to use an external
sqlite3.dll library, you have to
set the global
sqlite3 variable as such:
FreeAndNil(sqlite3); // release any previous instance (e.g. static)
sqlite3 := TSQLite3LibraryDynamic.Create;
FreeAndNil(sqlite3) is not mandatory, and should be
necessary only to avoid any memory leak if another SQLite3 engine
instance was allocated (may be the case if
referred somewhere in your project's units).
Here are some benchmarks, compiled with Delphi XE3, run in a 32 bit
project, using either the static bcc-compiled engine, or an external
sqlite3.dll, compiled via
MinGW or Microsoft Visual C++.