1#![forbid(unsafe_code)]
10
11mod db;
12mod error;
13pub mod files;
14#[cfg(feature = "sync")]
15pub mod sync;
16mod tx;
17
18pub use db::{
19 RawKey, apply_key, encrypt_plaintext_in_place, has_cipher, migrate, open, open_foreign_readonly, open_in_memory, open_readonly, rekey,
20 schema_version, snapshot_to,
21};
22pub use error::{Result, StorageError};
23pub use rusqlite;
24pub use tx::{begin, release, rollback, savepoint};
25
26pub fn quote_ident(ident: &str) -> String {
28 format!("\"{}\"", ident.replace('"', "\"\""))
29}
30
31pub fn table_exists(conn: &rusqlite::Connection, name: &str) -> Result<bool> {
33 Ok(conn.query_row("SELECT COUNT(*) FROM sqlite_master WHERE type = 'table' AND name = ?1", [name], |r| r.get::<_, i64>(0))? > 0)
34}