libpqxx
The C++ client library for PostgreSQL
 
Loading...
Searching...
No Matches
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-2025, 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{
26}
27
28
29namespace pqxx
30{
35
37
45class PQXX_LIBEXPORT errorhandler
46{
47public:
48 [[deprecated("Use a notice handler instead.")]]
49 explicit errorhandler(connection &);
50 virtual ~errorhandler();
51
54
58 virtual bool operator()(char const msg[]) noexcept = 0;
59
60 errorhandler() = delete;
61 errorhandler(errorhandler const &) = delete;
62 errorhandler &operator=(errorhandler const &) = delete;
63
64private:
65 connection *m_home;
66
68 void unregister() noexcept;
69};
70
71
74{
75public:
76#include "pqxx/internal/ignore-deprecated-pre.hxx"
78 [[deprecated("Use notice handlers instead.")]]
79 quiet_errorhandler(connection &cx) :
80 errorhandler{cx}
81 {}
82#include "pqxx/internal/ignore-deprecated-post.hxx"
83
85 virtual bool operator()(char const[]) noexcept override { return false; }
86};
87
89} // namespace pqxx
90#endif
errorhandler(connection &)
Definition errorhandler.cxx:22
virtual bool operator()(char const msg[]) noexcept=0
Definition errorhandler-connection.hxx:6
virtual bool operator()(char const[]) noexcept override
End a code block started by "ignore-deprecated-pre.hxx".
Definition errorhandler.hxx:85
quiet_errorhandler(connection &cx)
Suppress error notices.
Definition errorhandler.hxx:79
The home of all libpqxx classes, functions, templates, etc.
Definition array.cxx:27