elixir-sqlite / exqlite

An SQLite3 driver for Elixir
https://hexdocs.pm/exqlite
MIT License
198 stars 46 forks source link

Load extensions with `Sqlite3` ?? #275

Closed andyl closed 5 months ago

andyl commented 5 months ago

Exqlite.Basic has functions enable_load_extension and load_extension.

Exqlite.Sqlite3 only has function enable_load_extension.

Is it possible to load extensions with Sqlite3 ??

warmwaffles commented 5 months ago

Yes using the Connection configuration you can:

config :exqlite, load_extensions: [ "./priv/sqlite/\#{arch_dir}/rotate" ]

Here is a ton of information about the configurations that can be passed to exqlite. Sorry that the information is buried in there. https://hexdocs.pm/exqlite/Exqlite.Connection.html#connect/1

Just be aware, when you load extensions that they need to be compiled for that machine and must be compatible with the sqlite version.

andyl commented 5 months ago

Thanks very much! Would you like a PR for a small update to README with this docco?

warmwaffles commented 5 months ago

@andyl definitely, an example section in the README would be fine.

andyl commented 5 months ago

Done.