libpqxx
The C++ client library for PostgreSQL
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-2024, 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
23namespace pqxx::internal::gate
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;
69 errorhandler &operator=(errorhandler const &) = delete;
70
71private:
72 connection *m_home;
73
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
Connection to a database.
Definition: connection.hxx:230
Base class for error-handler callbacks.
Definition: errorhandler.hxx:54
virtual bool operator()(char const msg[]) noexcept=0
Definition: errorhandler-connection.hxx:6
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
The home of all libpqxx classes, functions, templates, etc.
Definition: array.cxx:27