6 #if !defined(PQXX_H_STREAM_QUERY_IMPL)
7 # define PQXX_H_STREAM_QUERY_IMPL
11 template<
typename... TYPE>
23 template<
typename... TYPE>
25 stream_query<TYPE...>::get_finder(transaction_base
const &tx)
27 auto const group{
enc_group(tx.conn().encoding_id())};
28 return get_s_char_finder<'\t', '\\'>(group);
42 using value_type = std::tuple<TYPE...>;
43 using difference_type = long;
47 m_line{
typename stream_query<TYPE...>::line_handle(
91 m_line = std::move(rhs.m_line);
93 m_line_size = rhs.m_line_size;
99 stream_query_input_iterator() {}
102 bool done() const noexcept {
return m_home->
done(); }
108 void consume_line() &
111 m_line = std::move(line);
118 char *
const ptr{m_line.get()};
119 assert(ptr[size] ==
'\n');
127 typename stream_t::line_handle m_line;
130 std::size_t m_line_size;
134 template<
typename... TYPE>
135 inline bool operator==(
136 stream_query_end_iterator, stream_query_input_iterator<TYPE...>
const &i)
142 template<
typename... TYPE>
143 inline bool operator!=(
144 stream_query_end_iterator, stream_query_input_iterator<TYPE...>
const &i)
156 template<
typename... TYPE>
157 inline std::pair<
typename stream_query<TYPE...>::line_handle, std::size_t>
165 auto line{gate.read_copy_line()};
168 PQXX_UNLIKELY close();
171 catch (std::exception
const &)
result exec(std::string_view query, std::string_view desc)
Execute a command.
Definition: transaction_base.cxx:249
std::string concat(TYPE...item)
Efficiently combine a bunch of items into one big string.
Definition: concat.hxx:31
void pqfreemem(void const *ptr) noexcept
Wrapper for PQfreemem(), with C++ linkage.
Definition: util.cxx:205
Marker-type wrapper: zero-terminated std::string_view.
Definition: zview.hxx:37
auto begin()&
Begin iterator. Only for use by "range for.".
Definition: stream_query_impl.hxx:150
Internal items for libpqxx' own use. Do not use these yourself.
Definition: encodings.cxx:32
The end() iterator for a stream_query.
Definition: stream_query.hxx:46
Definition: connection-stream_from.hxx:12
result expect_columns(row_size_type cols) const
Expect that result consists of exactly cols columns.
Definition: result.hxx:363
Base class for things that monopolise a transaction's attention.
Definition: transaction_focus.hxx:28
Stream query results from the database. Used by transaction_base::stream.
Definition: stream_query.hxx:79
result expect_rows(size_type n) const
Check that result contains exactly n rows.
Definition: result.hxx:321
std::tuple< TYPE... > parse_line(zview line)&
Parse and convert the latest line of data we received.
Definition: stream_query.hxx:118
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::pair< line_handle, std::size_t > read_line()&
Read a COPY line from the server.
Definition: stream_query_impl.hxx:158
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
pqxx::internal::encoding_group enc_group(std::string_view encoding_name)
Convert libpq encoding name to its libpqxx encoding group.
Definition: encodings.cxx:35
Interface definition (and common code) for "transaction" classes.
Definition: transaction_base.hxx:150