Skip to content

Loading and Unloading SQLite extensions

SQLite extensions are small libraries that add extra SQL functions, collations, or virtual tables to the database engine. Once loaded, their functions can be used in SQL expressions just like the built-in ones.

Loading an extension

  1. Select the database in the tree panel.
  2. Choose Extensions → Load Extension from the tree panel's pop-up menu.
  3. Select the extension's file and, if required, its entry point.
  4. Optionally, tick Auto to register it for future connections as well, or Load whenever this database is opened to attach it to this database alone.

If the extension loads successfully, its functions become available in SQL for the selected database.

When you tick Auto, the extension is registered with SQLite's sqlite3_auto_extension() API, so it is loaded automatically for every new database connection (existing connections are not affected).

You can also load an extension with the SQL load_extension() function:

SELECT load_extension('myextension');

Loading through the Load Extension menu command uses the sqlite3_load_extension() API directly.

Warning

An extension must be compiled for the same platform as SQLite Expert. The 64-bit version of SQLite Expert can only load 64-bit extensions, and the 32-bit version only 32-bit extensions.

Loading an extension with one database

Most extensions belong to one database rather than to all of them. Tick Load whenever this database is opened and SQLite Expert remembers the extension against that database file: every time you open the file — from the menu, the recent list, a dropped file, or by double-clicking it in Explorer — the extension is loaded with it.

You can also turn this on and off later. On the Extensions tab, right-click the extension and choose Load With This Database or Do Not Load With This Database. The With database column shows which extensions are set up this way.

This is remembered for the database file itself, so it survives closing the database and outlives the session. It is separate from Auto, which ignores which database you are opening and loads into every connection.

Note

If the extension has been moved or deleted since you set this up, opening the database tells you which ones could not be loaded and then carries on. The database still opens.

Unloading an extension

  1. Choose Extensions → Unload Extension from the tree panel's pop-up menu.
  2. Select the extension to unload from the list of loaded extensions.

SQLite has no SQL command for unloading an extension, so SQLite Expert closes and reopens the database to clear it. Unloading also clears Load whenever this database is opened for that extension — otherwise it would be back the next time you opened the file.

Separately from all of this, and as with attached databases, SQLite Expert reopens the databases that were open when you last closed the program, with the extensions they had loaded at the time.

Viewing the loaded extensions

The Extensions tab always shows the extensions currently loaded, and for each one lists the functions and collations it provides. Auto marks an extension registered for every connection, Loaded one that is in the current connection, and With database one that will load again the next time this database is opened.

The Extensions tab The Extensions tab

See also: Displaying database information and internal parameters