Skip to content

Fix Transaction cleanup after rollback - #586

Draft
SRombauts wants to merge 1 commit into
masterfrom
fix-transaction-rollback-cleanup
Draft

SRombauts wants to merge 1 commit into
masterfrom
fix-transaction-rollback-cleanup

Conversation

@SRombauts

Copy link
Copy Markdown
Owner

Summary

  • mark a transaction as finished after a successful manual rollback()
  • avoid a redundant destructor rollback once the transaction is finished
  • use non-throwing tryExec() in the destructor and report rollback failures through SQLITECPP_ASSERT
  • add a regression test proving that a finished Transaction does not affect a later transaction on the same connection

The private state remains one bool, so this does not change the class layout.

@SRombauts
SRombauts force-pushed the fix-transaction-rollback-cleanup branch from 9c92dd0 to 2778666 Compare September 23, 2026 14:07
@coveralls

coveralls commented Sep 23, 2026 •

Copy link
Copy Markdown

Coverage Status

coverage: 99.714%. remained the same — fix-transaction-rollback-cleanup into master

@SRombauts SRombauts self-assigned this Sep 24, 2026
@SRombauts
SRombauts force-pushed the fix-transaction-rollback-cleanup branch from 2778666 to ea95fc6 Compare September 24, 2026 06:42
@SRombauts
SRombauts marked this pull request as draft September 24, 2026 07:33
Comment thread src/Transaction.cpp
}
const int ret = mDatabase.tryExec("ROLLBACK TRANSACTION");
(void)ret; // Avoid an unused-variable warning when assertions are disabled.
SQLITECPP_ASSERT(SQLITE_OK == ret, mDatabase.getErrorMsg());

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not too comfortable with introducing more SQLITECPP_ASSERT() into the codebase.
I'll consider a dedicated mechanism to report errors so that the application can properly handle them

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants