13#ifndef PQXX_H_STREAM_QUERY
14#define PQXX_H_STREAM_QUERY
16#if !defined(PQXX_HEADER_PRE)
17# error "Include libpqxx headers as <pqxx/header>, not <pqxx/header.hxx>."
24#include "pqxx/connection.hxx"
25#include "pqxx/except.hxx"
26#include "pqxx/internal/concat.hxx"
27#include "pqxx/internal/encoding_group.hxx"
28#include "pqxx/internal/encodings.hxx"
29#include "pqxx/internal/gates/connection-stream_from.hxx"
30#include "pqxx/internal/stream_iterator.hxx"
31#include "pqxx/separated_list.hxx"
32#include "pqxx/transaction_base.hxx"
33#include "pqxx/transaction_focus.hxx"
34#include "pqxx/util.hxx"
39class transaction_base;
82 using line_handle = std::unique_ptr<
char,
void (*)(
void const *)>;
88 transaction_base &
tx, std::string_view query,
params const &);
99 catch (std::exception
const &
e)
101 reg_pending_error(
e.what());
109 inline auto begin() &;
135 char *
write{m_row.data()};
149 std::pair<line_handle, std::size_t>
read_line() &;
173 std::tuple<std::size_t, char *, zview>
182 char const *
lp{std::data(
line)};
268 template<
typename TARGET>
281 if constexpr (nullity::always_null)
283 if (std::data(text) !=
nullptr)
284 throw conversion_error{
concat(
286 ", which must always be null.")};
288 else if (std::data(text) ==
nullptr)
290 if constexpr (nullity::has_null)
291 return nullity::null();
307 m_char_finder =
nullptr;
Stream query results from the database. Used by transaction_base::stream.
Definition stream_query.hxx:80
bool done() const &noexcept
Has this stream reached the end of its data?
Definition stream_query.hxx:106
stream_query(transaction_base &tx, std::string_view query)
Execute query on tx, stream results.
Definition stream_query_impl.hxx:12
std::tuple< TYPE... > parse_line(zview line) &
Parse and convert the latest line of data we received.
Definition stream_query.hxx:118
auto begin() &
Begin iterator. Only for use by "range for.".
Definition stream_query_impl.hxx:166
std::pair< line_handle, std::size_t > read_line() &
Read a COPY line from the server.
Definition stream_query_impl.hxx:174
auto end() const &
End iterator. Only for use by "range for.".
Definition stream_query.hxx:115
Base class for things that monopolise a transaction's attention.
Definition transaction_focus.hxx:29
Marker-type wrapper: zero-terminated std::string_view.
Definition zview.hxx:38
Internal items for libpqxx' own use. Do not use these yourself.
Definition encodings.cxx:33
std::string concat(TYPE... item)
Efficiently combine a bunch of items into one big string.
Definition concat.hxx:31
void throw_null_conversion(std::string const &type)
Throw exception for attempt to convert SQL NULL to given type.
Definition strconv.cxx:264
std::size_t(std::string_view haystack, std::size_t start) char_finder_func
Function type: "find first occurrence of specific any of ASCII characters.".
Definition encoding_group.hxx:70
constexpr char unescape_char(char escaped) noexcept
Return original byte for escaped character.
Definition util.hxx:633
The end() iterator for a stream_query.
Definition stream_query.hxx:47
The home of all libpqxx classes, functions, templates, etc.
Definition array.cxx:27
constexpr char array_separator
Element separator between SQL array elements of this type.
Definition strconv.hxx:559