libpqxx  7.0.5
nontransaction.hxx
1 /* Definition of the pqxx::nontransaction class.
2  *
3  * pqxx::nontransaction provides nontransactional database access
4  *
5  * DO NOT INCLUDE THIS FILE DIRECTLY; include pqxx/nontransaction 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_NONTRANSACTION
14 #define PQXX_H_NONTRANSACTION
15 
16 #include "pqxx/compiler-public.hxx"
17 #include "pqxx/internal/compiler-internal-pre.hxx"
18 
19 #include "pqxx/connection.hxx"
20 #include "pqxx/result.hxx"
21 #include "pqxx/transaction.hxx"
22 
23 namespace pqxx
24 {
26 
52 class PQXX_LIBEXPORT nontransaction final : public transaction_base
53 {
54 public:
56 
61  explicit nontransaction(
62  connection &c, std::string const &name = std::string{}) :
63  namedclass{"nontransaction", name},
65  {
66  register_transaction();
67  }
68 
69  virtual ~nontransaction() override { close(); }
70 
71 private:
72  virtual void do_commit() override {}
73  virtual void do_abort() override {}
74 };
75 } // namespace pqxx
76 
77 #include "pqxx/internal/compiler-internal-post.hxx"
78 #endif
The home of all libpqxx classes, functions, templates, etc.
Definition: array.hxx:25
Connection to a database.
Definition: connection.hxx:135
Interface definition (and common code) for "transaction" classes.
Definition: transaction_base.hxx:97
virtual ~nontransaction() override
Definition: nontransaction.hxx:69
nontransaction(connection &c, std::string const &name=std::string{})
Constructor.
Definition: nontransaction.hxx:61
Simple "transaction" class offering no transactional integrity.
Definition: nontransaction.hxx:52