Skip to content

Commit a3936a9

Browse files
committed
Fix Statement.run() "database busy" errors
We need to reset the statement after execution; otherwise database ends up being locked after the write.
1 parent 95c7793 commit a3936a9

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -654,16 +654,16 @@ impl Statement {
654654
let start = std::time::Instant::now();
655655

656656
let mut stmt = self.stmt.lock().await;
657-
stmt.reset();
658657
let params = map_params(&stmt, params)?;
659-
stmt.query(params).await.map_err(Error::from)?;
658+
stmt.run(params).await.map_err(Error::from)?;
660659
let changes = if conn.total_changes() == total_changes_before {
661660
0
662661
} else {
663662
conn.changes()
664663
};
665664
let last_insert_row_id = conn.last_insert_rowid();
666665
let duration = start.elapsed().as_secs_f64();
666+
stmt.reset();
667667
Ok(RunResult {
668668
changes: changes as f64,
669669
duration,

0 commit comments

Comments
 (0)