Enable Extension Loading
Enable Extension Loading
Is there a way to enable extension loading?
Maybe an additional ConnectionParam or something similar?
I've tried "EnableLoadExtension=True" - this doesnt work.
Maybe an additional ConnectionParam or something similar?
I've tried "EnableLoadExtension=True" - this doesnt work.
Re: Enable Extension Loading
Hello,
At the moment this feature is not supported. We will try to add it in the next version of the product
At the moment this feature is not supported. We will try to add it in the next version of the product
EnableLoadExtension has no effect in dbExpress driver for SQLite 3.4.6
Code: Select all
SELECT load_extension("libspatialite-2.dll")
**EDIT: DirectMode seems to do the Job.
Re: Enable Extension Loading
If the problem occurs only while using an external library, it means that the library was compiled without using the ENABLE_LOAD_EXTENSION compilation option. This option allows you to work with external libraries.
Re: Enable Extension Loading
i've tried it with the latest stable precompiled binary from the SQLite Download Page:
http://www.sqlite.org/2014/sqlite-dll-w ... 080500.zip
both functions "enable_load_extension" and "load_extension" are available in this dll and usable with a simple delphi-wrapper (sv-utils).
http://www.sqlite.org/2014/sqlite-dll-w ... 080500.zip
both functions "enable_load_extension" and "load_extension" are available in this dll and usable with a simple delphi-wrapper (sv-utils).
Re: Enable Extension Loading
To use the extensions, you should set the EnableLoadExtension property to True:
Code: Select all
LiteConnection1.Options.EnableLoadExtension := true;
LiteConnection1.ExecSQL('SELECT load_extension("libspatialite-2.dll")');
Re: Enable Extension Loading
this is a working code-snippet on how i create an empty spatialite-db:
this one throws the "not authorized" error:
all required sqlite- and spatialite- dll's (including dependencies) are in the folder of my executable.
i'm still using my sv-utils-wrapper to handle my geospatial databases with delphi. and i remember that i had to change the "onoff"-parameter of the function "enable_load_extension" from boolean to integer to get it work.
maybe a similar problem here.
anyways directmode is okay for me - i'll continue playin around with the trial.
Code: Select all
SQLCon := TSQLConnection.Create(nil);
with SQLCon do
begin
Name := 'SQLCon';
ConnectionName := 'Devart SQLite Direct';
DriverName := 'DevartSQLiteDirect';
GetDriverFunc := 'getSQLDriverSQLiteDirect';
LoginPrompt := False;
Params.Clear;
Params.Add('Database=.\tmp.db');
Params.Add('EnableLoadExtension=True');
Params.Add('ForceCreateDatabase=True');
Open;
ExecuteDirect('SELECT load_extension ("mod_spatialite");');
ExecuteDirect('SELECT InitSpatialMetaData();');
Close;
Free;
end;
Code: Select all
SQLCon := TSQLConnection.Create(nil);
with SQLCon do
begin
Name := 'SQLCon';
ConnectionName := 'Devart SQLite';
DriverName := 'DevartSQLite';
GetDriverFunc := 'getSQLDriverSQLite';
LoginPrompt := False;
Params.Clear;
Params.Add('Database=.\tmp.db');
Params.Add('EnableLoadExtension=True');
Params.Add('ForceCreateDatabase=True');
VendorLib := '.\sqlite3.dll';
Open;
ExecuteDirect('SELECT load_extension ("mod_spatialite");');
ExecuteDirect('SELECT InitSpatialMetaData();');
Close;
Free;
end;
i'm still using my sv-utils-wrapper to handle my geospatial databases with delphi. and i remember that i had to change the "onoff"-parameter of the function "enable_load_extension" from boolean to integer to get it work.
maybe a similar problem here.
anyways directmode is okay for me - i'll continue playin around with the trial.
Re: Enable Extension Loading
Thank you for the information. We have reproduced and fixed the problem. This fix will be included to the next build.
Re: Enable Extension Loading
THXAlexP wrote:Thank you for the information. We have reproduced and fixed the problem. This fix will be included to the next build.