Re: [sqlite] Extension Loading

2017-02-13 Thread Green Fields
>You could create a user-defined function to call LoadExtension(), but
>why do you need to do this from SQL?

A good question, but I am attempting to use a different .Net wrapper for
this project which has not imported sqlite3_enable_load_extension().
The simplest thing would be to import the function myself -  except that I
don't have the C skills to translate the arguments to .Net compatibility.

Your reference and comments re the sql function being disabled is something
I hadn't fully understood. I can see that the library has been compiled with
 ENABLE_LOAD_EXTENSION
 so I guess that
means sql is disabled.
I might have to rethink how I approach this then. Perhaps have another look
at importing the function

Thanks for the help
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Extension Loading

2017-02-12 Thread Clemens Ladisch
Green Fields wrote:
> conn.EnableExtensions(true);
> conn.LoadExtension("mod_spatialite");
>
> works fine, but I need to use the SQL function
>
> conn.EnableExtensions(true);
> cmd.CommandText = @"SELECT load_extension('mod_spatialite');");
> int i = cmd.ExecuteNonQuery();
>
> raises
>
> System.Data.SQLite.SQLiteException : SQL logic error or missing database
> not authorized

The documentation for sqlite3_enable_load_extension() says:
> This interface enables or disables both the C-API
> sqlite3_load_extension() and the SQL function load_extension(). Use
> sqlite3_db_config(db,SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION,..) to
> enable or disable only the C-API.


EnableExtensions() call sqlite3_db_config() and not
sqlite3_enable_load_extension().  Apparently, forbidding loading
extensions from SQL is done on purpose.


You could create a user-defined function to call LoadExtension(), but
why do you need to do this from SQL?


Regards,
Clemens
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] Extension Loading

2017-02-12 Thread Green Fields
Hi
I'm using System.Data.SQLite Nuget package and attempting to load an
extension.
All depenent libraries are in the bin\debug output directory.
Extension is 32 bit and the project is set to compile for 32 bit


Using

conn.EnableExtensions(true);(I think this is enabled by default)
conn.LoadExtension("mod_spatialite");

works fine, but I need to use the SQL function
 and

conn.EnableExtensions(true);
SQLiteCommand cmd = *conn.Create*Command();
cmd.CommandText = @"SELECT load_extension('mod_spatialite');");
int i = cmd.ExecuteNonQuery();

raises

System.Data.SQLite.SQLiteException : SQL logic error or missing database
not authorized

but I am able to successfully call the function in the SQLite CLI

Could someone point out where I'm going wrong with this syntax please

Thanks
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users