libpqxx 7.8.1
errorhandler.hxx
1/* Definition of the pqxx::errorhandler class.
2 *
3 * pqxx::errorhandler handlers errors and warnings in a database session.
4 *
5 * DO NOT INCLUDE THIS FILE DIRECTLY; include pqxx/errorhandler 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_ERRORHANDLER
14#define PQXX_H_ERRORHANDLER
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/types.hxx"
21
22
24{
25class errorhandler_connection;
26}
27
28
29namespace pqxx
30{
35
37
53class PQXX_LIBEXPORT errorhandler
54{
55public:
56 explicit errorhandler(connection &);
57 virtual ~errorhandler();
58
61
65 virtual bool operator()(char const msg[]) noexcept = 0;
66
67 errorhandler() = delete;
68 errorhandler(errorhandler const &) = delete;
70
71private:
72 connection *m_home;
73
74 friend class internal::gate::errorhandler_connection;
75 void unregister() noexcept;
76};
77
78
81{
82public:
85
87 virtual bool operator()(char const[]) noexcept override { return false; }
88};
89
91} // namespace pqxx
92#endif
The home of all libpqxx classes, functions, templates, etc.
Definition array.hxx:33
Definition connection.hxx:112
Connection to a database.
Definition connection.hxx:253
Base class for error-handler callbacks.
Definition errorhandler.hxx:54
virtual bool operator()(char const msg[]) noexcept=0
errorhandler & operator=(errorhandler const &)=delete
errorhandler(errorhandler const &)=delete
An error handler that suppresses any previously registered error handlers.
Definition errorhandler.hxx:81
virtual bool operator()(char const[]) noexcept override
Revert to previous handling of error notices.
Definition errorhandler.hxx:87
quiet_errorhandler(connection &conn)
Suppress error notices.
Definition errorhandler.hxx:84