mirror of
https://github.com/isar/rusqlite.git
synced 2024-11-23 00:39:20 +08:00
Replace execute_batch usages by execute
Because execute_batch does not support unlock_notify
This commit is contained in:
parent
a9b700c841
commit
f37519ad51
@ -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.
|
||||
|
@ -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(())
|
||||
|
@ -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<Savepoint<'_>> {
|
||||
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
|
||||
|
Loading…
Reference in New Issue
Block a user