libpqxx  7.3.0
subtransaction.hxx
1 /* Definition of the pqxx::subtransaction class.
2  *
3  * pqxx::subtransaction is a nested transaction, i.e. one within a transaction.
4  *
5  * DO NOT INCLUDE THIS FILE DIRECTLY; include pqxx/subtransaction instead.
6  *
7  * Copyright (c) 2000-2020, Jeroen T. Vermeulen.
8  *
9  * See COPYING for copyright license. If you did not receive a file called
10  * COPYING with this source code, please notify the distributor of this
11  * mistake, or contact the author.
12  */
13 #ifndef PQXX_H_SUBTRANSACTION
14 #define PQXX_H_SUBTRANSACTION
15 
16 #include "pqxx/compiler-public.hxx"
17 #include "pqxx/internal/compiler-internal-pre.hxx"
18 
19 #include "pqxx/dbtransaction.hxx"
20 
21 namespace pqxx
22 {
26 
70 class PQXX_LIBEXPORT subtransaction : public internal::transactionfocus,
71  public dbtransaction
72 {
73 public:
75  explicit subtransaction(dbtransaction &t, std::string_view tname = ""sv);
76 
78  explicit subtransaction(subtransaction &t, std::string_view name = ""sv);
79 
80  virtual ~subtransaction() noexcept override;
81 
82 private:
83  std::string quoted_name() const
84  {
85  return quote_name(transactionfocus::name());
86  }
87  virtual void do_commit() override;
88 };
89 } // namespace pqxx
90 
91 #include "pqxx/internal/compiler-internal-post.hxx"
92 #endif
pqxx::dbtransaction
Abstract transaction base class: bracket transactions on the database.
Definition: dbtransaction.hxx:53
pqxx
The home of all libpqxx classes, functions, templates, etc.
Definition: array.hxx:26
pqxx::subtransaction
"Transaction" nested within another transaction
Definition: subtransaction.hxx:72
pqxx::subtransaction::subtransaction
subtransaction(dbtransaction &t, std::string_view tname=""sv)
Nest a subtransaction nested in another transaction.
Definition: subtransaction.cxx:29
pqxx::connection::adorn_name
std::string adorn_name(std::string_view)
Suffix unique number to name to make it unique within session context.
Definition: connection.cxx:1027
pqxx::subtransaction::~subtransaction
virtual ~subtransaction() noexcept override
Definition: subtransaction.cxx:55
pqxx::transaction_base::conn
connection & conn() const
The connection in which this transaction lives.
Definition: transaction_base.hxx:451