libpqxx
7.0.1
|
Slightly slower, better-fortified version of transaction. More...
#include <robusttransaction.hxx>
Public Member Functions | |
robusttransaction (connection &c, std::string_view name=std::string_view{}) | |
virtual | ~robusttransaction () noexcept override |
![]() | |
virtual | ~basic_robusttransaction () override=0 |
Additional Inherited Members | |
![]() | |
basic_robusttransaction (connection &c, char const begin_command[]) | |
![]() | |
dbtransaction (connection &c) | |
Slightly slower, better-fortified version of transaction.
Requires PostgreSQL 10 or better.
robusttransaction is similar to transaction, but spends more time and effort to deal with the hopefully rare case that the connection to the backend is lost just while it's trying to commit. In such cases, the client does not know whether the backend (on the other side of the broken connection) managed to commit the transaction.
Whe this happens, robusttransaction tries to reconnect to the database and figure out what happened.
This service level was made optional since you may not want to pay the overhead where it is not necessary. Certainly the use of this class makes no sense for local connections, or for transactions that read the database but never modify it, or for noncritical database manipulations.
Besides being slower, it's also more complex. Which means that in practice a robusttransaction could actually fail more instead of less often than a normal transaction. What robusttransaction tries to achieve is to give you certainty, not just be more successful per se.
|
explicit |
Create robusttransaction of given name.
c | Connection inside which this robusttransaction should live. |
name | optional human-readable name for this transaction. |
|
overridevirtualnoexcept |