libpqxx  7.3.0
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-2020, 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 #include "pqxx/compiler-public.hxx"
17 #include "pqxx/internal/compiler-internal-pre.hxx"
18 
19 #include "pqxx/types.hxx"
20 
21 
22 namespace pqxx::internal::gate
23 {
24 class errorhandler_connection;
25 }
26 
27 
28 namespace pqxx
29 {
35 
52 class PQXX_LIBEXPORT errorhandler
53 {
54 public:
55  explicit errorhandler(connection &);
56  virtual ~errorhandler();
57 
60 
64  virtual bool operator()(char const msg[]) noexcept = 0;
65 
66  errorhandler() = delete;
67  errorhandler(errorhandler const &) = delete;
68  errorhandler &operator=(errorhandler const &) = delete;
69 
70 private:
71  connection *m_home;
72 
73  friend class internal::gate::errorhandler_connection;
74  void unregister() noexcept;
75 };
76 
77 
80 {
81 public:
83 
84  virtual bool operator()(char const[]) noexcept override { return false; }
85 };
86 
90 } // namespace pqxx
91 
92 #include "pqxx/internal/compiler-internal-post.hxx"
93 #endif
pqxx
The home of all libpqxx classes, functions, templates, etc.
Definition: array.hxx:26
pqxx::internal::gate
Definition: connection.hxx:95
pqxx::PQXX_DECLARE_ENUM_CONVERSION
PQXX_DECLARE_ENUM_CONVERSION(pqxx::internal::encoding_group)
pqxx::internal::enc_group
encoding_group enc_group(int libpq_enc_id)
Definition: encodings.cxx:571
pqxx::errorhandler::operator()
virtual bool operator()(char const msg[]) noexcept=0
pqxx::internal
Internal items for libpqxx' own use. Do not use these yourself.
Definition: composite.hxx:74
pqxx::argument_error
Invalid argument passed to libpqxx, similar to std::invalid_argument.
Definition: except.hxx:172
pqxx::connection
Connection to a database.
Definition: connection.hxx:164
pqxx::quiet_errorhandler::operator()
virtual bool operator()(char const[]) noexcept override
Definition: errorhandler.hxx:84
pqxx::errorhandler::~errorhandler
virtual ~errorhandler()
Definition: errorhandler.cxx:26
pqxx::errorhandler::errorhandler
errorhandler()=delete
pqxx::usage_error
Error in usage of libpqxx library, similar to std::logic_error.
Definition: except.hxx:165
pqxx::errorhandler::operator=
errorhandler & operator=(errorhandler const &)=delete
pqxx::internal::get_glyph_scanner
PQXX_PURE glyph_scanner_func * get_glyph_scanner(encoding_group enc)
Definition: encodings.cxx:670
pqxx::internal::name_encoding
PQXX_PURE char const * name_encoding(int encoding_id)
Definition: encodings.cxx:565
pqxx::quiet_errorhandler::quiet_errorhandler
quiet_errorhandler(connection &conn)
Definition: errorhandler.hxx:82
pqxx::internal::for_encoding
constexpr F * for_encoding(encoding_group enc)
Look up instantiation T<enc>::call at runtime.
Definition: encodings.cxx:640
pqxx::internal::find_with_encoding
PQXX_PURE std::size_t find_with_encoding(encoding_group enc, std::string_view haystack, char needle, std::size_t start)
Definition: encodings.cxx:713
pqxx::errorhandler::errorhandler
errorhandler(errorhandler const &)=delete
pqxx::errorhandler
Base class for error-handler callbacks.
Definition: errorhandler.hxx:53
pqxx::quiet_errorhandler
An error handler that suppresses any previously registered error handlers.
Definition: errorhandler.hxx:80