mirror of
https://github.com/launchbadge/sqlx.git
synced 2026-03-19 08:39:44 +00:00
Add a "sqlite-unbundled" feature that dynamically links to system libsqlite3.so library (#3507)
* Add a "sqlite-unbundled" feature that dynamically links to system libsqlite3.so library * update README abouot the newly-added `sqlite-unbundled` feature * Update README.md to make it clear with bulleted list Co-authored-by: Austin Bonander <austin.bonander@gmail.com> * more cfg feature updates Co-authored-by: Austin Bonander <austin.bonander@gmail.com> * update documentation in sqlx-sqlx/src/lib.rs too and also mention possible build time increasement. * cargo fmt * Add "sqlite-unbundled" feature to sqlx-cli * Add sqlite-unbundled to gituhb actions tests * cfg(feature = "sqlite") => cfg(any(feature = "sqlite", feature = "sqlite-unbundled")) * fix * CI: make sqlite-unbundled tests workaround required-features by duplicating the relevant test section * use an internal "_sqlite" feature to do the conditional compilation --------- Co-authored-by: Austin Bonander <austin.bonander@gmail.com>
This commit is contained in:
@@ -23,6 +23,9 @@ uuid = ["dep:uuid", "sqlx-core/uuid"]
|
||||
|
||||
regexp = ["dep:regex"]
|
||||
|
||||
bundled = ["libsqlite3-sys/bundled"]
|
||||
unbundled = ["libsqlite3-sys/buildtime_bindgen"]
|
||||
|
||||
[dependencies]
|
||||
futures-core = { version = "0.3.19", default-features = false }
|
||||
futures-channel = { version = "0.3.19", default-features = false, features = ["sink", "alloc", "std"] }
|
||||
@@ -55,7 +58,6 @@ default-features = false
|
||||
features = [
|
||||
"pkg-config",
|
||||
"vcpkg",
|
||||
"bundled",
|
||||
"unlock_notify"
|
||||
]
|
||||
|
||||
|
||||
@@ -2,7 +2,8 @@
|
||||
//!
|
||||
//! ### Note: linkage is semver-exempt.
|
||||
//! This driver uses the `libsqlite3-sys` crate which links the native library for SQLite 3.
|
||||
//! For portability, we enable the `bundled` feature which builds and links SQLite from source.
|
||||
//! With the "sqlite" feature, we enable the `bundled` feature which builds and links SQLite from
|
||||
//! source.
|
||||
//!
|
||||
//! We reserve the right to upgrade the version of `libsqlite3-sys` as necessary to pick up new
|
||||
//! `3.x.y` versions of SQLite.
|
||||
@@ -20,6 +21,18 @@
|
||||
//! ```
|
||||
//!
|
||||
//! and then upgrade these crates in lockstep when necessary.
|
||||
//!
|
||||
//! ### Dynamic linking
|
||||
//! To dynamically link to a system SQLite library, the "sqlite-unbundled" feature can be used
|
||||
//! instead.
|
||||
//!
|
||||
//! This allows updating SQLite independently of SQLx or using forked versions, but you must have
|
||||
//! SQLite installed on the system or provide a path to the library at build time (See
|
||||
//! [the `rusqlite` README](https://github.com/rusqlite/rusqlite?tab=readme-ov-file#notes-on-building-rusqlite-and-libsqlite3-sys)
|
||||
//! for details).
|
||||
//!
|
||||
//! It may result in link errors if the SQLite version is too old. Version `3.20.0` or newer is
|
||||
//! recommended. It can increase build time due to the use of bindgen.
|
||||
|
||||
// SQLite is a C library. All interactions require FFI which is unsafe.
|
||||
// All unsafe blocks should have comments pointing to SQLite docs and ensuring that we maintain
|
||||
|
||||
Reference in New Issue
Block a user