libpqxx 7.8.1
connection.hxx
1/* Definition of the connection class.
2 *
3 * pqxx::connection encapsulates a connection to a database.
4 *
5 * DO NOT INCLUDE THIS FILE DIRECTLY; include pqxx/connection instead.
6 *
7 * Copyright (c) 2000-2023, Jeroen T. Vermeulen.
8 *
9 * See COPYING for copyright license. If you did not receive a file called
10 * COPYING with this source code, please notify the distributor of this
11 * mistake, or contact the author.
12 */
13#ifndef PQXX_H_CONNECTION
14#define PQXX_H_CONNECTION
15
16#if !defined(PQXX_HEADER_PRE)
17# error "Include libpqxx headers as <pqxx/header>, not <pqxx/header.hxx>."
18#endif
19
20#include <cstddef>
21#include <ctime>
22#include <initializer_list>
23#include <list>
24#include <map>
25#include <memory>
26#include <string_view>
27#include <tuple>
28
29// Double-check in order to suppress an overzealous Visual C++ warning (#418).
30#if defined(PQXX_HAVE_CONCEPTS) && __has_include(<ranges>)
31# include <ranges>
32#endif
33
34#include "pqxx/errorhandler.hxx"
35#include "pqxx/except.hxx"
36#include "pqxx/internal/concat.hxx"
37#include "pqxx/params.hxx"
38#include "pqxx/separated_list.hxx"
39#include "pqxx/strconv.hxx"
40#include "pqxx/types.hxx"
41#include "pqxx/util.hxx"
42#include "pqxx/zview.hxx"
43
44
75namespace pqxx::internal
76{
77class sql_cursor;
78
79#if defined(PQXX_HAVE_CONCEPTS)
81template<typename T>
82concept ZKey_ZValues =
83 std::ranges::input_range<T> and
84 requires(T t) {
85 {
86 std::cbegin(t)
87 };
88 {
89 std::get<0>(*std::cbegin(t))
90 } -> ZString;
91 {
92 std::get<1>(*std::cbegin(t))
93 } -> ZString;
94 } and
95 std::tuple_size_v<typename std::ranges::iterator_t<T>::value_type> == 2;
96#endif // PQXX_HAVE_CONCEPTS
97
98
100
107void PQXX_COLD PQXX_LIBEXPORT skip_init_ssl(int flags) noexcept;
108} // namespace pqxx::internal
109
110
112{
113class connection_dbtransaction;
114class connection_errorhandler;
115class connection_largeobject;
116class connection_notification_receiver;
117class connection_pipeline;
118class connection_sql_cursor;
119struct connection_stream_from;
120class connection_stream_to;
121class connection_transaction;
122class const_connection_largeobject;
123} // namespace pqxx::internal::gate
124
125
126namespace pqxx
127{
129
136enum skip_init : int
137{
140
143
146};
147
148
150
173template<skip_init... SKIP> inline void skip_init_ssl() noexcept
174{
175 // (Normalise skip flags to one per.)
176 pqxx::internal::skip_init_ssl(((1 << SKIP) | ...));
177}
178
179
181
188using table_path = std::initializer_list<std::string_view>;
189
190
192[[nodiscard,
193 deprecated("Use connection::encrypt_password instead.")]] std::string
194 PQXX_LIBEXPORT
195 encrypt_password(char const user[], char const password[]);
196
198[[nodiscard,
199 deprecated("Use connection::encrypt_password instead.")]] inline std::string
201{
202#include "pqxx/internal/ignore-deprecated-pre.hxx"
203 return encrypt_password(user.c_str(), password.c_str());
204#include "pqxx/internal/ignore-deprecated-post.hxx"
205}
206
207
209enum class error_verbosity : int
210{
211 // These values must match those in libpq's PGVerbosity enum.
212 terse = 0,
213 normal = 1,
214 verbose = 2
215};
216
217
219
252class PQXX_LIBEXPORT connection
253{
254public:
256
258 explicit connection(char const options[])
259 {
261 init(options);
262 }
263
265 explicit connection(zview options) : connection{options.c_str()}
266 {
267 // (Delegates to other constructor which calls check_version for us.)
268 }
269
271
276 connection(connection &&rhs);
277
278#if defined(PQXX_HAVE_CONCEPTS)
280
295 template<internal::ZKey_ZValues MAPPING>
296 inline connection(MAPPING const &params);
297#endif // PQXX_HAVE_CONCEPTS
298
300 {
301 try
302 {
303 close();
304 }
305 catch (std::exception const &)
306 {}
307 }
308
310
313 connection &operator=(connection &&rhs);
314
315 connection(connection const &) = delete;
316 connection &operator=(connection const &) = delete;
317
319
324 [[nodiscard]] bool PQXX_PURE is_open() const noexcept;
325
327 void process_notice(char const[]) noexcept;
329
332 void process_notice(zview) noexcept;
333
335 void trace(std::FILE *) noexcept;
336
348
349 [[nodiscard]] char const *dbname() const;
350
352
353 [[nodiscard]] char const *username() const;
354
356
359 [[nodiscard]] char const *hostname() const;
360
362 [[nodiscard]] char const *port() const;
363
365 [[nodiscard]] int PQXX_PURE backendpid() const &noexcept;
366
368
378 [[nodiscard]] int PQXX_PURE sock() const &noexcept;
379
381
384 [[nodiscard]] int PQXX_PURE protocol_version() const noexcept;
385
387
399 [[nodiscard]] int PQXX_PURE server_version() const noexcept;
401
403
424 [[nodiscard]] std::string get_client_encoding() const;
425
427
430 void set_client_encoding(zview encoding) &
431 {
432 set_client_encoding(encoding.c_str());
433 }
434
436
439 void set_client_encoding(char const encoding[]) &;
440
442 [[nodiscard]] int encoding_id() const;
443
445
447
460 [[deprecated("To set session variables, use set_session_var.")]] void
461 set_variable(std::string_view var, std::string_view value) &;
462
464
485 template<typename TYPE>
486 void set_session_var(std::string_view var, TYPE const &value) &
487 {
488 if constexpr (nullness<TYPE>::has_null)
489 {
490 if (nullness<TYPE>::is_null(value))
492 internal::concat("Attempted to set variable ", var, " to null.")};
493 }
494 exec(internal::concat("SET ", quote_name(var), "=", quote(value)));
495 }
496
498
501 [[deprecated("Use get_var instead.")]] std::string
502 get_variable(std::string_view);
503
505
511 std::string get_var(std::string_view var);
512
514
520 template<typename TYPE> TYPE get_var_as(std::string_view var)
521 {
522 return from_string<TYPE>(get_var(var));
523 }
524
530
547 int get_notifs();
548
550
562 int await_notification();
563
565
577 int await_notification(std::time_t seconds, long microseconds);
579
611 [[nodiscard]] std::string
612 encrypt_password(zview user, zview password, zview algorithm)
613 {
614 return encrypt_password(user.c_str(), password.c_str(), algorithm.c_str());
615 }
617 [[nodiscard]] std::string encrypt_password(
618 char const user[], char const password[], char const *algorithm = nullptr);
620
663
665
669 void prepare(zview name, zview definition) &
670 {
671 prepare(name.c_str(), definition.c_str());
672 }
673
678 void prepare(char const name[], char const definition[]) &;
679
681
688 void prepare(char const definition[]) &;
689 void prepare(zview definition) & { return prepare(definition.c_str()); }
690
692 void unprepare(std::string_view name);
693
695
696 // C++20: constexpr. Breaks ABI.
698
701 [[nodiscard]] std::string adorn_name(std::string_view);
702
707
709
713 [[deprecated("Use std::string_view or pqxx:zview.")]] std::string
714 esc(char const text[], std::size_t maxlen) const
715 {
716 return esc(std::string_view{text, maxlen});
717 }
718
720 [[nodiscard]] std::string esc(char const text[]) const
721 {
722 return esc(std::string_view{text});
723 }
724
725#if defined(PQXX_HAVE_SPAN)
727
738 [[nodiscard]] std::string_view
739 esc(std::string_view text, std::span<char> buffer)
740 {
741 auto const size{std::size(text)}, space{std::size(buffer)};
742 auto const needed{2 * size + 1};
743 if (space < needed)
744 throw range_error{internal::concat(
745 "Not enough room to escape string of ", size, " byte(s): need ",
746 needed, " bytes of buffer space, but buffer size is ", space, ".")};
747 auto const data{buffer.data()};
748 return {data, esc_to_buf(text, data)};
749 }
750#endif
751
753
756 [[nodiscard]] std::string esc(std::string_view text) const;
757
758#if defined(PQXX_HAVE_CONCEPTS)
760
761 template<binary DATA> [[nodiscard]] std::string esc(DATA const &data) const
762 {
763 return esc_raw(data);
764 }
765#endif
766
767#if defined(PQXX_HAVE_CONCEPTS) && defined(PQXX_HAVE_SPAN)
769
780 template<binary DATA>
781 [[nodiscard]] zview esc(DATA const &data, std::span<char> buffer) const
782 {
783 auto const size{std::size(data)}, space{std::size(buffer)};
784 auto const needed{internal::size_esc_bin(std::size(data))};
785 if (space < needed)
786 throw range_error{internal::concat(
787 "Not enough room to escape binary string of ", size, " byte(s): need ",
788 needed, " bytes of buffer space, but buffer size is ", space, ".")};
789
790 std::basic_string_view<std::byte> view{std::data(data), std::size(data)};
791 auto const out{std::data(buffer)};
792 // Actually, in the modern format, we know beforehand exactly how many
793 // bytes we're going to fill. Just leave out the trailing zero.
794 internal::esc_bin(view, out);
795 return zview{out, needed - 1};
796 }
797#endif
798
800 [[deprecated("Use std::byte for binary data.")]] std::string
801 esc_raw(unsigned char const bin[], std::size_t len) const;
802
804
805 [[nodiscard]] std::string esc_raw(std::basic_string_view<std::byte>) const;
806
807#if defined(PQXX_HAVE_SPAN)
809
810 [[nodiscard]] std::string
811 esc_raw(std::basic_string_view<std::byte>, std::span<char> buffer) const;
812#endif
813
814#if defined(PQXX_HAVE_CONCEPTS)
816
817 template<binary DATA>
818 [[nodiscard]] std::string esc_raw(DATA const &data) const
819 {
820 return esc_raw(
821 std::basic_string_view<std::byte>{std::data(data), std::size(data)});
822 }
823#endif
824
825#if defined(PQXX_HAVE_CONCEPTS) && defined(PQXX_HAVE_SPAN)
827 template<binary DATA>
828 [[nodiscard]] zview esc_raw(DATA const &data, std::span<char> buffer) const
829 {
830 return this->esc(binary_cast(data), buffer);
831 }
832#endif
833
835
838 [[nodiscard, deprecated("Use unesc_bin() instead.")]] std::string
840 {
841#include "pqxx/internal/ignore-deprecated-pre.hxx"
842 return unesc_raw(text.c_str());
843#include "pqxx/internal/ignore-deprecated-post.hxx"
844 }
845
847
850 [[nodiscard, deprecated("Use unesc_bin() instead.")]] std::string
851 unesc_raw(char const text[]) const;
852
853 // TODO: Make "into buffer" variant to eliminate a string allocation.
855
862 [[nodiscard]] std::basic_string<std::byte>
863 unesc_bin(std::string_view text) const
864 {
865 std::basic_string<std::byte> buf;
866 buf.resize(pqxx::internal::size_unesc_bin(std::size(text)));
867 pqxx::internal::unesc_bin(text, buf.data());
868 return buf;
869 }
870
872 [[deprecated("Use quote(std::basic_string_view<std::byte>).")]] std::string
873 quote_raw(unsigned char const bin[], std::size_t len) const;
874
876 std::string quote_raw(std::basic_string_view<std::byte>) const;
877
878#if defined(PQXX_HAVE_CONCEPTS)
880
881 template<binary DATA>
882 [[nodiscard]] std::string quote_raw(DATA const &data) const
883 {
884 return quote_raw(
885 std::basic_string_view<std::byte>{std::data(data), std::size(data)});
886 }
887#endif
888
889 // TODO: Make "into buffer" variant to eliminate a string allocation.
891 [[nodiscard]] std::string quote_name(std::string_view identifier) const;
892
893 // TODO: Make "into buffer" variant to eliminate a string allocation.
895
898 [[nodiscard]] std::string quote_table(std::string_view name) const;
899
900 // TODO: Make "into buffer" variant to eliminate a string allocation.
902
910 [[nodiscard]] std::string quote_table(table_path) const;
911
912 // TODO: Make "into buffer" variant to eliminate a string allocation.
914
921 template<PQXX_CHAR_STRINGS_ARG STRINGS>
922 inline std::string quote_columns(STRINGS const &columns) const;
923
924 // TODO: Make "into buffer" variant to eliminate a string allocation.
926
929 template<typename T>
930 [[nodiscard]] inline std::string quote(T const &t) const;
931
932 [[deprecated("Use std::byte for binary data.")]] std::string
933 quote(binarystring const &) const;
934
935 // TODO: Make "into buffer" variant to eliminate a string allocation.
937 [[nodiscard]] std::string
938 quote(std::basic_string_view<std::byte> bytes) const;
939
940 // TODO: Make "into buffer" variant to eliminate a string allocation.
942
967 [[nodiscard]] std::string
968 esc_like(std::string_view text, char escape_char = '\\') const;
970
972
976 void cancel_query();
977
978#if defined(_WIN32) || __has_include(<fcntl.h>)
980
984 void set_blocking(bool block) &;
985#endif // defined(_WIN32) || __has_include(<fcntl.h>)
986
988
997 void set_verbosity(error_verbosity verbosity) &noexcept;
998
1000
1012 [[nodiscard]] std::vector<errorhandler *> get_errorhandlers() const;
1013
1015
1021 [[nodiscard]] std::string connection_string() const;
1022
1024
1032 void close();
1033
1035
1041 static connection seize_raw_connection(internal::pq::PGconn *raw_conn)
1042 {
1043 return connection{raw_conn};
1044 }
1045
1047
1052 internal::pq::PGconn *release_raw_connection() &&
1053 {
1054 return std::exchange(m_conn, nullptr);
1055 }
1056
1057private:
1058 friend class connecting;
1059 enum connect_mode
1060 {
1061 connect_nonblocking
1062 };
1063 connection(connect_mode, zview connection_string);
1064
1066 explicit connection(internal::pq::PGconn *raw_conn) : m_conn{raw_conn} {}
1067
1069
1074 std::pair<bool, bool> poll_connect();
1075
1076 // Initialise based on connection string.
1077 void init(char const options[]);
1078 // Initialise based on parameter names and values.
1079 void init(char const *params[], char const *values[]);
1080 void complete_init();
1081
1082 result make_result(
1083 internal::pq::PGresult *pgr, std::shared_ptr<std::string> const &query,
1084 std::string_view desc = ""sv);
1085
1086 void PQXX_PRIVATE set_up_state();
1087
1088 int PQXX_PRIVATE PQXX_PURE status() const noexcept;
1089
1091
1095 std::size_t esc_to_buf(std::string_view text, char *buf) const;
1096
1097 friend class internal::gate::const_connection_largeobject;
1098 char const *PQXX_PURE err_msg() const noexcept;
1099
1100 void PQXX_PRIVATE process_notice_raw(char const msg[]) noexcept;
1101
1102 result exec_prepared(std::string_view statement, internal::c_params const &);
1103
1105 void check_movable() const;
1107 void check_overwritable() const;
1108
1109 friend class internal::gate::connection_errorhandler;
1110 void PQXX_PRIVATE register_errorhandler(errorhandler *);
1111 void PQXX_PRIVATE unregister_errorhandler(errorhandler *) noexcept;
1112
1113 friend class internal::gate::connection_transaction;
1114 result exec(std::string_view, std::string_view = ""sv);
1115 result
1116 PQXX_PRIVATE exec(std::shared_ptr<std::string>, std::string_view = ""sv);
1117 void PQXX_PRIVATE register_transaction(transaction_base *);
1118 void PQXX_PRIVATE unregister_transaction(transaction_base *) noexcept;
1119
1120 friend struct internal::gate::connection_stream_from;
1121 std::pair<std::unique_ptr<char, void (*)(void const *)>, std::size_t>
1122 read_copy_line();
1123
1124 friend class internal::gate::connection_stream_to;
1125 void PQXX_PRIVATE write_copy_line(std::string_view);
1126 void PQXX_PRIVATE end_copy_write();
1127
1128 friend class internal::gate::connection_largeobject;
1129 internal::pq::PGconn *raw_connection() const { return m_conn; }
1130
1131 friend class internal::gate::connection_notification_receiver;
1132 void add_receiver(notification_receiver *);
1133 void remove_receiver(notification_receiver *) noexcept;
1134
1135 friend class internal::gate::connection_pipeline;
1136 void PQXX_PRIVATE start_exec(char const query[]);
1137 bool PQXX_PRIVATE consume_input() noexcept;
1138 bool PQXX_PRIVATE is_busy() const noexcept;
1139 internal::pq::PGresult *get_result();
1140
1141 friend class internal::gate::connection_dbtransaction;
1142 friend class internal::gate::connection_sql_cursor;
1143
1144 result exec_params(std::string_view query, internal::c_params const &args);
1145
1147 internal::pq::PGconn *m_conn = nullptr;
1148
1150
1157 transaction_base const *m_trans = nullptr;
1158
1159 std::list<errorhandler *> m_errorhandlers;
1160
1161 using receiver_list =
1162 std::multimap<std::string, pqxx::notification_receiver *>;
1164 receiver_list m_receivers;
1165
1167 int m_unique_id = 0;
1168};
1169
1170
1173
1174
1176
1219class PQXX_LIBEXPORT connecting
1220{
1221public:
1223 connecting(zview connection_string = ""_zv);
1224
1225 connecting(connecting const &) = delete;
1226 connecting(connecting &&) = default;
1227 connecting &operator=(connecting const &) = delete;
1229
1231 [[nodiscard]] int sock() const &noexcept { return m_conn.sock(); }
1232
1234 [[nodiscard]] constexpr bool wait_to_read() const &noexcept
1235 {
1236 return m_reading;
1237 }
1238
1240 [[nodiscard]] constexpr bool wait_to_write() const &noexcept
1241 {
1242 return m_writing;
1243 }
1244
1246 void process() &;
1247
1249 [[nodiscard]] constexpr bool done() const &noexcept
1250 {
1251 return not m_reading and not m_writing;
1252 }
1253
1255
1263 [[nodiscard]] connection produce() &&;
1264
1265private:
1266 connection m_conn;
1267 bool m_reading{false};
1268 bool m_writing{true};
1269};
1270
1271
1272template<typename T> inline std::string connection::quote(T const &t) const
1273{
1274 if constexpr (nullness<T>::always_null)
1275 {
1276 return "NULL";
1277 }
1278 else
1279 {
1280 if (is_null(t))
1281 return "NULL";
1282 auto const text{to_string(t)};
1283
1284 // Okay, there's an easy way to do this and there's a hard way. The easy
1285 // way was "quote, esc(to_string(t)), quote". I'm going with the hard way
1286 // because it's going to save some string manipulation that will probably
1287 // incur some unnecessary memory allocations and deallocations.
1288 std::string buf{'\''};
1289 buf.resize(2 + 2 * std::size(text) + 1);
1290 auto const content_bytes{esc_to_buf(text, buf.data() + 1)};
1291 auto const closing_quote{1 + content_bytes};
1292 buf[closing_quote] = '\'';
1293 auto const end{closing_quote + 1};
1294 buf.resize(end);
1295 return buf;
1296 }
1297}
1298
1299
1300template<PQXX_CHAR_STRINGS_ARG STRINGS>
1301inline std::string connection::quote_columns(STRINGS const &columns) const
1302{
1303 return separated_list(
1304 ","sv, std::cbegin(columns), std::cend(columns),
1305 [this](auto col) { return this->quote_name(*col); });
1306}
1307
1308
1309#if defined(PQXX_HAVE_CONCEPTS)
1310template<internal::ZKey_ZValues MAPPING>
1311inline connection::connection(MAPPING const &params)
1312{
1313 check_version();
1314
1315 std::vector<char const *> keys, values;
1316 if constexpr (std::ranges::sized_range<MAPPING>)
1317 {
1318 auto const size{std::ranges::size(params) + 1};
1319 keys.reserve(size);
1320 values.reserve(size);
1321 }
1322 for (auto const &[key, value] : params)
1323 {
1324 keys.push_back(internal::as_c_string(key));
1325 values.push_back(internal::as_c_string(value));
1326 }
1327 keys.push_back(nullptr);
1328 values.push_back(nullptr);
1329 init(std::data(keys), std::data(values));
1330}
1331#endif // PQXX_HAVE_CONCEPTS
1332} // namespace pqxx
1333#endif
The home of all libpqxx classes, functions, templates, etc.
Definition array.hxx:33
std::string separated_list(std::string_view sep, ITER begin, ITER end, ACCESS access)
Represent sequence of values as a string, joined by a given separator.
Definition separated_list.hxx:44
std::string encrypt_password(char const user[], char const password[])
Encrypt a password.
Definition connection.cxx:94
std::basic_string_view< std::byte > binary_cast(TYPE const &data)
Cast binary data to a type that libpqxx will recognise as binary.
Definition util.hxx:303
void skip_init_ssl() noexcept
Control initialisation of OpenSSL and libcrypto libraries.
Definition connection.hxx:173
std::initializer_list< std::string_view > table_path
Representation of a PostgreSQL table path.
Definition connection.hxx:188
void check_version() noexcept
Definition util.hxx:234
std::string to_string(field const &value)
Convert a field to a string.
Definition result.cxx:549
skip_init
Flags for skipping initialisation of SSL-related libraries.
Definition connection.hxx:137
@ crypto
Skip initialisation of libcrypto.
Definition connection.hxx:145
@ openssl
Skip initialisation of OpenSSL library.
Definition connection.hxx:142
@ nothing
A do-nothing flag that does not affect anything.
Definition connection.hxx:139
error_verbosity
Error verbosity levels.
Definition connection.hxx:210
Internal items for libpqxx' own use. Do not use these yourself.
Definition composite.hxx:84
void PQXX_COLD skip_init_ssl(int flags) noexcept
Control OpenSSL/crypto library initialisation.
Definition connection.cxx:83
void unesc_bin(std::string_view escaped_data, std::byte buffer[])
Reconstitute binary data from its escaped version.
Definition util.cxx:158
void esc_bin(std::basic_string_view< std::byte > binary_data, char buffer[]) noexcept
Hex-escape binary data into a buffer.
Definition util.cxx:126
constexpr std::size_t size_esc_bin(std::size_t binary_bytes) noexcept
Compute buffer size needed to escape binary data for use as a BYTEA.
Definition util.hxx:411
constexpr char const * as_c_string(char const str[]) noexcept
Get a raw C string pointer.
Definition zview.hxx:145
constexpr std::size_t size_unesc_bin(std::size_t escaped_bytes) noexcept
Compute binary size from the size of its escaped version.
Definition util.hxx:420
Definition connection.hxx:112
Connection to a database.
Definition connection.hxx:253
std::string encrypt_password(zview user, zview password, zview algorithm)
Encrypt a password for a given user.
Definition connection.hxx:612
void prepare(zview definition) &
Definition connection.hxx:689
connection(char const options[])
Connect to a database, using options string.
Definition connection.hxx:258
connection & operator=(connection const &)=delete
TYPE get_var_as(std::string_view var)
Read currently applicable value of a variable.
Definition connection.hxx:520
connection()
Definition connection.hxx:255
~connection()
Definition connection.hxx:299
std::string quote_columns(STRINGS const &columns) const
Quote and comma-separate a series of column names.
Definition connection.hxx:1301
connection(zview options)
Connect to a database, using options string.
Definition connection.hxx:265
internal::pq::PGconn * release_raw_connection() &&
Release the raw connection without closing it.
Definition connection.hxx:1052
static connection seize_raw_connection(internal::pq::PGconn *raw_conn)
Seize control of a raw libpq connection.
Definition connection.hxx:1041
std::basic_string< std::byte > unesc_bin(std::string_view text) const
Unescape binary data, e.g. from a table field or notification payload.
Definition connection.hxx:863
std::string esc(char const text[]) const
Escape string for use as SQL string literal on this connection.
Definition connection.hxx:720
std::string unesc_raw(zview text) const
Unescape binary data, e.g. from a table field or notification payload.
Definition connection.hxx:839
std::string esc(char const text[], std::size_t maxlen) const
Escape string for use as SQL string literal on this connection.
Definition connection.hxx:714
void prepare(zview name, zview definition) &
Define a prepared statement.
Definition connection.hxx:669
void set_session_var(std::string_view var, TYPE const &value) &
Set one of the session variables to a new value.
Definition connection.hxx:486
std::string quote(T const &t) const
Represent object as SQL string, including quoting & escaping.
Definition connection.hxx:1272
connection(connection const &)=delete
An ongoing, non-blocking stepping stone to a connection.
Definition connection.hxx:1220
connecting(connecting &&)=default
int sock() const &noexcept
Get the socket. The socket may change during the connection process.
Definition connection.hxx:1231
constexpr bool done() const &noexcept
Is our connection finished?
Definition connection.hxx:1249
connecting & operator=(connecting const &)=delete
connecting(connecting const &)=delete
constexpr bool wait_to_write() const &noexcept
Should we currently wait to be able to write to the socket?
Definition connection.hxx:1240
void process() &
Progress towards completion (but don't block).
connecting & operator=(connecting &&)=default
constexpr bool wait_to_read() const &noexcept
Should we currently wait to be able to read from the socket?
Definition connection.hxx:1234
connecting(zview connection_string=""_zv)
Start connecting.
connection produce() &&
Produce the completed connection object.
Base class for error-handler callbacks.
Definition errorhandler.hxx:54
The caller attempted to set a variable to null, which is not allowed.
Definition except.hxx:116
Definition notification.hxx:57
Build a parameter list for a parameterised or prepared statement.
Definition params.hxx:220
Result set containing data returned by a query or command.
Definition result.hxx:73
Traits describing a type's "null value," if any.
Definition strconv.hxx:93
Interface definition (and common code) for "transaction" classes.
Definition transaction_base.hxx:88
Marker-type wrapper: zero-terminated std::string_view.
Definition zview.hxx:38
constexpr char const * c_str() const &noexcept
Either a null pointer, or a zero-terminated text buffer.
Definition zview.hxx:96