except.hxx
#ifndef PQXX_H_EXCEPT
#define PQXX_H_EXCEPT
#include "pqxx/compiler-public.hxx"
#include "pqxx/compiler-internal-pre.hxx"
#include <stdexcept>
#include "pqxx/util.hxx"
namespace pqxx
{
class PQXX_LIBEXPORT PQXX_NOVTABLE pqxx_exception
{
public:
virtual ~pqxx_exception() noexcept =0;
PQXX_CONST virtual const std::exception &base() const noexcept =0; //[t00]
};
class PQXX_LIBEXPORT failure :
public pqxx_exception, public std::runtime_error
{
virtual const std::exception &base() const noexcept override
{ return *this; }
public:
explicit failure(const std::string &);
};
class PQXX_LIBEXPORT broken_connection : public failure
{
public:
broken_connection();
explicit broken_connection(const std::string &);
};
class PQXX_LIBEXPORT sql_error : public failure
{
const std::string m_query;
const std::string m_sqlstate;
public:
explicit sql_error(
const std::string &msg="",
const std::string &Q="",
const char sqlstate[]=nullptr);
virtual ~sql_error() noexcept;
PQXX_PURE const std::string &query() const noexcept; //[t56]
PQXX_PURE const std::string &sqlstate() const noexcept;
};
class PQXX_LIBEXPORT in_doubt_error : public failure
{
public:
explicit in_doubt_error(const std::string &);
};
class PQXX_LIBEXPORT transaction_rollback : public failure
{
public:
explicit transaction_rollback(const std::string &);
};
class PQXX_LIBEXPORT serialization_failure : public transaction_rollback
{
public:
explicit serialization_failure(const std::string &);
};
class PQXX_LIBEXPORT statement_completion_unknown : public transaction_rollback
{
public:
explicit statement_completion_unknown(const std::string &);
};
class PQXX_LIBEXPORT deadlock_detected : public transaction_rollback
{
public:
explicit deadlock_detected(const std::string &);
};
class PQXX_LIBEXPORT internal_error :
public pqxx_exception, public std::logic_error
{
virtual const std::exception &base() const noexcept override
{ return *this; }
public:
explicit internal_error(const std::string &);
};
class PQXX_LIBEXPORT usage_error :
public pqxx_exception, public std::logic_error
{
virtual const std::exception &base() const noexcept override
{ return *this; }
public:
explicit usage_error(const std::string &);
};
class PQXX_LIBEXPORT argument_error :
public pqxx_exception, public std::invalid_argument
{
virtual const std::exception &base() const noexcept override
{ return *this; }
public:
explicit argument_error(const std::string &);
};
class PQXX_LIBEXPORT conversion_error :
public pqxx_exception, public std::domain_error
{
virtual const std::exception &base() const noexcept override
{ return *this; }
public:
explicit conversion_error(const std::string &);
};
class PQXX_LIBEXPORT range_error :
public pqxx_exception, public std::out_of_range
{
virtual const std::exception &base() const noexcept override
{ return *this; }
public:
explicit range_error(const std::string &);
};
class PQXX_LIBEXPORT unexpected_rows : public range_error
{
virtual const std::exception &base() const noexcept override
{ return *this; }
public:
explicit unexpected_rows(const std::string &msg) : range_error{msg} {}
};
class PQXX_LIBEXPORT feature_not_supported : public sql_error
{
public:
explicit feature_not_supported(
const std::string &err,
const std::string &Q="",
const char sqlstate[]=nullptr) :
sql_error{err, Q, sqlstate} {}
};
class PQXX_LIBEXPORT data_exception : public sql_error
{
public:
explicit data_exception(
const std::string &err,
const std::string &Q="",
const char sqlstate[]=nullptr) :
sql_error{err, Q, sqlstate} {}
};
class PQXX_LIBEXPORT integrity_constraint_violation : public sql_error
{
public:
explicit integrity_constraint_violation(
const std::string &err,
const std::string &Q="",
const char sqlstate[]=nullptr) :
sql_error{err, Q, sqlstate} {}
};
class PQXX_LIBEXPORT restrict_violation :
public integrity_constraint_violation
{
public:
explicit restrict_violation(
const std::string &err,
const std::string &Q="",
const char sqlstate[]=nullptr) :
integrity_constraint_violation{err, Q, sqlstate} {}
};
class PQXX_LIBEXPORT not_null_violation :
public integrity_constraint_violation
{
public:
explicit not_null_violation(
const std::string &err,
const std::string &Q="",
const char sqlstate[]=nullptr) :
integrity_constraint_violation{err, Q, sqlstate} {}
};
class PQXX_LIBEXPORT foreign_key_violation :
public integrity_constraint_violation
{
public:
explicit foreign_key_violation(
const std::string &err,
const std::string &Q="",
const char sqlstate[]=nullptr) :
integrity_constraint_violation{err, Q, sqlstate} {}
};
class PQXX_LIBEXPORT unique_violation :
public integrity_constraint_violation
{
public:
explicit unique_violation(
const std::string &err,
const std::string &Q="",
const char sqlstate[]=nullptr) :
integrity_constraint_violation{err, Q, sqlstate} {}
};
class PQXX_LIBEXPORT check_violation :
public integrity_constraint_violation
{
public:
explicit check_violation(
const std::string &err,
const std::string &Q="",
const char sqlstate[]=nullptr) :
integrity_constraint_violation{err, Q, sqlstate} {}
};
class PQXX_LIBEXPORT invalid_cursor_state : public sql_error
{
public:
explicit invalid_cursor_state(
const std::string &err,
const std::string &Q="",
const char sqlstate[]=nullptr) :
sql_error{err, Q, sqlstate} {}
};
class PQXX_LIBEXPORT invalid_sql_statement_name : public sql_error
{
public:
explicit invalid_sql_statement_name(
const std::string &err,
const std::string &Q="",
const char sqlstate[]=nullptr) :
sql_error{err, Q, sqlstate} {}
};
class PQXX_LIBEXPORT invalid_cursor_name : public sql_error
{
public:
explicit invalid_cursor_name(
const std::string &err,
const std::string &Q="",
const char sqlstate[]=nullptr) :
sql_error{err, Q, sqlstate} {}
};
class PQXX_LIBEXPORT syntax_error : public sql_error
{
public:
const int error_position;
explicit syntax_error(
const std::string &err,
const std::string &Q="",
const char sqlstate[]=nullptr,
int pos=-1) :
sql_error{err, Q, sqlstate}, error_position{pos} {}
};
class PQXX_LIBEXPORT undefined_column : public syntax_error
{
public:
explicit undefined_column(
const std::string &err,
const std::string &Q="",
const char sqlstate[]=nullptr) :
syntax_error{err, Q, sqlstate} {}
};
class PQXX_LIBEXPORT undefined_function : public syntax_error
{
public:
explicit undefined_function(
const std::string &err,
const std::string &Q="",
const char sqlstate[]=nullptr) :
syntax_error{err, Q, sqlstate} {}
};
class PQXX_LIBEXPORT undefined_table : public syntax_error
{
public:
explicit undefined_table(
const std::string &err,
const std::string &Q="",
const char sqlstate[]=nullptr) :
syntax_error{err, Q, sqlstate} {}
};
class PQXX_LIBEXPORT insufficient_privilege : public sql_error
{
public:
explicit insufficient_privilege(
const std::string &err,
const std::string &Q="",
const char sqlstate[]=nullptr) :
sql_error{err, Q, sqlstate} {}
};
class PQXX_LIBEXPORT insufficient_resources : public sql_error
{
public:
explicit insufficient_resources(
const std::string &err,
const std::string &Q="",
const char sqlstate[]=nullptr) :
sql_error{err,Q, sqlstate} {}
};
class PQXX_LIBEXPORT disk_full : public insufficient_resources
{
public:
explicit disk_full(
const std::string &err,
const std::string &Q="",
const char sqlstate[]=nullptr) :
insufficient_resources{err, Q, sqlstate} {}
};
class PQXX_LIBEXPORT out_of_memory : public insufficient_resources
{
public:
explicit out_of_memory(
const std::string &err,
const std::string &Q="",
const char sqlstate[]=nullptr) :
insufficient_resources{err, Q, sqlstate} {}
};
class PQXX_LIBEXPORT too_many_connections : public broken_connection
{
public:
explicit too_many_connections(const std::string &err) :
broken_connection{err} {}
};
class PQXX_LIBEXPORT plpgsql_error : public sql_error
{
public:
explicit plpgsql_error(
const std::string &err,
const std::string &Q="",
const char sqlstate[]=nullptr) :
sql_error{err, Q, sqlstate} {}
};
class PQXX_LIBEXPORT plpgsql_raise : public plpgsql_error
{
public:
explicit plpgsql_raise(
const std::string &err,
const std::string &Q="",
const char sqlstate[]=nullptr) :
plpgsql_error{err, Q, sqlstate} {}
};
class PQXX_LIBEXPORT plpgsql_no_data_found : public plpgsql_error
{
public:
explicit plpgsql_no_data_found(
const std::string &err,
const std::string &Q="",
const char sqlstate[]=nullptr) :
plpgsql_error{err, Q, sqlstate} {}
};
class PQXX_LIBEXPORT plpgsql_too_many_rows : public plpgsql_error
{
public:
explicit plpgsql_too_many_rows(
const std::string &err,
const std::string &Q="",
const char sqlstate[]=nullptr) :
plpgsql_error{err, Q, sqlstate} {}
};
}
#include "pqxx/compiler-internal-post.hxx"
#endif
pqxx::invalid_sql_statement_name
Definition: except.hxx:368
pqxx::failure::failure
failure(const std::string &)
Definition: except.cxx:19
pqxx::sql_error::query
const PQXX_PURE std::string & query() const noexcept
The query whose execution triggered the exception.
Definition: except.cxx:53
pqxx::out_of_memory
Definition: except.hxx:463
pqxx::deadlock_detected
The ongoing transaction has deadlocked. Retrying it may help.
Definition: except.hxx:199
pqxx::undefined_column::undefined_column
undefined_column(const std::string &err, const std::string &Q="", const char sqlstate[]=nullptr)
Definition: except.hxx:405
pqxx::check_violation::check_violation
check_violation(const std::string &err, const std::string &Q="", const char sqlstate[]=nullptr)
Definition: except.hxx:351
pqxx::plpgsql_no_data_found
Definition: except.hxx:504
pqxx::conversion_error
Value conversion failed, e.g. when converting "Hello" to int.
Definition: except.hxx:240
pqxx::restrict_violation::restrict_violation
restrict_violation(const std::string &err, const std::string &Q="", const char sqlstate[]=nullptr)
Definition: except.hxx:307
pqxx::serialization_failure::serialization_failure
serialization_failure(const std::string &)
Definition: except.cxx:77
pqxx::pqxx_exception::~pqxx_exception
virtual ~pqxx_exception() noexcept=0
Support run-time polymorphism, and keep this class abstract.
Definition: except.cxx:14
pqxx::not_null_violation
Definition: except.hxx:314
pqxx::unexpected_rows::unexpected_rows
unexpected_rows(const std::string &msg)
Definition: except.hxx:267
pqxx::disk_full
Definition: except.hxx:453
pqxx::statement_completion_unknown
We can't tell whether our last statement succeeded.
Definition: except.hxx:191
pqxx::insufficient_resources
Resource shortage on the server.
Definition: except.hxx:443
pqxx::serialization_failure
Transaction failed to serialize. Please retry it.
Definition: except.hxx:183
pqxx::insufficient_resources::insufficient_resources
insufficient_resources(const std::string &err, const std::string &Q="", const char sqlstate[]=nullptr)
Definition: except.hxx:446
pqxx::plpgsql_error::plpgsql_error
plpgsql_error(const std::string &err, const std::string &Q="", const char sqlstate[]=nullptr)
Definition: except.hxx:486
pqxx::usage_error::usage_error
usage_error(const std::string &)
Definition: except.cxx:103
pqxx::statement_completion_unknown::statement_completion_unknown
statement_completion_unknown(const std::string &)
Definition: except.cxx:84
pqxx::internal_error::internal_error
internal_error(const std::string &)
Definition: except.cxx:97
pqxx::syntax_error
Definition: except.hxx:388
pqxx::failure
Run-time failure encountered by libpqxx, similar to std::runtime_error.
Definition: except.hxx:89
pqxx::undefined_table::undefined_table
undefined_table(const std::string &err, const std::string &Q="", const char sqlstate[]=nullptr)
Definition: except.hxx:425
pqxx::not_null_violation::not_null_violation
not_null_violation(const std::string &err, const std::string &Q="", const char sqlstate[]=nullptr)
Definition: except.hxx:318
pqxx::syntax_error::error_position
const int error_position
Approximate position in string where error occurred, or -1 if unknown.
Definition: except.hxx:392
pqxx::invalid_cursor_state::invalid_cursor_state
invalid_cursor_state(const std::string &err, const std::string &Q="", const char sqlstate[]=nullptr)
Definition: except.hxx:361
pqxx::broken_connection::broken_connection
broken_connection()
Definition: except.cxx:25
pqxx::insufficient_privilege::insufficient_privilege
insufficient_privilege(const std::string &err, const std::string &Q="", const char sqlstate[]=nullptr)
Definition: except.hxx:435
pqxx::insufficient_privilege
Definition: except.hxx:432
pqxx::transaction_rollback
The backend saw itself forced to roll back the ongoing transaction.
Definition: except.hxx:167
pqxx::argument_error::argument_error
argument_error(const std::string &)
Definition: except.cxx:109
pqxx::deadlock_detected::deadlock_detected
deadlock_detected(const std::string &)
Definition: except.cxx:91
pqxx::invalid_sql_statement_name::invalid_sql_statement_name
invalid_sql_statement_name(const std::string &err, const std::string &Q="", const char sqlstate[]=nullptr)
Definition: except.hxx:371
pqxx::unique_violation
Definition: except.hxx:336
pqxx::plpgsql_no_data_found::plpgsql_no_data_found
plpgsql_no_data_found(const std::string &err, const std::string &Q="", const char sqlstate[]=nullptr)
Definition: except.hxx:507
pqxx::undefined_function
Definition: except.hxx:412
pqxx::sql_error
Exception class for failed queries.
Definition: except.hxx:130
pqxx::invalid_cursor_name
Definition: except.hxx:378
pqxx::pqxx_exception
Mixin base class to identify libpqxx-specific exception types.
Definition: except.hxx:55
pqxx::unexpected_rows
Query returned an unexpected number of rows.
Definition: except.hxx:262
pqxx::syntax_error::syntax_error
syntax_error(const std::string &err, const std::string &Q="", const char sqlstate[]=nullptr, int pos=-1)
Definition: except.hxx:394
pqxx::invalid_cursor_state
Definition: except.hxx:358
pqxx::foreign_key_violation
Definition: except.hxx:325
pqxx::too_many_connections
Definition: except.hxx:473
pqxx::internal_error
Internal error in libpqxx library.
Definition: except.hxx:207
pqxx::undefined_column
Definition: except.hxx:402
pqxx::broken_connection
Exception class for lost or failed backend connection.
Definition: except.hxx:118
pqxx::range_error::range_error
range_error(const std::string &)
Definition: except.cxx:121
pqxx::in_doubt_error::in_doubt_error
in_doubt_error(const std::string &)
Definition: except.cxx:65
pqxx::invalid_cursor_name::invalid_cursor_name
invalid_cursor_name(const std::string &err, const std::string &Q="", const char sqlstate[]=nullptr)
Definition: except.hxx:381
pqxx::foreign_key_violation::foreign_key_violation
foreign_key_violation(const std::string &err, const std::string &Q="", const char sqlstate[]=nullptr)
Definition: except.hxx:329
pqxx::sql_error::~sql_error
virtual ~sql_error() noexcept
Definition: except.cxx:48
pqxx::plpgsql_too_many_rows::plpgsql_too_many_rows
plpgsql_too_many_rows(const std::string &err, const std::string &Q="", const char sqlstate[]=nullptr)
Definition: except.hxx:517
pqxx::data_exception
Error in data provided to SQL statement.
Definition: except.hxx:283
pqxx::disk_full::disk_full
disk_full(const std::string &err, const std::string &Q="", const char sqlstate[]=nullptr)
Definition: except.hxx:456
pqxx::feature_not_supported::feature_not_supported
feature_not_supported(const std::string &err, const std::string &Q="", const char sqlstate[]=nullptr)
Definition: except.hxx:275
pqxx::unique_violation::unique_violation
unique_violation(const std::string &err, const std::string &Q="", const char sqlstate[]=nullptr)
Definition: except.hxx:340
pqxx::plpgsql_raise
Exception raised in PL/pgSQL procedure.
Definition: except.hxx:494
pqxx::argument_error
Invalid argument passed to libpqxx, similar to std::invalid_argument.
Definition: except.hxx:229
pqxx::restrict_violation
Definition: except.hxx:303
pqxx::feature_not_supported
Database feature not supported in current setup.
Definition: except.hxx:272
pqxx::out_of_memory::out_of_memory
out_of_memory(const std::string &err, const std::string &Q="", const char sqlstate[]=nullptr)
Definition: except.hxx:466
pqxx::check_violation
Definition: except.hxx:347
pqxx::sql_error::sqlstate
const PQXX_PURE std::string & sqlstate() const noexcept
SQLSTATE error code if known, or empty string otherwise.
Definition: except.cxx:59
pqxx::sql_error::sql_error
sql_error(const std::string &msg="", const std::string &Q="", const char sqlstate[]=nullptr)
Definition: except.cxx:37
pqxx::undefined_function::undefined_function
undefined_function(const std::string &err, const std::string &Q="", const char sqlstate[]=nullptr)
Definition: except.hxx:415
pqxx::undefined_table
Definition: except.hxx:422
pqxx::in_doubt_error
"Help, I don't know whether transaction was committed successfully!"
Definition: except.hxx:159
pqxx::plpgsql_too_many_rows
Definition: except.hxx:514
pqxx::range_error
Something is out of range, similar to std::out_of_range.
Definition: except.hxx:251
pqxx::conversion_error::conversion_error
conversion_error(const std::string &)
Definition: except.cxx:115
pqxx
The home of all libpqxx classes, functions, templates, etc.
Definition: array.hxx:25
pqxx::plpgsql_raise::plpgsql_raise
plpgsql_raise(const std::string &err, const std::string &Q="", const char sqlstate[]=nullptr)
Definition: except.hxx:497
pqxx::plpgsql_error
PL/pgSQL error.
Definition: except.hxx:483
pqxx::usage_error
Error in usage of libpqxx library, similar to std::logic_error.
Definition: except.hxx:218
pqxx::data_exception::data_exception
data_exception(const std::string &err, const std::string &Q="", const char sqlstate[]=nullptr)
Definition: except.hxx:286
pqxx::integrity_constraint_violation
Definition: except.hxx:293
pqxx::too_many_connections::too_many_connections
too_many_connections(const std::string &err)
Definition: except.hxx:476
pqxx::integrity_constraint_violation::integrity_constraint_violation
integrity_constraint_violation(const std::string &err, const std::string &Q="", const char sqlstate[]=nullptr)
Definition: except.hxx:296
pqxx::transaction_rollback::transaction_rollback
transaction_rollback(const std::string &)
Definition: except.cxx:71