#![forbid(unsafe_code)]
mod db;
mod error;
pub mod files;
#[cfg(feature = "sync")]
pub mod sync;
mod tx;
pub use db::{
RawKey, apply_key, encrypt_plaintext_in_place, has_cipher, migrate, open, open_foreign_readonly, open_in_memory, open_readonly, rekey,
schema_version, snapshot_to,
};
pub use error::{Result, StorageError};
pub use rusqlite;
pub use tx::{begin, release, rollback, savepoint};
pub fn quote_ident(ident: &str) -> String {
format!("\"{}\"", ident.replace('"', "\"\""))
}
pub fn table_exists(conn: &rusqlite::Connection, name: &str) -> Result<bool> {
Ok(conn.query_row("SELECT COUNT(*) FROM sqlite_master WHERE type = 'table' AND name = ?1", [name], |r| r.get::<_, i64>(0))? > 0)
}