Skip to content

Commit ca1a70c

Browse files
committed
libsql: Reset statement in Statement::run()
We need to reset the statement to be able to reuse it. Let's call reset() after step() like Rusqlite does. Refs: #2135
1 parent a4ac971 commit ca1a70c

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

libsql/src/local/rows.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,12 @@ impl AsRef<Statement> for Rows {
8282
}
8383
}
8484

85+
impl Drop for Rows {
86+
fn drop(&mut self) {
87+
self.stmt.reset();
88+
}
89+
}
90+
8591
pub struct RowsFuture {
8692
pub(crate) conn: Connection,
8793
pub(crate) sql: String,

libsql/src/local/statement.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ impl Statement {
5353
pub fn run(&self, params: &Params) -> Result<()> {
5454
self.bind(params);
5555
let err = self.inner.step();
56+
self.inner.reset();
5657
match err {
5758
crate::ffi::SQLITE_DONE => Ok(()),
5859
crate::ffi::SQLITE_ROW => Ok(()),

0 commit comments

Comments
 (0)