libpqxx  7.1.2
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}, transaction_base{c}
64  {
65  register_transaction();
66  }
67 
68  virtual ~nontransaction() override { close(); }
69 
70 private:
71  virtual void do_commit() override {}
72  virtual void do_abort() override {}
73 };
74 } // namespace pqxx
75 
76 #include "pqxx/internal/compiler-internal-post.hxx"
77 #endif
The home of all libpqxx classes, functions, templates, etc.
Definition: array.hxx:25
Connection to a database.
Definition: connection.hxx:136
virtual ~nontransaction() override
Definition: nontransaction.hxx:68
Interface definition (and common code) for "transaction" classes.
Definition: transaction_base.hxx:67
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