|
Cppgres
Build Postgres extensions in C++
|
Internal subtransaction guard. More...
#include <xact.hpp>
Public Member Functions | |
| internal_subtransaction (bool commit=true) | |
| internal_subtransaction (std::string_view name, bool commit=true) | |
| internal_subtransaction (const internal_subtransaction &)=delete | |
| internal_subtransaction & | operator= (const internal_subtransaction &)=delete |
| internal_subtransaction (internal_subtransaction &&)=delete | |
| internal_subtransaction & | operator= (internal_subtransaction &&)=delete |
| void | commit () |
| Commit the subtransaction now. | |
| void | rollback () |
| Roll the subtransaction back now. | |
Internal subtransaction guard.
Begins an internal subtransaction on construction and finishes it exactly once. Subtransactions nest (as PL exception blocks do).
If the scope is left because an exception is propagating, the subtransaction is rolled back; otherwise, at scope exit it is committed (default) or rolled back per the flag given at construction. Alternatively, it can be finished early by calling commit() or rollback() explicitly.
CurrentMemoryContext and CurrentResourceOwner observed at construction are restored on every path.