Keep Windows intent and diagnostic databases read-only with rusqlite 0.41
This commit is contained in:
@@ -62,7 +62,7 @@ impl Snapshot {
|
|||||||
let db = Connection::open_with_flags(path, OpenFlags::SQLITE_OPEN_READ_ONLY)?;
|
let db = Connection::open_with_flags(path, OpenFlags::SQLITE_OPEN_READ_ONLY)?;
|
||||||
db.execute_batch("PRAGMA query_only=ON; PRAGMA trusted_schema=OFF; BEGIN;")?;
|
db.execute_batch("PRAGMA query_only=ON; PRAGMA trusted_schema=OFF; BEGIN;")?;
|
||||||
ensure!(
|
ensure!(
|
||||||
db.is_readonly(rusqlite::DatabaseName::Main)?,
|
db.is_readonly(rusqlite::MAIN_DB)?,
|
||||||
"read-only database required"
|
"read-only database required"
|
||||||
);
|
);
|
||||||
Ok(Self { db, _held: handles })
|
Ok(Self { db, _held: handles })
|
||||||
|
|||||||
@@ -237,7 +237,7 @@ impl Store {
|
|||||||
pub fn open_empty_history_snapshot() -> Result<Self> {
|
pub fn open_empty_history_snapshot() -> Result<Self> {
|
||||||
let store = Self::open(false)?;
|
let store = Self::open(false)?;
|
||||||
ensure!(
|
ensure!(
|
||||||
store.db.is_readonly(rusqlite::DatabaseName::Main)?,
|
store.db.is_readonly(rusqlite::MAIN_DB)?,
|
||||||
"read-only intent snapshot required"
|
"read-only intent snapshot required"
|
||||||
);
|
);
|
||||||
store
|
store
|
||||||
|
|||||||
Reference in New Issue
Block a user