File tree Expand file tree Collapse file tree 1 file changed +21
-6
lines changed
Expand file tree Collapse file tree 1 file changed +21
-6
lines changed Original file line number Diff line number Diff line change @@ -1639,15 +1639,30 @@ void Transaction::rollback(thread_db* tdbb, bool retain)
16391639 doRollback (&status, tdbb, retain);
16401640
16411641 Connection& conn = m_connection;
1642- if (!retain)
1642+ const bool hasErrors = status->getState () & IStatus::STATE_ERRORS;
1643+
1644+ const auto cleanup = [&]()
16431645 {
1644- detachFromJrdTran ();
1645- m_connection.deleteTransaction (tdbb, this );
1646- }
1646+ if (!retain)
1647+ {
1648+ detachFromJrdTran ();
1649+ m_connection.deleteTransaction (tdbb, this );
1650+ }
1651+ };
16471652
1648- if (status->getState () & IStatus::STATE_ERRORS) {
1649- conn.raise (&status, tdbb, " transaction rollback" );
1653+ try
1654+ {
1655+ if (hasErrors) {
1656+ conn.raise (&status, tdbb, " transaction rollback" );
1657+ }
1658+ }
1659+ catch (const Exception&)
1660+ {
1661+ cleanup ();
1662+ throw ;
16501663 }
1664+
1665+ cleanup ();
16511666}
16521667
16531668Transaction* Transaction::getTransaction (thread_db* tdbb, Connection* conn, TraScope tra_scope)
You can’t perform that action at this time.
0 commit comments