mirror of
https://github.com/isar/rusqlite.git
synced 2025-09-14 19:52:19 +08:00
Add some missing wrappers (#1139)
* Add some missing wrappers: sqlite3_value_subtype sqlite3_result_subtype sqlite3_changes64 sqlite3_db_readonly sqlite3_txn_state sqlite3_stmt_isexplain sqlite3_vtab_config sqlite3_index_info.idxFlags sqlite3_index_info.colUsed sqlite3_index_info.idxStr sqlite3_vtab_collation * Mark series VTab as innocuous and csv as direct only
This commit is contained in:
19
src/lib.rs
19
src/lib.rs
@@ -927,6 +927,13 @@ impl Connection {
|
||||
pub fn cache_flush(&self) -> Result<()> {
|
||||
self.db.borrow_mut().cache_flush()
|
||||
}
|
||||
|
||||
/// Determine if a database is read-only
|
||||
#[cfg(feature = "modern_sqlite")] // 3.7.11
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "modern_sqlite")))]
|
||||
pub fn is_readonly(&self, db_name: DatabaseName<'_>) -> Result<bool> {
|
||||
self.db.borrow().db_readonly(db_name)
|
||||
}
|
||||
}
|
||||
|
||||
impl fmt::Debug for Connection {
|
||||
@@ -1024,9 +1031,9 @@ bitflags::bitflags! {
|
||||
const SQLITE_OPEN_SHARED_CACHE = 0x0002_0000;
|
||||
/// The database is opened shared cache disabled.
|
||||
const SQLITE_OPEN_PRIVATE_CACHE = 0x0004_0000;
|
||||
/// The database filename is not allowed to be a symbolic link.
|
||||
/// The database filename is not allowed to be a symbolic link. (3.31.0)
|
||||
const SQLITE_OPEN_NOFOLLOW = 0x0100_0000;
|
||||
/// Extended result codes.
|
||||
/// Extended result codes. (3.37.0)
|
||||
const SQLITE_OPEN_EXRESCODE = 0x0200_0000;
|
||||
}
|
||||
}
|
||||
@@ -2012,4 +2019,12 @@ mod test {
|
||||
let db = Connection::open_in_memory()?;
|
||||
db.cache_flush()
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(feature = "modern_sqlite")]
|
||||
pub fn db_readonly() -> Result<()> {
|
||||
let db = Connection::open_in_memory()?;
|
||||
assert!(!db.is_readonly(super::MAIN_DB)?);
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user