libpqxx
The C++ client library for PostgreSQL
errorhandler.hxx
Go to the documentation of this file.
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-2026, 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_ERRORHANDLER_HXX
14 #define PQXX_ERRORHANDLER_HXX
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 
23 namespace pqxx::internal::gate
24 {
25 class errorhandler_connection;
26 } // namespace pqxx::internal::gate
27 
28 
29 namespace pqxx
30 {
35 
37 
46 {
47 public:
48  [[deprecated("Use a notice handler instead.")]]
49  explicit errorhandler(connection &);
50  virtual ~errorhandler();
51 
54 
58  PQXX_ZARGS virtual bool operator()(char const msg[]) noexcept = 0;
59 
60  errorhandler() = delete;
61  errorhandler(errorhandler const &) = delete;
62  errorhandler(errorhandler &&) = delete;
63  errorhandler &operator=(errorhandler const &) = delete;
65 
66 private:
67  connection *m_home;
68 
70  void unregister() noexcept;
71 };
72 
73 
76 {
77 public:
80  [[deprecated("Use notice handlers instead.")]]
82  errorhandler{cx}
83  {}
85 
87  PQXX_ZARGS bool operator()(char const[]) noexcept override { return false; }
88 
89  quiet_errorhandler() = delete;
90 };
91 
93 } // namespace pqxx
94 #endif
Connection to a database.
Definition: connection.hxx:273
Definition: errorhandler.hxx:46
errorhandler & operator=(errorhandler &&)=delete
errorhandler(errorhandler &&)=delete
errorhandler & operator=(errorhandler const &)=delete
errorhandler(errorhandler const &)=delete
virtual PQXX_ZARGS bool operator()(char const msg[]) noexcept=0
Definition: errorhandler-connection.hxx:9
Definition: errorhandler.hxx:76
PQXX_ZARGS bool operator()(char const[]) noexcept override
Revert to previous handling of error notices.
Definition: errorhandler.hxx:87
quiet_errorhandler(connection &cx)
Suppress error notices.
Definition: errorhandler.hxx:81
#define PQXX_ZARGS
Definition: header-pre.hxx:136
#define PQXX_LIBEXPORT
Definition: header-pre.hxx:206
Definition: connection.hxx:94
The home of all libpqxx classes, functions, templates, etc.
Definition: array.cxx:26