diff --git a/core/lib.rs b/core/lib.rs index 4f5f11796..e08f65f7c 100644 --- a/core/lib.rs +++ b/core/lib.rs @@ -28,7 +28,7 @@ use fallible_iterator::FallibleIterator; use libloading::{Library, Symbol}; #[cfg(not(target_family = "wasm"))] use limbo_ext::{ExtensionApi, ExtensionEntryPoint}; -use limbo_ext::{ResultCode, VTabKind, VTabModuleImpl, Value as ExtValue}; +use limbo_ext::{ResultCode, VTabKind, VTabModuleImpl}; use limbo_sqlite3_parser::{ast, ast::Cmd, lexer::sql::Parser}; use parking_lot::RwLock; use schema::{Column, Schema}; @@ -497,7 +497,7 @@ impl Statement { } pub fn bind_at(&mut self, index: NonZero, value: OwnedValue) { - self.state.bind_at(index, value.into()); + self.state.bind_at(index, value); } pub fn reset(&mut self) { @@ -582,22 +582,16 @@ impl VirtualTable { let mut filter_args = Vec::with_capacity(arg_count); for i in 0..arg_count { let ownedvalue_arg = args.get(i).unwrap(); - let extvalue_arg: ExtValue = match ownedvalue_arg { - OwnedValue::Null => Ok(ExtValue::null()), - OwnedValue::Integer(i) => Ok(ExtValue::from_integer(*i)), - OwnedValue::Float(f) => Ok(ExtValue::from_float(*f)), - OwnedValue::Text(t) => Ok(ExtValue::from_text(t.as_str().to_string())), - OwnedValue::Blob(b) => Ok(ExtValue::from_blob((**b).clone())), - other => Err(LimboError::ExtensionError(format!( - "Unsupported value type: {:?}", - other - ))), - }?; - filter_args.push(extvalue_arg); + filter_args.push(ownedvalue_arg.to_ffi()); } let rc = unsafe { (self.implementation.filter)(cursor.as_ptr(), arg_count as i32, filter_args.as_ptr()) }; + for arg in filter_args { + unsafe { + arg.__free_internal_type(); + } + } match rc { ResultCode::OK => Ok(true), ResultCode::EOF => Ok(false), @@ -634,7 +628,7 @@ impl VirtualTable { }; for arg in ext_args { unsafe { - arg.free(); + arg.__free_internal_type(); } } match rc { diff --git a/core/vdbe/mod.rs b/core/vdbe/mod.rs index e436f58f5..2b183c257 100644 --- a/core/vdbe/mod.rs +++ b/core/vdbe/mod.rs @@ -1863,7 +1863,7 @@ impl Program { let argv_ptr = ext_values.as_ptr(); unsafe { step_fn(state_ptr, argc as i32, argv_ptr) }; for ext_value in ext_values { - unsafe { ext_value.free() }; + unsafe { ext_value.__free_internal_type() }; } } } diff --git a/extensions/core/src/lib.rs b/extensions/core/src/lib.rs index 2951d591e..03a4cac85 100644 --- a/extensions/core/src/lib.rs +++ b/extensions/core/src/lib.rs @@ -73,6 +73,7 @@ pub struct VTabModuleImpl { pub rowid: VtabRowIDFn, } +#[cfg(feature = "core_only")] impl VTabModuleImpl { pub fn init_schema(&self, args: Vec) -> ExtResult { let schema = unsafe { (self.create_schema)(args.as_ptr(), args.len() as i32) }; @@ -80,7 +81,7 @@ impl VTabModuleImpl { return Err(ResultCode::InvalidArgs); } for arg in args { - unsafe { arg.free() }; + unsafe { arg.__free_internal_type() }; } let schema = unsafe { std::ffi::CString::from_raw(schema) }; Ok(schema.to_string_lossy().to_string())