mirror of
https://github.com/isar/rusqlite.git
synced 2025-10-18 00:22:24 +08:00
pragma_update fails with ExecuteReturnedResults
Ideally, while executing a batch, we should fail if it contains a SELECT statement. But currently there is no way to make the distinction between a SELECT and a PRAGMA which both updates and returns a row. So we fail only when `extra_check` feature is activated.
This commit is contained in:
@@ -451,7 +451,8 @@ impl Connection {
|
||||
let mut sql = sql;
|
||||
while !sql.is_empty() {
|
||||
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);
|
||||
}
|
||||
let tail = stmt.stmt.tail();
|
||||
|
Reference in New Issue
Block a user