mirror of
https://github.com/aljazceru/turso.git
synced 2025-12-18 17:14:20 +01:00
Rollback vtab txns when when err code is present in Halt
This commit is contained in:
@@ -2254,6 +2254,7 @@ pub fn halt(
|
|||||||
if err_code > 0 {
|
if err_code > 0 {
|
||||||
// Any non-FK constraint violation causes the statement subtransaction to roll back.
|
// Any non-FK constraint violation causes the statement subtransaction to roll back.
|
||||||
state.end_statement(&program.connection, pager, EndStatement::RollbackSavepoint)?;
|
state.end_statement(&program.connection, pager, EndStatement::RollbackSavepoint)?;
|
||||||
|
vtab_rollback_all(&program.connection, state)?;
|
||||||
}
|
}
|
||||||
match err_code {
|
match err_code {
|
||||||
0 => {}
|
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<()> {
|
fn vtab_commit_all(conn: &Connection, state: &mut ProgramState) -> crate::Result<()> {
|
||||||
let mut set = conn.vtab_txn_states.write();
|
let mut set = conn.vtab_txn_states.write();
|
||||||
if set.is_empty() {
|
if set.is_empty() {
|
||||||
@@ -2343,6 +2345,7 @@ fn vtab_commit_all(conn: &Connection, state: &mut ProgramState) -> crate::Result
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Rollback all virtual tables that are part of the current transaction.
|
||||||
fn vtab_rollback_all(conn: &Connection, state: &mut ProgramState) -> crate::Result<()> {
|
fn vtab_rollback_all(conn: &Connection, state: &mut ProgramState) -> crate::Result<()> {
|
||||||
let mut set = conn.vtab_txn_states.write();
|
let mut set = conn.vtab_txn_states.write();
|
||||||
if set.is_empty() {
|
if set.is_empty() {
|
||||||
|
|||||||
Reference in New Issue
Block a user