load_extension?

load_extension does not work in SQLiteDatabase. It returns an error about not authorized.

Could we make sure you don’t define SQLITE_OMIT_LOAD_EXTENSION when building SQLite Database plugin.
And we need a way to call sqlite3_enable_load_extension with onoff=1 to enable them. (or you enable them always)

That should have gone into Feedback case 36423.

Now anyone has an idea?

SQLiteDatabase LoadExtensions is for me very useful for:

  • RemoveAccents
  • SoundEx (similar words)
  • Left
  • Right
  • Mid
  • EncodeHex
  • DecodeHex
  • CountFields

… and many more functions!
(see http://www.monkeybreadsoftware.de/SQLiteExtension/)

But works only with REALSQLdatabase!

dim e as FolderItem e = SpecialFolder.Desktop.Child("MBS.dylib") dim rec as RecordSet = r.SQLSelect("SELECT load_extension('"+e.UnixpathMBS+"');")

returns me this message: “not authorized”

REALSQLdatabase has been DEPRECATED. Please use SQLiteDatabase as a replacement.

Changes to SQLiteDatabase (from RealSQLDatabase):

  • RowID is not injected into your SQL statements for you, which may affect RecordSet.Edit with SQL statements that did not select a primary key. In this case the solution is to make sure you include the primary key (or rowid) in the original SELECT statement.
  • SQL statements automatically commit after each command. If you want a transaction, use SQLExecute(“BEGIN TRANSACTION”) and then Commit manually at the end.
  • SQLiteDatabase uses a more recent version of SQLite.
  • SQLiteDatabase can use the backup API .

Could load_extension on SQLiteDatabase be resolved?

Thanks for any help!

i was trying this one yesterday evening and got the same result… “not authorized”

i just put this feedback case to number one

i thought i was doing something wrong.

Working around i found that we have first to allow the LoadExtensions

Sample:

[code] dim r as new SQLiteDatabase
dim f as FolderItem = SpecialFolder.Desktop.Child(“test.db”)
dim e as FolderItem

if TargetWin32 then
e = SpecialFolder.Desktop.Child(“MBS.dll”)
elseif TargetLinux then
e = SpecialFolder.Desktop.Child(“MBS.so”)
elseif TargetMachO then
e = SpecialFolder.Desktop.Child(“MBS.dylib”)
else
MsgBox “platform not supported”
end if

if e.Exists = false then
MsgBox “Please place the MBS SQLite Extension library on the desktop folder.”
end if

r.DatabaseFile = f

if r.CreateDatabaseFile then

// Allows the Load of our SQLite Extension
r.LoadExtensions = True

dim rec as RecordSet = r.SQLSelect("SELECT load_extension('"+e.UnixpathMBS+"');")

if r.Error then
  MsgBox r.ErrorMessage
else
  Return r
end if

else
MsgBox “Failed to create database.”
end if[/code]

So please don’t forget to add:

SQLiteDatabase.LoadExtensions = True

so basically the line is excluded in the sample code.

Yes, so please Christian, could you change your inform to make this line add in your sample code mentioned in the SQLiteExtension on http://www.monkeybreadsoftware.de/SQLiteExtension/ ?
Thanks Rob

I’ll change text on website.
And I’ll add the function to my own plugin to enable extension there, so you can switch to my plugin later.

Christian… love your SQLite plugin… just implement the SoundExMBS for most current client…

Christian, i want to use the sqlite extension with my SQLiteManager, where do i put the file?? you mention some plugin folder.

In the Help menu of SQLiteManager, there is a command to open extensions folder.

thanks… i was actually doing Load SQLite Extension from the Database dropdown menu everytime i open the SQLiteManager.

Christian,

what other extension for sqlite can we used??

Roberto, please set LoadExtensions = true to allow extensions to load. Than it works.

Sorry for the trouble.