libpqxx
errorhandler.hxx
1
13#ifndef PQXX_H_ERRORHANDLER
14#define PQXX_H_ERRORHANDLER
15
16#include "pqxx/compiler-public.hxx"
17#include "pqxx/compiler-internal-pre.hxx"
18
19#include "pqxx/types.hxx"
20
21
22namespace pqxx
23{
24namespace internal
25{
26namespace gate
27{
28class errorhandler_connection_base;
29}
30}
31
38
54class PQXX_LIBEXPORT errorhandler
55{
56public:
57 explicit errorhandler(connection_base &);
58 virtual ~errorhandler();
59
61
65 virtual bool operator()(const char msg[]) noexcept =0;
66
67private:
68 connection_base *m_home;
69
70 friend class internal::gate::errorhandler_connection_base;
71 void unregister() noexcept;
72
73 errorhandler() =delete;
74 errorhandler(const errorhandler &) =delete;
75 errorhandler &operator=(const errorhandler &) =delete;
76};
77
78
81{
82public:
84
85 virtual bool operator()(const char[]) noexcept override { return false; }
86};
87
92} // namespace pqxx
93
94#include "pqxx/compiler-internal-post.hxx"
95
96#endif
The home of all libpqxx classes, functions, templates, etc.
Definition: array.hxx:26
connection_base abstract base class; represents a connection to a database.
Definition: connection_base.hxx:140
Base class for error-handler callbacks.
Definition: errorhandler.hxx:55
virtual bool operator()(const char msg[]) noexcept=0
Define in subclass: receive an error or warning message from the database.
An error handler that suppresses any previously registered error handlers.
Definition: errorhandler.hxx:81
virtual bool operator()(const char[]) noexcept override
Define in subclass: receive an error or warning message from the database.
Definition: errorhandler.hxx:85
quiet_errorhandler(connection_base &conn)
Definition: errorhandler.hxx:83