From c6fd6f9490bef45a4cb5ed47cb272c0c06a52f6f Mon Sep 17 00:00:00 2001 From: Ivan Ukhov Date: Wed, 8 Nov 2023 10:14:48 +0100 Subject: [PATCH] Put extensions behind a feature flag --- Cargo.toml | 1 + src/connection.rs | 3 +++ tests/connection.rs | 3 +++ 3 files changed, 7 insertions(+) diff --git a/Cargo.toml b/Cargo.toml index 66fb131d..e78d5063 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -32,6 +32,7 @@ keywords = ["database"] [features] default = ["linkage"] bundled = ["sqlite3-sys/bundled"] +extension = [] linkage = ["sqlite3-sys/linkage"] [dependencies] diff --git a/src/connection.rs b/src/connection.rs index 146f8065..1462bc8a 100644 --- a/src/connection.rs +++ b/src/connection.rs @@ -183,6 +183,7 @@ impl Connection { } /// Enable loading extensions. + #[cfg(feature = "extension")] #[inline] pub fn enable_extension(&self) -> Result<()> { unsafe { @@ -195,6 +196,7 @@ impl Connection { } /// Disable loading extensions. + #[cfg(feature = "extension")] #[inline] pub fn disable_extension(&self) -> Result<()> { unsafe { @@ -207,6 +209,7 @@ impl Connection { } /// Load an extension. + #[cfg(feature = "extension")] #[inline] pub fn load_extension>(&self, name: T) -> Result<()> { unsafe { diff --git a/tests/connection.rs b/tests/connection.rs index 15ff4abe..53a6a8f6 100644 --- a/tests/connection.rs +++ b/tests/connection.rs @@ -114,18 +114,21 @@ fn set_busy_handler() { } } +#[cfg(feature = "extension")] #[test] fn enable_extension() { let connection = ok!(Connection::open(":memory:")); ok!(connection.enable_extension()); } +#[cfg(feature = "extension")] #[test] fn disable_extension() { let connection = ok!(Connection::open(":memory:")); ok!(connection.disable_extension()); } +#[cfg(feature = "extension")] #[test] fn load_extension() { let connection = ok!(Connection::open(":memory:"));