Page 1 of 1

Enable Extension Loading

Posted: Thu 31 May 2012 16:32
by Flynn
Is there a way to enable extension loading?
Maybe an additional ConnectionParam or something similar?
I've tried "EnableLoadExtension=True" - this doesnt work.

Re: Enable Extension Loading

Posted: Fri 01 Jun 2012 15:55
by AlexP
Hello,

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

Posted: Thu 07 Aug 2014 13:36
by Flynn

Code: Select all

SELECT load_extension("libspatialite-2.dll")
Throws a "not authorized" Error, using a full path neither works.

**EDIT: DirectMode seems to do the Job.

Re: Enable Extension Loading

Posted: Fri 08 Aug 2014 08:03
by AlexP
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

Posted: Fri 08 Aug 2014 10:00
by Flynn
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).

Re: Enable Extension Loading

Posted: Fri 08 Aug 2014 11:17
by AlexP
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

Posted: Fri 08 Aug 2014 13:53
by Flynn
this is a working code-snippet on how i create an empty spatialite-db:

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;
this one throws the "not authorized" error:

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;
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.

Re: Enable Extension Loading

Posted: Fri 08 Aug 2014 15:05
by AlexP
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

Posted: Mon 11 Aug 2014 08:18
by Flynn
AlexP wrote:Thank you for the information. We have reproduced and fixed the problem. This fix will be included to the next build.
THX ;-)