10 #define PQXX_TYPES_HXX
12 #if !defined(PQXX_HEADER_PRE)
13 # error "Include libpqxx headers as <pqxx/header>, not <pqxx/header.hxx>."
20 #include <string_view>
21 #include <type_traits>
25 #if defined(PQXX_HAVE_CONCEPTS) && defined(PQXX_HAVE_RANGES)
91 template<
typename TYPE>
92 using strip_t = std::remove_cv_t<std::remove_reference_t<TYPE>>;
95 #if defined(PQXX_HAVE_CONCEPTS) && defined(PQXX_HAVE_RANGES)
100 template<std::ranges::range CONTAINER>
102 #else // PQXX_HAVE_CONCEPTS
107 template<
typename CONTAINER>
109 #endif // PQXX_HAVE_CONCEPTS
112 #if defined(PQXX_HAVE_CONCEPTS) && defined(PQXX_HAVE_RANGES)
113 template<
typename STRING>
115 concept char_string = std::ranges::contiguous_range<STRING> and
116 std::same_as<strip_t<value_type<STRING>>,
char>;
119 template<
typename RANGE>
120 concept char_strings =
121 std::ranges::range<RANGE> and char_string<strip_t<value_type<RANGE>>>;
124 template<
typename DATA>
125 concept potential_binary =
127 #endif // PQXX_HAVE_CONCEPTS
131 #if defined(PQXX_HAVE_CONCEPTS) && defined(PQXX_HAVE_RANGES)
137 # define PQXX_RANGE_ARG std::ranges::range
143 # define PQXX_CHAR_STRING_ARG pqxx::char_string
149 # define PQXX_CHAR_STRINGS_ARG pqxx::char_strings
151 #else // PQXX_HAVE_CONCEPTS
157 # define PQXX_RANGE_ARG typename
163 # define PQXX_CHAR_STRING_ARG typename
169 # define PQXX_CHAR_STRINGS_ARG typename
171 #endif // PQXX_HAVE_CONCEPTS
195 template<
typename TYPE>
200 template<
typename TYPE>
inline constexpr std::string_view
name_type() noexcept
202 return type_name<TYPE>;
215 PQXX_PURE constexpr
inline std::string_view name_type<std::string>() noexcept
217 return "std::string";
220 PQXX_PURE constexpr
inline std::string_view
221 name_type<std::string_view>() noexcept
223 return "std::string_view";
228 return "char const *";
256 PQXX_PURE constexpr
inline std::string_view
259 return "unsigned short";
269 return "unsigned long";
272 PQXX_PURE constexpr
inline std::string_view
275 return "unsigned long long";
290 return "long double";
293 PQXX_PURE constexpr
inline std::string_view
294 name_type<std::nullptr_t>() noexcept
296 return "std::nullptr_t";
PQXX_PURE constexpr std::string_view name_type< char const * >() noexcept
Definition: types.hxx:226
Accessor for large object's contents.
Definition: largeobject.hxx:153
PQXX_PURE constexpr std::string_view name_type< long long >() noexcept
Definition: types.hxx:251
Marker for stream_from constructors: "stream from query.".
Definition: types.hxx:182
PQXX_PURE constexpr std::string_view name_type< short >() noexcept
Definition: types.hxx:236
Internal items for libpqxx' own use. Do not use these yourself.
Definition: encodings.cxx:32
PQXX_PURE constexpr std::string_view name_type< unsigned short >() noexcept
Definition: types.hxx:257
Reference to one row in a result.
Definition: row.hxx:46
PQXX_PURE constexpr std::string_view name_type< bool >() noexcept
Definition: types.hxx:231
PQXX_PURE constexpr std::string_view name_type< float >() noexcept
Definition: types.hxx:278
Something is out of range, similar to std::out_of_range.
Definition: except.hxx:325
constexpr std::string_view name_type() noexcept
Return human-readable name for TYPE.
Definition: types.hxx:200
int row_size_type
Number of fields in a row of database data.
Definition: types.hxx:46
Result set containing data returned by a query or command.
Definition: result.hxx:91
format
Format code: is data text or binary?
Definition: types.hxx:81
int result_size_type
Number of rows in a result set.
Definition: types.hxx:40
PQXX_PURE constexpr std::string_view name_type< unsigned long long >() noexcept
Definition: types.hxx:273
PQXX_PURE constexpr std::string_view name_type< double >() noexcept
Definition: types.hxx:283
PQXX_PURE constexpr std::string_view name_type< unsigned long >() noexcept
Definition: types.hxx:267
Abstract transaction base class: bracket transactions on the database.
Definition: dbtransaction.hxx:53
Definition: notification.hxx:56
int result_difference_type
Difference between result sizes.
Definition: types.hxx:43
Stream data from the database.
Definition: stream_from.hxx:78
Marker for stream_from constructors: "stream from table.".
Definition: types.hxx:176
Binary data corresponding to PostgreSQL's "BYTEA" binary-string type.
Definition: binarystring.hxx:57
PQXX_PURE constexpr std::string_view name_type< long >() noexcept
Definition: types.hxx:246
Definition: errorhandler.hxx:45
int64_t large_object_size_type
Number of bytes in a large object.
Definition: types.hxx:55
The home of all libpqxx classes, functions, templates, etc.
Definition: array.cxx:26
std::string const type_name
A human-readable name for a type, used in error messages and such.
Definition: types.hxx:196
Reference to a field in a result set.
Definition: field.hxx:34
int row_difference_type
Difference between row sizes.
Definition: types.hxx:49
Reverse iterator for a row. Use as row::const_reverse_iterator.
Definition: row.hxx:414
Iterator for rows in a result. Use as result::const_iterator.
Definition: result_iterator.hxx:32
PQXX_PURE constexpr std::string_view name_type< int >() noexcept
Definition: types.hxx:241
Iterator for fields in a row. Use as row::const_iterator.
Definition: row.hxx:294
strip_t< decltype(*std::begin(std::declval< CONTAINER >()))> value_type
The type of a container's elements.
Definition: types.hxx:108
std::size_t field_size_type
Number of bytes in a field of database data.
Definition: types.hxx:52
PQXX_PURE constexpr std::string_view name_type< long double >() noexcept
Definition: types.hxx:288
PQXX_PURE constexpr std::string_view name_type< unsigned >() noexcept
Definition: types.hxx:262
std::string demangle_type_name(char const raw[])
Attempt to demangle std::type_info::name() to something human-readable.
Definition: strconv.cxx:228
Connection to a database.
Definition: connection.hxx:278
Reverse iterator for result. Use as result::const_reverse_iterator.
Definition: result_iterator.hxx:194
std::remove_cv_t< std::remove_reference_t< TYPE >> strip_t
Remove any constness, volatile, and reference-ness from a type.
Definition: types.hxx:92
Interface definition (and common code) for "transaction" classes.
Definition: transaction_base.hxx:150