Skip to content

Ability to configure SQLite extension entrypoint in sqlx.toml #4093

@supleed2

Description

@supleed2

I have found these related issues/pull requests

Related to #3928 and the original addition in #3917

Description

I'm trying out the SQLite extension support using the 0.9.0-alpha.1 versions of sqlx and sqlx-cli.

I was previously getting errors about the config file sqlx.toml not parsing correctly. The config key was changed in #3928 but the example wasn't updated to match.

Current example:

[common.drivers.sqlite]
unsafe-load-extensions = ["/tmp/sqlite3-lib/ipaddr"]

But the section was updated to be:

[drivers.sqlite]
unsafe-load-extensions = ["/tmp/sqlite3-lib/ipaddr"]

After getting the extension loading working, the sqlx::query! and sqlx::query_as! macros would panic. Renaming the extension file to match the * in sqlite_*_init worked.

Could the sqlx.toml format expose an equivalent to extension_with_entrypoint as an option?

Prefered solution

  • Update the example at examples/sqlite/extension/sqlx.toml to match the actual format
  • Allow an array of strings and objects under drivers.sqlite.unsafe-load-extensions, possible example:
[drivers.sqlite]
unsafe-load-extensions = [
    "/tmp/sqlite3-lib/ipaddr",
    { path = "/tmp/sqlite3-lib/ipaddr_renamed", entrypoint = "sqlite_ipaddr_init" }
]

Is this a breaking change? Why or why not?

I don't believe so, since the sqlx.toml format could still accept just a string in each entry of drivers.sqlite.unsafe-load-extensions to mean "use the default entrypoint based on the filename".

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions