sqlx icon indicating copy to clipboard operation
sqlx copied to clipboard

Compile-time support for external drivers

Open bobozaur opened this issue 8 months ago • 1 comments

Does your PR solve an issue?

Not on this repo, but it would solve an issue for the sqlx-exasol driver: https://github.com/bobozaur/sqlx-exasol/issues/9.

With the changes here, the compile-time macros can be redefined by external drivers through usage of sqlx_macros_core::query::expand_input() with a custom QueryDriver. Furthermore, a sqlx-cli like binary can be exposed as well, since the install_default_drivers() call was moved to the sqlx-cli binaries. With these changes, the custom driver binary (that depends on sqlx-cli as a library) can install its own driver (this would panic with the current state of things).

Is this a breaking change?

Nope, it's internal only. Should not affect anything else at all.

bobozaur avatar Jun 06 '25 18:06 bobozaur

Here's the PR from sqlx-exasol that makes use of these changes to implement compile-time query support and sqlx-cli like behavior: https://github.com/bobozaur/sqlx-exasol/pull/35.

bobozaur avatar Jun 06 '25 18:06 bobozaur

@bobozaur can you rebase and fix the conflict? We're ready to merge this.

abonander avatar Jul 01 '25 00:07 abonander