libpqxx 7.7.0
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-2022, 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/connection.hxx"
17#include "pqxx/result.hxx"
18#include "pqxx/transaction.hxx"
19
20namespace pqxx
21{
22using namespace std::literals;
23
25
51class PQXX_LIBEXPORT nontransaction final : public transaction_base
52{
53public:
55
60 nontransaction(connection &c, std::string_view tname = ""sv) :
61 transaction_base{c, tname, std::shared_ptr<std::string>{}}
62 {
63 register_transaction();
64 }
65
66 virtual ~nontransaction() override { close(); }
67
68private:
69 virtual void do_commit() override {}
70};
71} // namespace pqxx
72#endif
The home of all libpqxx classes, functions, templates, etc.
Definition: array.hxx:23
Connection to a database.
Definition: connection.hxx:181
Simple "transaction" class offering no transactional integrity.
Definition: nontransaction.hxx:52
nontransaction(connection &c, std::string_view tname=""sv)
Constructor.
Definition: nontransaction.hxx:60
virtual ~nontransaction() override
Definition: nontransaction.hxx:66
Interface definition (and common code) for "transaction" classes.
Definition: transaction_base.hxx:73