Cppgres
Build Postgres extensions in C++
Loading...
Searching...
No Matches
cppgres::internal_subtransaction Struct Reference

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_subtransactionoperator= (const internal_subtransaction &)=delete
 
 internal_subtransaction (internal_subtransaction &&)=delete
 
internal_subtransactionoperator= (internal_subtransaction &&)=delete
 
void commit ()
 Commit the subtransaction now.
 
void rollback ()
 Roll the subtransaction back now.
 

Detailed Description

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.


The documentation for this struct was generated from the following file: