Skip to main content

ic_sqlite_vfs/
lib.rs

1//! IC canister crate root for the `icstable` SQLite VFS.
2//!
3//! The database image is stored inside a caller-provided MemoryManager virtual
4//! memory. SQLite reaches it only through `sqlite3_vfs` callbacks, so no POSIX
5//! or WASI filesystem is used.
6
7#[cfg(all(feature = "sqlite-bundled", feature = "sqlite-precompiled"))]
8compile_error!("features `sqlite-bundled` and `sqlite-precompiled` cannot be enabled together");
9
10#[cfg(feature = "canister-api")]
11pub mod api;
12pub mod config;
13pub mod db;
14#[cfg(any(test, debug_assertions, feature = "bench-profile"))]
15#[doc(hidden)]
16pub mod read_metrics;
17#[doc(hidden)]
18pub mod sqlite_vfs;
19#[doc(hidden)]
20pub mod stable;
21
22pub use db::{Db, DbError, DbHandle};
23pub use stable::memory::DbMemory;
24
25#[macro_export]
26macro_rules! params {
27    () => {
28        &[]
29    };
30    ($($value:expr),+ $(,)?) => {
31        &[$($crate::db::value::to_sql_ref(&$value)),+]
32    };
33}
34
35#[macro_export]
36macro_rules! named_params {
37    () => {
38        &[]
39    };
40    ($($name:expr => $value:expr),+ $(,)?) => {
41        &[$(($name, $crate::db::value::to_sql_ref(&$value))),+]
42    };
43}
44
45#[cfg(feature = "canister-api")]
46use api::{ChecksumRefresh, DbMeta};
47
48#[cfg(feature = "canister-api")]
49ic_cdk::export_candid!();