[fpc-pascal] SQLite Load_extension seems to be working

Reinier Olislagers reinierolislagers at gmail.com
Mon Nov 7 10:42:25 CET 2011


On 7-11-2011 8:23, Reinier Olislagers wrote:
> 2. You can apparently load the spatialite (and dependencies) dll/so as
> an extension to SQLite, with a statement like [3]
> select load_extension('libspatialite-4.dll');
> However, it seems you have to enable the extension load mechanism first
> using the C API [2]:
> int sqlite3_enable_load_extension(sqlite3 *db, int onoff);
> (onoff==1 to turn extension loading on)

Attached diff (against fixes_2_6) seems to work for letting SQLite load
the libspatialite extension, e.g. using this in my Lazarus FormCreate event:
// Try to load extensions
DBConnection.DatabaseName:='osm.sqlite';
DBConnection.Open;
DBConnection.LoadExtension('libspatialite-4.dll');
//Note: we need an open db before doing this

Now I'm getting an error message saying that libfreexl-1.dll can't be
found, apparently an Excel reader library required by spatialite...
I'm going to ask the spatialite guys for clarification on this...

I'll upload the diff as a patch unless somebody has objections/a better
implementation...

Thanks,

Reinier
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: 26Fixes_sqlite3conn.pp.diff
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20111107/d4aca1ea/attachment.ksh>


More information about the fpc-pascal mailing list