libpqxx  7.5.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-2021, 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 
75 class PQXX_LIBEXPORT subtransaction : public transaction_focus,
76  public dbtransaction
77 {
78 public:
80  explicit subtransaction(dbtransaction &t, std::string_view tname = ""sv);
81 
83  explicit subtransaction(subtransaction &t, std::string_view name = ""sv);
84 
85  virtual ~subtransaction() noexcept override;
86 
87 private:
88  std::string quoted_name() const
89  {
90  return quote_name(transaction_focus::name());
91  }
92  virtual void do_commit() override;
93 };
94 } // namespace pqxx
95 
96 #include "pqxx/internal/compiler-internal-post.hxx"
97 #endif
Base class for things that monopolise a transaction's attention.
Definition: transaction_focus.hxx:27
The home of all libpqxx classes, functions, templates, etc.
Definition: array.hxx:25
std::string_view name() const noexcept
Name for this object, if the caller passed one; empty string otherwise.
Definition: transaction_focus.hxx:55
"Transaction" nested within another transaction
Definition: subtransaction.hxx:75
Abstract transaction base class: bracket transactions on the database.
Definition: dbtransaction.hxx:52