mirror of
https://github.com/isar/rusqlite.git
synced 2024-11-22 16:29:20 +08:00
Merge pull request #401 from gwenn/readonly
Impossible to execute a pragma in 0.14.0 #400
This commit is contained in:
commit
bd1756adef
16
src/lib.rs
16
src/lib.rs
@ -1360,6 +1360,22 @@ mod test {
|
|||||||
assert!(bad_query_result.is_err());
|
assert!(bad_query_result.is_err());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_pragma_query_row() {
|
||||||
|
let db = checked_memory_handle();
|
||||||
|
|
||||||
|
assert_eq!(
|
||||||
|
"memory",
|
||||||
|
db.query_row::<String, _>("PRAGMA journal_mode", &[], |r| r.get(0))
|
||||||
|
.unwrap()
|
||||||
|
);
|
||||||
|
assert_eq!(
|
||||||
|
"off",
|
||||||
|
db.query_row::<String, _>("PRAGMA journal_mode=off", &[], |r| r.get(0))
|
||||||
|
.unwrap()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_prepare_failures() {
|
fn test_prepare_failures() {
|
||||||
let db = checked_memory_handle();
|
let db = checked_memory_handle();
|
||||||
|
@ -516,15 +516,17 @@ impl<'conn> Statement<'conn> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(not(feature = "bundled"))]
|
#[cfg(not(feature = "bundled"))]
|
||||||
|
#[inline]
|
||||||
fn check_readonly(&self) -> Result<()> {
|
fn check_readonly(&self) -> Result<()> {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "bundled")]
|
#[cfg(feature = "bundled")]
|
||||||
|
#[inline]
|
||||||
fn check_readonly(&self) -> Result<()> {
|
fn check_readonly(&self) -> Result<()> {
|
||||||
if !self.stmt.readonly() {
|
/*if !self.stmt.readonly() { does not work for PRAGMA
|
||||||
return Err(Error::InvalidQuery);
|
return Err(Error::InvalidQuery);
|
||||||
}
|
}*/
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user