diff --git a/src/pragma.rs b/src/pragma.rs index b115f8f..b1dc77f 100644 --- a/src/pragma.rs +++ b/src/pragma.rs @@ -256,7 +256,8 @@ impl Connection { // The two syntaxes yield identical results. sql.push_equal_sign(); sql.push_value(pragma_value)?; - self.execute_batch(&sql) + self.execute(&sql, NO_PARAMS)?; + Ok(()) } /// Set a new value to `pragma_name` and return the updated value. diff --git a/src/statement.rs b/src/statement.rs index 68d39da..9133dda 100644 --- a/src/statement.rs +++ b/src/statement.rs @@ -646,7 +646,7 @@ impl Statement<'_> { #[inline] fn check_update(&self) -> Result<()> { // sqlite3_column_count works for DML but not for DDL (ie ALTER) - if self.column_count() > 0 || self.stmt.readonly() { + if self.column_count() > 0 && self.stmt.readonly() { return Err(Error::ExecuteReturnedResults); } Ok(()) diff --git a/src/transaction.rs b/src/transaction.rs index 5e649b7..6d4ef26 100644 --- a/src/transaction.rs +++ b/src/transaction.rs @@ -1,4 +1,4 @@ -use crate::{Connection, Result}; +use crate::{Connection, Result, NO_PARAMS}; use std::ops::Deref; /// Options for transaction behavior. See [BEGIN @@ -120,7 +120,7 @@ impl Transaction<'_> { TransactionBehavior::Immediate => "BEGIN IMMEDIATE", TransactionBehavior::Exclusive => "BEGIN EXCLUSIVE", }; - conn.execute_batch(query).map(move |_| Transaction { + conn.execute(query, NO_PARAMS).map(move |_| Transaction { conn, drop_behavior: DropBehavior::Rollback, }) @@ -180,7 +180,7 @@ impl Transaction<'_> { } fn commit_(&mut self) -> Result<()> { - self.conn.execute_batch("COMMIT")?; + self.conn.execute("COMMIT", NO_PARAMS)?; Ok(()) } @@ -190,7 +190,7 @@ impl Transaction<'_> { } fn rollback_(&mut self) -> Result<()> { - self.conn.execute_batch("ROLLBACK")?; + self.conn.execute("ROLLBACK", NO_PARAMS)?; Ok(()) } @@ -238,7 +238,7 @@ impl Savepoint<'_> { name: T, ) -> Result> { let name = name.into(); - conn.execute_batch(&format!("SAVEPOINT {}", name)) + conn.execute(&format!("SAVEPOINT {}", name), NO_PARAMS) .map(|_| Savepoint { conn, name, @@ -291,7 +291,7 @@ impl Savepoint<'_> { } fn commit_(&mut self) -> Result<()> { - self.conn.execute_batch(&format!("RELEASE {}", self.name))?; + self.conn.execute(&format!("RELEASE {}", self.name), NO_PARAMS)?; self.committed = true; Ok(()) } @@ -304,7 +304,8 @@ impl Savepoint<'_> { /// rolled back, and can be rolled back again or committed. pub fn rollback(&mut self) -> Result<()> { self.conn - .execute_batch(&format!("ROLLBACK TO {}", self.name)) + .execute(&format!("ROLLBACK TO {}", self.name), NO_PARAMS)?; + Ok(()) } /// Consumes the savepoint, committing or rolling back according to the