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
26std::string OidPrettyPrint(Oid oid);
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
163
164
165
166
167
168
169
170
176class Error :
public std::runtime_error {
177 using runtime_error::runtime_error;
199template <
typename Base>
202 explicit ServerError(
const Message& msg) : Base(msg.GetMessage()), msg_{msg} {}
204 const Message& GetServerMessage()
const {
return msg_; }
206 Message::Severity GetSeverity()
const {
return msg_.GetSeverity(); }
207 SqlState GetSqlState()
const {
return msg_.GetSqlState(); }
226 explicit ConnectionFailed(
const Dsn& dsn);
227 ConnectionFailed(
const Dsn& dsn, std::string_view message);
240 PoolError(std::string_view msg, std::string_view db_name);
241 PoolError(std::string_view msg);
353 std::string GetSchema()
const;
354 std::string GetTable()
const;
355 std::string GetConstraint()
const;
599 AlreadyInTransaction();
605 NotInTransaction(
const std::string& msg);
610 TransactionForceRollback();
611 TransactionForceRollback(
const std::string& msg);
621 ResultSetError(std::string msg);
623 void AddMsgSuffix(std::string_view str);
624 void AddMsgPrefix(std::string_view str);
626 const char* what()
const noexcept override;
635 RowIndexOutOfBounds(std::size_t index);
641 FieldIndexOutOfBounds(std::size_t index);
647 FieldNameDoesntExist(std::string_view name);
654 template <
typename T>
655 FieldValueIsNull(std::size_t field_index, std::string_view field_name,
const T&)
656 : ResultSetError(fmt::format(
657 "Field #{} name `{}` C++ type `{}` value is "
658 "null, forgot `std::optional`?",
661 compiler::GetTypeName<T>()
670 TypeCannotBeNull(std::string_view type);
686 UnknownBufferCategory(std::string_view context, Oid type_oid);
687 UnknownBufferCategory(Oid type_oid, std::string_view cpp_field_type, std::string_view cpp_composite_type);
707 InvalidBinaryBuffer(
const std::string& message);
714 InvalidTupleSizeRequested(std::size_t field_count, std::size_t tuple_size);
721 NonSingleColumnResultSet(std::size_t actual_size,
const std::string& type_name,
const std::string& func);
727 explicit NonSingleRowResultSet(std::size_t actual_size);
734 FieldTupleMismatch(std::size_t field_count, std::size_t tuple_size);
749 CompositeSizeMismatch(std::size_t pg_size, std::size_t cpp_size, std::string_view cpp_type);
756 CompositeMemberTypeMismatch(
757 std::string_view pg_type_schema,
758 std::string_view pg_type_name,
759 std::string_view field_name,
783 InvalidDimensions(std::size_t expected, std::size_t actual);
827 InvalidEnumerationLiteral(std::string_view type_name, std::string_view literal);
832 template <
typename Enum>
833 explicit InvalidEnumerationValue(Enum val)
835 "Invalid enumeration value '{}' for enum type '{}'",
836 USERVER_NAMESPACE::
utils::UnderlyingValue(val),
846 UnsupportedInterval();
852 BoundedRangeError(std::string_view message);
867 BitStringOverflow(std::size_t actual, std::size_t expected);
873 InvalidBitStringRepresentation();
881 InvalidDSN(std::string_view dsn, std::string_view err);
903 explicit IpAddressInvalidFormat(std::string_view str);