libpqxx  7.0.7
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::quiet_errorhandler::operator()
virtual bool operator()(char const[]) noexcept override
Definition: errorhandler.hxx:84
pqxx::internal::name_encoding
const char * name_encoding(int encoding_id)
Definition: encodings.cxx:579
pqxx
The home of all libpqxx classes, functions, templates, etc.
Definition: array.hxx:25
pqxx::internal::gate
Definition: connection.hxx:65
pqxx::to_string
std::string to_string(field const &value)
Convert a field to a string.
Definition: result.cxx:478
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:585
pqxx::errorhandler::errorhandler
errorhandler()=delete
pqxx::internal
Private namespace for libpqxx's internal use; do not access.
Definition: connection.hxx:59
pqxx::quiet_errorhandler
An error handler that suppresses any previously registered error handlers.
Definition: errorhandler.hxx:79
pqxx::internal::find_with_encoding
std::string::size_type find_with_encoding(encoding_group enc, std::string_view haystack, char needle, std::string::size_type start)
Definition: encodings.cxx:728
pqxx::errorhandler::~errorhandler
virtual ~errorhandler()
Definition: errorhandler.cxx:26
pqxx::argument_error
Invalid argument passed to libpqxx, similar to std::invalid_argument.
Definition: except.hxx:171
pqxx::connection
Connection to a database.
Definition: connection.hxx:135
pqxx::internal::for_encoding
constexpr F * for_encoding(encoding_group enc)
Look up instantiation T<enc>::call at runtime.
Definition: encodings.cxx:654
pqxx::usage_error
Error in usage of libpqxx library, similar to std::logic_error.
Definition: except.hxx:164
pqxx::internal::get_glyph_scanner
glyph_scanner_func * get_glyph_scanner(encoding_group enc)
Definition: encodings.cxx:684
pqxx::errorhandler
Base class for error-handler callbacks.
Definition: errorhandler.hxx:52
pqxx::quiet_errorhandler::quiet_errorhandler
quiet_errorhandler(connection &conn)
Definition: errorhandler.hxx:82