errorhandler.hxx
/*-------------------------------------------------------------------------
*
* FILE
* pqxx/errorhandler.hxx
*
* DESCRIPTION
* definition of the pqxx::errorhandler class.
* pqxx::errorhandler handlers errors and warnings in a database session.
* DO NOT INCLUDE THIS FILE DIRECTLY; include pqxx/connection_base instead.
*
* Copyright (c) 2011, Jeroen T. Vermeulen <jtv@xs4all.nl>
*
* See COPYING for copyright license. If you did not receive a file called
* COPYING with this source code, please notify the distributor of this mistake,
* or contact the author.
*
*-------------------------------------------------------------------------
*/
#ifndef PQXX_H_ERRORHANDLER
#define PQXX_H_ERRORHANDLER
#include "pqxx/compiler-public.hxx"
#include "pqxx/compiler-internal-pre.hxx"
#include <functional>
namespace pqxx
{
class connection_base;
namespace internal
{
namespace gate
{
class errorhandler_connection_base;
}
}
class PQXX_LIBEXPORT errorhandler :
public PGSTD::unary_function<const char[], bool>
{
public:
explicit errorhandler(connection_base &);
virtual ~errorhandler();
virtual bool operator()(const char msg[]) throw () =0;
private:
connection_base *m_home;
friend class internal::gate::errorhandler_connection_base;
void unregister() throw ();
// Not allowed:
errorhandler();
errorhandler(const errorhandler &);
errorhandler &operator=(const errorhandler &);
};
class quiet_errorhandler : public errorhandler
{
public:
quiet_errorhandler(connection_base &conn) : errorhandler(conn) {}
virtual bool operator()(const char[]) throw () { return false; }
};
} // namespace pqxx
#include "pqxx/compiler-internal-post.hxx"
#endif
pqxx::connection_base
connection_base abstract base class; represents a connection to a database.
Definition: connection_base.hxx:151
pqxx::quiet_errorhandler
An error handler that suppresses any previously registered error handlers.
Definition: errorhandler.hxx:85
pqxx::quiet_errorhandler::quiet_errorhandler
quiet_errorhandler(connection_base &conn)
Definition: errorhandler.hxx:88
pqxx::errorhandler
Base class for error-handler callbacks.
Definition: errorhandler.hxx:57
pqxx
The home of all libpqxx classes, functions, templates, etc.
Definition: basic_connection.hxx:35
pqxx::quiet_errorhandler::operator()
virtual bool operator()(const char[])
Define in subclass: receive an error or warning message from the database.
Definition: errorhandler.hxx:90