mirror of
https://github.com/isar/rusqlite.git
synced 2024-11-26 11:31:37 +08:00
Merge pull request #794 from gwenn/fix_pragma_update
pragma_update fails with ExecuteReturnedResults
This commit is contained in:
commit
da2d2e371a
@ -451,7 +451,8 @@ impl Connection {
|
|||||||
let mut sql = sql;
|
let mut sql = sql;
|
||||||
while !sql.is_empty() {
|
while !sql.is_empty() {
|
||||||
let stmt = self.prepare(sql)?;
|
let stmt = self.prepare(sql)?;
|
||||||
if !stmt.stmt.is_null() && stmt.step()? {
|
if !stmt.stmt.is_null() && stmt.step()? && cfg!(feature = "extra_check") {
|
||||||
|
// Some PRAGMA may return rows
|
||||||
return Err(Error::ExecuteReturnedResults);
|
return Err(Error::ExecuteReturnedResults);
|
||||||
}
|
}
|
||||||
let tail = stmt.stmt.tail();
|
let tail = stmt.stmt.tail();
|
||||||
|
@ -430,4 +430,15 @@ mod test {
|
|||||||
sql.push_string_literal("value'; --");
|
sql.push_string_literal("value'; --");
|
||||||
assert_eq!("'value''; --'", sql.as_str());
|
assert_eq!("'value''; --'", sql.as_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn locking_mode() {
|
||||||
|
let db = Connection::open_in_memory().unwrap();
|
||||||
|
let r = db.pragma_update(None, "locking_mode", &"exclusive");
|
||||||
|
if cfg!(feature = "extra_check") {
|
||||||
|
r.unwrap_err();
|
||||||
|
} else {
|
||||||
|
r.unwrap();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user