libpqxx 7.8.1
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-2023, 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#if !defined(PQXX_HEADER_PRE)
17# error "Include libpqxx headers as <pqxx/header>, not <pqxx/header.hxx>."
18#endif
19
20#include "pqxx/connection.hxx"
21#include "pqxx/result.hxx"
22#include "pqxx/transaction.hxx"
23
24namespace pqxx
25{
26using namespace std::literals;
27
29
55class PQXX_LIBEXPORT nontransaction final : public transaction_base
56{
57public:
59
64 nontransaction(connection &c, std::string_view tname = ""sv) :
65 transaction_base{c, tname, std::shared_ptr<std::string>{}}
66 {
67 register_transaction();
68 }
69
70 virtual ~nontransaction() override { close(); }
71
72private:
73 virtual void do_commit() override {}
74};
75} // namespace pqxx
76#endif
The home of all libpqxx classes, functions, templates, etc.
Definition array.hxx:33
Connection to a database.
Definition connection.hxx:253
Simple "transaction" class offering no transactional integrity.
Definition nontransaction.hxx:56
nontransaction(connection &c, std::string_view tname=""sv)
Constructor.
Definition nontransaction.hxx:64
virtual ~nontransaction() override
Definition nontransaction.hxx:70
Interface definition (and common code) for "transaction" classes.
Definition transaction_base.hxx:88