Aller au contenu | Aller au menu | Aller à la recherche

Load Sqlite Extension in Mozilla

Since the version 3.3.6, SQLITE has the capability to load new SQL functions and collating sequences from shared libraries and DLLs. For security considerations, the entire extension loading mechanism is turned off by default and it's the case in Mozilla. This mechanism is accessible through 3 differents methods :

  • from the shell : .load filename entrypoint
  • from SQL : SELECT load_extension(filename, entrypoint);
  • from C : int sqlite3_load_extension(sqlite3 *db, const char *filename, const char *entrypoint, const char *errormessage);

To enable the extension mechanism, you first have to invoke a C function : int sqlite3_enable_load_extension(sqlite3 *db, int onoff);

In Mozilla, like in other development environment, the loading mechanism is turn off and I proposed a patch to have the capability to load sqlite extension.

For security reasons, I don't propose a way to enable the extension mechanism. I've just proposed to add a method to mozIStroageConnection to load an sqlite extension to an already established connection. With this proposition it's only possible to load an sqlite extension from a chrome JavaScript or C++ XPCOM component.

With this capability, we will have the capability to use new type data, like GEOMETRY, new indexing, like R-Tree, and new treatment directly in SQL statement. This could be usefull with asynchronous statement execution and SQLite XUL template.

This function is waiting from review, but I already tests it and uses it. Stay tuned!