mirror of
https://github.com/tursodatabase/limbo.git
synced 2025-08-04 18:18:03 +00:00
Add tests for first extension
This commit is contained in:
parent
e4ce6402eb
commit
9c208dc866
9 changed files with 205 additions and 79 deletions
|
@ -18,7 +18,9 @@ mod vdbe;
|
|||
static GLOBAL: mimalloc::MiMalloc = mimalloc::MiMalloc;
|
||||
|
||||
use fallible_iterator::FallibleIterator;
|
||||
#[cfg(not(target_family = "wasm"))]
|
||||
use libloading::{Library, Symbol};
|
||||
#[cfg(not(target_family = "wasm"))]
|
||||
use limbo_extension::{ExtensionApi, ExtensionEntryPoint, RESULT_OK};
|
||||
use log::trace;
|
||||
use schema::Schema;
|
||||
|
@ -179,6 +181,7 @@ impl Database {
|
|||
.insert(name.as_ref().to_string(), func.into());
|
||||
}
|
||||
|
||||
#[cfg(not(target_family = "wasm"))]
|
||||
pub fn load_extension(&self, path: &str) -> Result<()> {
|
||||
let api = Box::new(self.build_limbo_extension());
|
||||
let lib =
|
||||
|
@ -397,6 +400,7 @@ impl Connection {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
#[cfg(not(target_family = "wasm"))]
|
||||
pub fn load_extension(&self, path: &str) -> Result<()> {
|
||||
Database::load_extension(self.db.as_ref(), path)
|
||||
}
|
||||
|
@ -499,6 +503,7 @@ impl Rows {
|
|||
|
||||
pub(crate) struct SymbolTable {
|
||||
pub functions: HashMap<String, Rc<crate::function::ExternalFunc>>,
|
||||
#[cfg(not(target_family = "wasm"))]
|
||||
extensions: Vec<(libloading::Library, *const ExtensionApi)>,
|
||||
}
|
||||
|
||||
|
@ -514,6 +519,8 @@ impl SymbolTable {
|
|||
pub fn new() -> Self {
|
||||
Self {
|
||||
functions: HashMap::new(),
|
||||
// TODO: wasm libs will be very different
|
||||
#[cfg(not(target_family = "wasm"))]
|
||||
extensions: Vec::new(),
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue