From dc11704820e1ab62cd854076b3ff7ef3ba7bb2cf Mon Sep 17 00:00:00 2001 From: gwenn Date: Sat, 1 Feb 2025 10:42:52 +0100 Subject: [PATCH 1/3] Fix array and window feature which depend on modern sqlite --- Cargo.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 825c5f0..f79fae1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -61,11 +61,11 @@ unlock_notify = ["libsqlite3-sys/unlock_notify"] vtab = [] csvtab = ["csv", "vtab"] # pointer passing interfaces: 3.20.0 -array = ["vtab"] +array = ["vtab", "modern_sqlite"] # session extension: 3.13.0 session = ["libsqlite3-sys/session", "hooks"] # window functions: 3.25.0 -window = ["functions"] +window = ["functions", "modern_sqlite"] # 3.9.0 series = ["vtab"] # check for invalid query. From 01e8511c9f587138baa09e36ac14cc4410a5994b Mon Sep 17 00:00:00 2001 From: gwenn Date: Sat, 1 Feb 2025 10:54:28 +0100 Subject: [PATCH 2/3] Factorize code --- src/pragma.rs | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/src/pragma.rs b/src/pragma.rs index a8a3a43..b8d7cf5 100644 --- a/src/pragma.rs +++ b/src/pragma.rs @@ -60,16 +60,8 @@ impl Sql { let value = match value { ToSqlOutput::Borrowed(v) => v, ToSqlOutput::Owned(ref v) => ValueRef::from(v), - #[cfg(feature = "blob")] - ToSqlOutput::ZeroBlob(_) => { - return Err(err!(ffi::SQLITE_MISUSE, "Unsupported value \"{value:?}\"")); - } - #[cfg(feature = "functions")] - ToSqlOutput::Arg(_) => { - return Err(err!(ffi::SQLITE_MISUSE, "Unsupported value \"{value:?}\"")); - } - #[cfg(feature = "array")] - ToSqlOutput::Array(_) => { + #[cfg(any(feature = "blob", feature = "functions", feature = "array"))] + _ => { return Err(err!(ffi::SQLITE_MISUSE, "Unsupported value \"{value:?}\"")); } }; From e911411921a83bdf2166bc8bb0359306860ef036 Mon Sep 17 00:00:00 2001 From: gwenn Date: Sat, 1 Feb 2025 10:57:24 +0100 Subject: [PATCH 3/3] Use decrement_strong_count directly --- src/vtab/array.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/vtab/array.rs b/src/vtab/array.rs index 111d892..275e7e4 100644 --- a/src/vtab/array.rs +++ b/src/vtab/array.rs @@ -43,7 +43,7 @@ use crate::{Connection, Result}; pub(crate) const ARRAY_TYPE: *const c_char = c"rarray".as_ptr(); pub(crate) unsafe extern "C" fn free_array(p: *mut c_void) { - drop(Rc::from_raw(p as *const Vec)); + Rc::decrement_strong_count(p as *const Vec); } /// Array parameter / pointer