11#include <userver/storages/postgres/dsn.hpp>
12#include <userver/storages/postgres/io/traits.hpp>
13#include <userver/storages/postgres/message.hpp>
15#include <userver/compiler/demangle.hpp>
16#include <userver/utils/underlying_value.hpp>
18USERVER_NAMESPACE_BEGIN
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
168class Error :
public std::runtime_error {
169 using runtime_error::runtime_error;
191template <
typename Base>
194 explicit ServerError(
const Message& msg) : Base(msg.GetMessage()), msg_{msg} {}
196 const Message& GetServerMessage()
const {
return msg_; }
198 Message::Severity GetSeverity()
const {
return msg_.GetSeverity(); }
199 SqlState GetSqlState()
const {
return msg_.GetSqlState(); }
218 explicit ConnectionFailed(
const Dsn& dsn);
219 ConnectionFailed(
const Dsn& dsn, std::string_view message);
232 PoolError(std::string_view msg, std::string_view db_name);
233 PoolError(std::string_view msg);
345 std::string GetSchema()
const;
346 std::string GetTable()
const;
347 std::string GetConstraint()
const;
591 AlreadyInTransaction();
597 NotInTransaction(
const std::string& msg);
602 TransactionForceRollback();
603 TransactionForceRollback(
const std::string& msg);
613 ResultSetError(std::string msg);
615 void AddMsgSuffix(std::string_view str);
617 const char* what()
const noexcept override;
626 RowIndexOutOfBounds(std::size_t index);
632 FieldIndexOutOfBounds(std::size_t index);
638 FieldNameDoesntExist(std::string_view name);
645 template <
typename T>
646 FieldValueIsNull(std::size_t field_index, std::string_view field_name,
const T&)
647 : ResultSetError(fmt::format(
648 "Field #{} name `{}` C++ type `{}` value is "
649 "null, forgot `std::optional`?",
652 compiler::GetTypeName<T>()
661 TypeCannotBeNull(std::string_view type);
677 UnknownBufferCategory(std::string_view context, Oid type_oid);
691 InvalidInputBufferSize(std::size_t size, std::string_view message);
698 InvalidBinaryBuffer(
const std::string& message);
705 InvalidTupleSizeRequested(std::size_t field_count, std::size_t tuple_size);
712 NonSingleColumnResultSet(std::size_t actual_size,
const std::string& type_name,
const std::string& func);
718 explicit NonSingleRowResultSet(std::size_t actual_size);
725 FieldTupleMismatch(std::size_t field_count, std::size_t tuple_size);
740 CompositeSizeMismatch(std::size_t pg_size, std::size_t cpp_size, std::string_view cpp_type);
747 CompositeMemberTypeMismatch(
748 std::string_view pg_type_schema,
749 std::string_view pg_type_name,
750 std::string_view field_name,
774 InvalidDimensions(std::size_t expected, std::size_t actual);
818 InvalidEnumerationLiteral(std::string_view type_name, std::string_view literal);
823 template <
typename Enum>
824 explicit InvalidEnumerationValue(Enum val)
826 "Invalid enumeration value '{}' for enum type '{}'",
827 USERVER_NAMESPACE::
utils::UnderlyingValue(val),
837 UnsupportedInterval();
843 BoundedRangeError(std::string_view message);
858 BitStringOverflow(std::size_t actual, std::size_t expected);
864 InvalidBitStringRepresentation();
872 InvalidDSN(std::string_view dsn, std::string_view err);
894 explicit IpAddressInvalidFormat(std::string_view str);