16 #if !defined(PQXX_HEADER_PRE)
17 # error "Include libpqxx headers as <pqxx/header>, not <pqxx/header.hxx>."
20 #if defined(PQXX_HAVE_SOURCE_LOCATION)
21 # include <source_location>
47 struct PQXX_LIBEXPORT
failure : std::runtime_error
49 #if defined(PQXX_HAVE_SOURCE_LOCATION)
52 std::source_location = std::source_location::current());
53 std::source_location location;
55 explicit failure(std::string
const &);
85 #
if defined(PQXX_HAVE_SOURCE_LOCATION)
87 std::source_location = std::source_location::current()
106 #
if defined(PQXX_HAVE_SOURCE_LOCATION)
108 std::source_location = std::source_location::current()
119 #
if defined(PQXX_HAVE_SOURCE_LOCATION)
121 std::source_location = std::source_location::current()
134 std::string
const m_query;
136 std::string
const m_sqlstate;
140 std::string whatarg =
"", std::string
const &Q =
"",
141 char const sqlstate[] =
nullptr
142 #
if defined(PQXX_HAVE_SOURCE_LOCATION)
144 std::source_location = std::source_location::current()
150 [[nodiscard]] PQXX_PURE std::
string const &query() const noexcept;
153 [[nodiscard]] PQXX_PURE std::
string const &sqlstate() const noexcept;
168 #
if defined(PQXX_HAVE_SOURCE_LOCATION)
170 std::source_location = std::source_location::current()
180 std::string
const &whatarg, std::string
const &q =
"",
181 char const sqlstate[] =
nullptr
182 #
if defined(PQXX_HAVE_SOURCE_LOCATION)
184 std::source_location = std::source_location::current()
202 std::string
const &whatarg, std::string
const &q,
203 char const sqlstate[] =
nullptr
204 #
if defined(PQXX_HAVE_SOURCE_LOCATION)
206 std::source_location = std::source_location::current()
216 std::string
const &whatarg, std::string
const &q,
217 char const sqlstate[] =
nullptr
218 #
if defined(PQXX_HAVE_SOURCE_LOCATION)
220 std::source_location = std::source_location::current()
230 std::string
const &whatarg, std::string
const &q,
231 char const sqlstate[] =
nullptr
232 #
if defined(PQXX_HAVE_SOURCE_LOCATION)
234 std::source_location = std::source_location::current()
252 #
if defined(PQXX_HAVE_SOURCE_LOCATION)
254 std::source_location = std::source_location::current()
258 #if defined(PQXX_HAVE_SOURCE_LOCATION)
259 std::source_location location;
269 #
if defined(PQXX_HAVE_SOURCE_LOCATION)
271 std::source_location = std::source_location::current()
275 #if defined(PQXX_HAVE_SOURCE_LOCATION)
276 std::source_location location;
286 #
if defined(PQXX_HAVE_SOURCE_LOCATION)
288 std::source_location = std::source_location::current()
292 #if defined(PQXX_HAVE_SOURCE_LOCATION)
293 std::source_location location;
303 #
if defined(PQXX_HAVE_SOURCE_LOCATION)
305 std::source_location = std::source_location::current()
316 #
if defined(PQXX_HAVE_SOURCE_LOCATION)
318 std::source_location = std::source_location::current()
329 #
if defined(PQXX_HAVE_SOURCE_LOCATION)
331 std::source_location = std::source_location::current()
335 #if defined(PQXX_HAVE_SOURCE_LOCATION)
336 std::source_location location;
344 #if defined(PQXX_HAVE_SOURCE_LOCATION)
346 std::string
const &msg,
347 std::source_location loc = std::source_location::current()) :
359 #if defined(PQXX_HAVE_SOURCE_LOCATION)
361 std::string
const &err, std::string
const &Q =
"",
362 char const sqlstate[] =
nullptr,
363 std::source_location loc = std::source_location::current()) :
368 std::string
const &err, std::string
const &Q =
"",
369 char const sqlstate[] =
nullptr) :
378 #if defined(PQXX_HAVE_SOURCE_LOCATION)
380 std::string
const &err, std::string
const &Q =
"",
381 char const sqlstate[] =
nullptr,
382 std::source_location loc = std::source_location::current()) :
387 std::string
const &err, std::string
const &Q =
"",
388 char const sqlstate[] =
nullptr) :
396 #if defined(PQXX_HAVE_SOURCE_LOCATION)
398 std::string
const &err, std::string
const &Q =
"",
399 char const sqlstate[] =
nullptr,
400 std::source_location loc = std::source_location::current()) :
405 std::string
const &err, std::string
const &Q =
"",
406 char const sqlstate[] =
nullptr) :
414 #if defined(PQXX_HAVE_SOURCE_LOCATION)
416 std::string
const &err, std::string
const &Q =
"",
417 char const sqlstate[] =
nullptr,
418 std::source_location loc = std::source_location::current()) :
423 std::string
const &err, std::string
const &Q =
"",
424 char const sqlstate[] =
nullptr) :
432 #if defined(PQXX_HAVE_SOURCE_LOCATION)
434 std::string
const &err, std::string
const &Q =
"",
435 char const sqlstate[] =
nullptr,
436 std::source_location loc = std::source_location::current()) :
441 std::string
const &err, std::string
const &Q =
"",
442 char const sqlstate[] =
nullptr) :
450 #if defined(PQXX_HAVE_SOURCE_LOCATION)
452 std::string
const &err, std::string
const &Q =
"",
453 char const sqlstate[] =
nullptr,
454 std::source_location loc = std::source_location::current()) :
459 std::string
const &err, std::string
const &Q =
"",
460 char const sqlstate[] =
nullptr) :
468 #if defined(PQXX_HAVE_SOURCE_LOCATION)
470 std::string
const &err, std::string
const &Q =
"",
471 char const sqlstate[] =
nullptr,
472 std::source_location loc = std::source_location::current()) :
477 std::string
const &err, std::string
const &Q =
"",
478 char const sqlstate[] =
nullptr) :
486 #if defined(PQXX_HAVE_SOURCE_LOCATION)
488 std::string
const &err, std::string
const &Q =
"",
489 char const sqlstate[] =
nullptr,
490 std::source_location loc = std::source_location::current()) :
495 std::string
const &err, std::string
const &Q =
"",
496 char const sqlstate[] =
nullptr) :
504 #if defined(PQXX_HAVE_SOURCE_LOCATION)
506 std::string
const &err, std::string
const &Q =
"",
507 char const sqlstate[] =
nullptr,
508 std::source_location loc = std::source_location::current()) :
513 std::string
const &err, std::string
const &Q =
"",
514 char const sqlstate[] =
nullptr) :
522 #if defined(PQXX_HAVE_SOURCE_LOCATION)
524 std::string
const &err, std::string
const &Q =
"",
525 char const sqlstate[] =
nullptr,
526 std::source_location loc = std::source_location::current()) :
531 std::string
const &err, std::string
const &Q =
"",
532 char const sqlstate[] =
nullptr) :
540 #if defined(PQXX_HAVE_SOURCE_LOCATION)
542 std::string
const &err, std::string
const &Q =
"",
543 char const sqlstate[] =
nullptr,
544 std::source_location loc = std::source_location::current()) :
549 std::string
const &err, std::string
const &Q =
"",
550 char const sqlstate[] =
nullptr) :
561 #if defined(PQXX_HAVE_SOURCE_LOCATION)
563 std::string
const &err, std::string
const &Q =
"",
564 char const sqlstate[] =
nullptr,
int pos = -1,
565 std::source_location loc = std::source_location::current()) :
566 sql_error{err, Q, sqlstate, loc}, error_position{pos}
570 std::string
const &err, std::string
const &Q =
"",
571 char const sqlstate[] =
nullptr,
int pos = -1) :
572 sql_error{err, Q, sqlstate}, error_position{pos}
579 #if defined(PQXX_HAVE_SOURCE_LOCATION)
581 std::string
const &err, std::string
const &Q =
"",
582 char const sqlstate[] =
nullptr,
583 std::source_location loc = std::source_location::current()) :
589 std::string
const &err, std::string
const &Q =
"",
590 char const sqlstate[] =
nullptr) :
598 #if defined(PQXX_HAVE_SOURCE_LOCATION)
600 std::string
const &err, std::string
const &Q =
"",
601 char const sqlstate[] =
nullptr,
602 std::source_location loc = std::source_location::current()) :
608 std::string
const &err, std::string
const &Q =
"",
609 char const sqlstate[] =
nullptr) :
617 #if defined(PQXX_HAVE_SOURCE_LOCATION)
619 std::string
const &err, std::string
const &Q =
"",
620 char const sqlstate[] =
nullptr,
621 std::source_location loc = std::source_location::current()) :
627 std::string
const &err, std::string
const &Q =
"",
628 char const sqlstate[] =
nullptr) :
636 #if defined(PQXX_HAVE_SOURCE_LOCATION)
638 std::string
const &err, std::string
const &Q =
"",
639 char const sqlstate[] =
nullptr,
640 std::source_location loc = std::source_location::current()) :
645 std::string
const &err, std::string
const &Q =
"",
646 char const sqlstate[] =
nullptr) :
655 #if defined(PQXX_HAVE_SOURCE_LOCATION)
657 std::string
const &err, std::string
const &Q =
"",
658 char const sqlstate[] =
nullptr,
659 std::source_location loc = std::source_location::current()) :
664 std::string
const &err, std::string
const &Q =
"",
665 char const sqlstate[] =
nullptr) :
673 #if defined(PQXX_HAVE_SOURCE_LOCATION)
675 std::string
const &err, std::string
const &Q =
"",
676 char const sqlstate[] =
nullptr,
677 std::source_location loc = std::source_location::current()) :
682 std::string
const &err, std::string
const &Q =
"",
683 char const sqlstate[] =
nullptr) :
691 #if defined(PQXX_HAVE_SOURCE_LOCATION)
693 std::string
const &err, std::string
const &Q =
"",
694 char const sqlstate[] =
nullptr,
695 std::source_location loc = std::source_location::current()) :
700 std::string
const &err, std::string
const &Q =
"",
701 char const sqlstate[] =
nullptr) :
709 #if defined(PQXX_HAVE_SOURCE_LOCATION)
711 std::string
const &err,
712 std::source_location loc = std::source_location::current()) :
727 #if defined(PQXX_HAVE_SOURCE_LOCATION)
729 std::string
const &err, std::string
const &Q =
"",
730 char const sqlstate[] =
nullptr,
731 std::source_location loc = std::source_location::current()) :
736 std::string
const &err, std::string
const &Q =
"",
737 char const sqlstate[] =
nullptr) :
746 #if defined(PQXX_HAVE_SOURCE_LOCATION)
748 std::string
const &err, std::string
const &Q =
"",
749 char const sqlstate[] =
nullptr,
750 std::source_location loc = std::source_location::current()) :
755 std::string
const &err, std::string
const &Q =
"",
756 char const sqlstate[] =
nullptr) :
764 #if defined(PQXX_HAVE_SOURCE_LOCATION)
766 std::string
const &err, std::string
const &Q =
"",
767 char const sqlstate[] =
nullptr,
768 std::source_location loc = std::source_location::current()) :
773 std::string
const &err, std::string
const &Q =
"",
774 char const sqlstate[] =
nullptr) :
782 #if defined(PQXX_HAVE_SOURCE_LOCATION)
784 std::string
const &err, std::string
const &Q =
"",
785 char const sqlstate[] =
nullptr,
786 std::source_location loc = std::source_location::current()) :
791 std::string
const &err, std::string
const &Q =
"",
792 char const sqlstate[] =
nullptr) :
The home of all libpqxx classes, functions, templates, etc.
Definition: array.hxx:33
Run-time failure encountered by libpqxx, similar to std::runtime_error.
Definition: except.hxx:48
Exception class for lost or failed backend connection.
Definition: except.hxx:81
Exception class for micommunication with the server.
Definition: except.hxx:103
The caller attempted to set a variable to null, which is not allowed.
Definition: except.hxx:116
Exception class for failed queries.
Definition: except.hxx:132
virtual ~sql_error() noexcept override
"Help, I don't know whether transaction was committed successfully!"
Definition: except.hxx:165
The backend saw itself forced to roll back the ongoing transaction.
Definition: except.hxx:178
Transaction failed to serialize. Please retry it.
Definition: except.hxx:200
We can't tell whether our last statement succeeded.
Definition: except.hxx:214
The ongoing transaction has deadlocked. Retrying it may help.
Definition: except.hxx:228
Internal error in libpqxx library.
Definition: except.hxx:242
Error in usage of libpqxx library, similar to std::logic_error.
Definition: except.hxx:249
Invalid argument passed to libpqxx, similar to std::invalid_argument.
Definition: except.hxx:266
Value conversion failed, e.g. when converting "Hello" to int.
Definition: except.hxx:283
Could not convert null value: target type does not support null.
Definition: except.hxx:300
Could not convert value to string: not enough buffer space.
Definition: except.hxx:313
Something is out of range, similar to std::out_of_range.
Definition: except.hxx:326
Query returned an unexpected number of rows.
Definition: except.hxx:343
unexpected_rows(std::string const &msg)
Definition: except.hxx:351
Database feature not supported in current setup.
Definition: except.hxx:358
feature_not_supported(std::string const &err, std::string const &Q="", char const sqlstate[]=nullptr)
Definition: except.hxx:367
Error in data provided to SQL statement.
Definition: except.hxx:377
data_exception(std::string const &err, std::string const &Q="", char const sqlstate[]=nullptr)
Definition: except.hxx:386
Definition: except.hxx:395
integrity_constraint_violation(std::string const &err, std::string const &Q="", char const sqlstate[]=nullptr)
Definition: except.hxx:404
Definition: except.hxx:413
restrict_violation(std::string const &err, std::string const &Q="", char const sqlstate[]=nullptr)
Definition: except.hxx:422
Definition: except.hxx:431
not_null_violation(std::string const &err, std::string const &Q="", char const sqlstate[]=nullptr)
Definition: except.hxx:440
Definition: except.hxx:449
foreign_key_violation(std::string const &err, std::string const &Q="", char const sqlstate[]=nullptr)
Definition: except.hxx:458
Definition: except.hxx:467
unique_violation(std::string const &err, std::string const &Q="", char const sqlstate[]=nullptr)
Definition: except.hxx:476
Definition: except.hxx:485
check_violation(std::string const &err, std::string const &Q="", char const sqlstate[]=nullptr)
Definition: except.hxx:494
Definition: except.hxx:503
invalid_cursor_state(std::string const &err, std::string const &Q="", char const sqlstate[]=nullptr)
Definition: except.hxx:512
Definition: except.hxx:521
invalid_sql_statement_name(std::string const &err, std::string const &Q="", char const sqlstate[]=nullptr)
Definition: except.hxx:530
Definition: except.hxx:539
invalid_cursor_name(std::string const &err, std::string const &Q="", char const sqlstate[]=nullptr)
Definition: except.hxx:548
Definition: except.hxx:557
syntax_error(std::string const &err, std::string const &Q="", char const sqlstate[]=nullptr, int pos=-1)
Definition: except.hxx:569
int const error_position
Approximate position in string where error occurred, or -1 if unknown.
Definition: except.hxx:559
Definition: except.hxx:578
undefined_column(std::string const &err, std::string const &Q="", char const sqlstate[]=nullptr)
Definition: except.hxx:588
Definition: except.hxx:597
undefined_function(std::string const &err, std::string const &Q="", char const sqlstate[]=nullptr)
Definition: except.hxx:607
Definition: except.hxx:616
undefined_table(std::string const &err, std::string const &Q="", char const sqlstate[]=nullptr)
Definition: except.hxx:626
Definition: except.hxx:635
insufficient_privilege(std::string const &err, std::string const &Q="", char const sqlstate[]=nullptr)
Definition: except.hxx:644
Resource shortage on the server.
Definition: except.hxx:654
insufficient_resources(std::string const &err, std::string const &Q="", char const sqlstate[]=nullptr)
Definition: except.hxx:663
Definition: except.hxx:672
disk_full(std::string const &err, std::string const &Q="", char const sqlstate[]=nullptr)
Definition: except.hxx:681
Definition: except.hxx:690
out_of_memory(std::string const &err, std::string const &Q="", char const sqlstate[]=nullptr)
Definition: except.hxx:699
Definition: except.hxx:708
too_many_connections(std::string const &err)
Definition: except.hxx:716
PL/pgSQL error.
Definition: except.hxx:726
plpgsql_error(std::string const &err, std::string const &Q="", char const sqlstate[]=nullptr)
Definition: except.hxx:735
Exception raised in PL/pgSQL procedure.
Definition: except.hxx:745
plpgsql_raise(std::string const &err, std::string const &Q="", char const sqlstate[]=nullptr)
Definition: except.hxx:754
Definition: except.hxx:763
plpgsql_no_data_found(std::string const &err, std::string const &Q="", char const sqlstate[]=nullptr)
Definition: except.hxx:772
Definition: except.hxx:781
plpgsql_too_many_rows(std::string const &err, std::string const &Q="", char const sqlstate[]=nullptr)
Definition: except.hxx:790