Rollback vtab txns when when err code is present in Halt

This commit is contained in:
PThorpe92
2025-11-09 11:07:29 -05:00
parent 30de27b8c6
commit 993c9d34b4

View File

@@ -2254,6 +2254,7 @@ pub fn halt(
if err_code > 0 {
// Any non-FK constraint violation causes the statement subtransaction to roll back.
state.end_statement(&program.connection, pager, EndStatement::RollbackSavepoint)?;
vtab_rollback_all(&program.connection, state)?;
}
match err_code {
0 => {}
@@ -2327,6 +2328,7 @@ pub fn halt(
}
}
/// Call xCommit on all virtual tables that participated in the current transaction.
fn vtab_commit_all(conn: &Connection, state: &mut ProgramState) -> crate::Result<()> {
let mut set = conn.vtab_txn_states.write();
if set.is_empty() {
@@ -2343,6 +2345,7 @@ fn vtab_commit_all(conn: &Connection, state: &mut ProgramState) -> crate::Result
Ok(())
}
/// Rollback all virtual tables that are part of the current transaction.
fn vtab_rollback_all(conn: &Connection, state: &mut ProgramState) -> crate::Result<()> {
let mut set = conn.vtab_txn_states.write();
if set.is_empty() {