11 #ifndef PQXX_H_TRANSACTOR 12 #define PQXX_H_TRANSACTOR 14 #include "pqxx/compiler-public.hxx" 15 #include "pqxx/internal/compiler-internal-pre.hxx" 18 #include <type_traits> 20 #include "pqxx/connection.hxx" 21 #include "pqxx/transaction.hxx" 99 template<
typename TRANSACTION_CALLBACK>
100 inline auto perform(TRANSACTION_CALLBACK &&callback,
int attempts = 3)
101 -> std::invoke_result_t<TRANSACTION_CALLBACK>
104 throw std::invalid_argument{
105 "Zero or negative number of attempts passed to pqxx::perform()."};
107 for (; attempts > 0; --attempts)
111 return std::invoke(callback);
147 #include "pqxx/internal/compiler-internal-post.hxx" auto perform(TRANSACTION_CALLBACK &&callback, int attempts=3) -> std::invoke_result_t< TRANSACTION_CALLBACK >
Simple way to execute a transaction with automatic retry.
Definition: transactor.hxx:100
The backend saw itself forced to roll back the ongoing transaction.
Definition: except.hxx:113
Exception class for lost or failed backend connection.
Definition: except.hxx:67
We can't tell whether our last statement succeeded.
Definition: except.hxx:139
The home of all libpqxx classes, functions, templates, etc.
Definition: array.hxx:25
"Help, I don't know whether transaction was committed successfully!"
Definition: except.hxx:106
Internal error in libpqxx library.
Definition: except.hxx:157