libpqxx
The C++ client library for PostgreSQL
dbtransaction.hxx
Go to the documentation of this file.
1 /* Definition of the pqxx::dbtransaction abstract base class.
2  *
3  * pqxx::dbransaction defines a real transaction on the database.
4  *
5  * DO NOT INCLUDE THIS FILE DIRECTLY; include pqxx/dbtransaction instead.
6  *
7  * Copyright (c) 2000-2026, 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_DBTRANSACTION_HXX
14 #define PQXX_DBTRANSACTION_HXX
15 
16 #if !defined(PQXX_HEADER_PRE)
17 # error "Include libpqxx headers as <pqxx/header>, not <pqxx/header.hxx>."
18 #endif
19 
21 
22 namespace pqxx
23 {
25 
54 {
55 public:
56  dbtransaction() = delete;
57 
58 protected:
60  explicit dbtransaction(connection &cx, sl loc = sl::current()) :
61  transaction_base{cx, loc}
62  {}
65  connection &cx, std::string_view tname, sl loc = sl::current()) :
66  transaction_base{cx, tname, loc}
67  {}
70  connection &cx, std::string_view tname,
71  std::shared_ptr<std::string> rollback_cmd, sl loc = sl::current()) :
72  transaction_base{cx, tname, std::move(rollback_cmd), loc}
73  {}
74 };
75 } // namespace pqxx
76 #endif
Connection to a database.
Definition: connection.hxx:273
dbtransaction(connection &cx, std::string_view tname, std::shared_ptr< std::string > rollback_cmd, sl loc=sl::current())
Begin transaction.
Definition: dbtransaction.hxx:69
dbtransaction(connection &cx, std::string_view tname, sl loc=sl::current())
Begin transaction.
Definition: dbtransaction.hxx:64
dbtransaction(connection &cx, sl loc=sl::current())
Begin transaction.
Definition: dbtransaction.hxx:60
Abstract transaction base class: bracket transactions on the database.
Definition: dbtransaction.hxx:54
Interface definition (and common code) for "transaction" classes.
Definition: transaction_base.hxx:151
#define PQXX_LIBEXPORT
Definition: header-pre.hxx:206
#define PQXX_NOVTABLE
Definition: header-pre.hxx:221
The home of all libpqxx classes, functions, templates, etc.
Definition: array.cxx:26
std::source_location sl
Convenience alias for std::source_location. It's just too long.
Definition: types.hxx:38