6#if !defined(PQXX_H_STREAM_QUERY_IMPL)
7# define PQXX_H_STREAM_QUERY_IMPL
11template<
typename... TYPE>
17 if (r.columns() !=
sizeof...(TYPE))
19 "Parsing query stream with wrong number of columns: "
21 sizeof...(TYPE),
" but query returns ", r.columns(),
".")};
26template<
typename... TYPE>
31 return get_s_char_finder<'\t', '\\'>(group);
45 using value_type = std::tuple<TYPE...>;
46 using difference_type = long;
50 m_line{
typename stream_query<TYPE...>::line_handle(
94 m_line = std::move(rhs.m_line);
96 m_line_size = rhs.m_line_size;
102 stream_query_input_iterator() {}
105 bool done() const noexcept {
return m_home->
done(); }
111 void consume_line() &
114 m_line = std::move(line);
121 char *
const ptr{m_line.get()};
122 assert(ptr[size] ==
'\n');
130 typename stream_t::line_handle m_line;
133 std::size_t m_line_size;
137template<
typename... TYPE>
138inline bool operator==(
139 stream_query_end_iterator, stream_query_input_iterator<TYPE...>
const &i)
145template<
typename... TYPE>
146inline bool operator!=(
147 stream_query_end_iterator, stream_query_input_iterator<TYPE...>
const &i)
159template<
typename... TYPE>
160inline std::pair<
typename stream_query<TYPE...>::line_handle, std::size_t>
168 auto line{gate.read_copy_line()};
171 PQXX_UNLIKELY close();
174 catch (std::exception
const &)
int encoding_id() const
Get the connection's encoding, as a PostgreSQL-defined code.
Definition connection.cxx:1112
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:103
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:115
auto begin() &
Begin iterator. Only for use by "range for.".
Definition stream_query_impl.hxx:153
std::pair< line_handle, std::size_t > read_line() &
Read a COPY line from the server.
Definition stream_query_impl.hxx:161
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
Error in usage of libpqxx library, similar to std::logic_error.
Definition except.hxx:249
result exec0(zview query, std::string_view desc)
Execute command, which should return zero rows of data.
Definition transaction_base.hxx:387
constexpr connection & conn() const noexcept
The connection in which this transaction lives.
Definition transaction_base.hxx:998
Interface definition (and common code) for "transaction" classes.
Definition transaction_base.hxx:150
void pqfreemem(void const *ptr) noexcept
Wrapper for PQfreemem(), with C++ linkage.
Definition util.cxx:205
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
pqxx::internal::encoding_group enc_group(std::string_view encoding_name)
Convert libpq encoding name to its libpqxx encoding group.
Definition encodings.cxx:35
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:71
The end() iterator for a stream_query.
Definition stream_query.hxx:47
Definition connection-stream_from.hxx:13