6 #ifndef PQXX_INTERNAL_STREAM_QUERY_IMPL_HXX
7 #define PQXX_INTERNAL_STREAM_QUERY_IMPL_HXX
11 template<
typename... TYPE>
15 m_char_finder{get_finder(tx, c.loc)},
25 template<
typename... TYPE>
30 return get_char_finder<'\t', '\\'>(group, loc);
75 consume_line(m_created_loc);
82 return m_home->
parse_line(std::string_view{m_line.get(), m_line_size});
108 [[nodiscard]]
bool done() const noexcept {
return m_home->
done(); }
114 void consume_line(
sl loc) &
116 auto [line, size]{m_home->
read_line(loc)};
117 m_line = std::move(line);
124 char *
const ptr{m_line.get()};
125 assert(ptr[size] ==
'\n');
130 stream_t *
const m_home =
nullptr;
136 std::size_t m_line_size = 0u;
139 sl const m_created_loc;
149 template<
typename... TYPE>
150 inline std::pair<
typename stream_query<TYPE...>::line_handle, std::size_t>
158 auto line{gate.read_copy_line(loc)};
159 if (not line.first) [[unlikely]]
166 catch (std::exception
const &)
encoding_group get_encoding_group(sl loc=sl::current()) const
Read the curent client encoding's pqxx::encoding_group.
Definition: connection.hxx:536
Definition: connection-stream_from.hxx:17
Minimal iterator for stream_query.
Definition: stream_query_impl.hxx:45
stream_query_iterator & operator=(stream_query_iterator const &)=delete
~stream_query_iterator()=default
stream_query_iterator(stream_t &home, sl loc)
Definition: stream_query_impl.hxx:52
bool operator==(stream_query_end_iterator) const noexcept
Are we at the end?
Definition: stream_query_impl.hxx:86
stream_query_iterator(stream_query_iterator const &)=delete
friend bool operator==(stream_query_end_iterator, stream_query_iterator const &i)
Definition: stream_query_impl.hxx:95
long difference_type
Definition: stream_query_impl.hxx:50
friend bool operator!=(stream_query_end_iterator, stream_query_iterator const &i)
Definition: stream_query_impl.hxx:101
value_type operator*() const
Dereference. There's no caching in here, so don't repeat calls.
Definition: stream_query_impl.hxx:80
stream_query_iterator & operator++() &
Pre-increment.
Definition: stream_query_impl.hxx:72
bool operator!=(stream_query_end_iterator) const noexcept
Do we have more iterations to go?
Definition: stream_query_impl.hxx:89
stream_query_iterator(stream_query_iterator &&)=delete
stream_query_iterator & operator=(stream_query_iterator &&)=delete
std::tuple< TYPE... > value_type
Definition: stream_query_impl.hxx:49
Stream query results from the database. Used by transaction_base::stream.
Definition: stream_query.hxx:68
stream_query(transaction_base &tx, std::string_view query, conversion_context c)
Execute query on tx, stream results.
Definition: stream_query_impl.hxx:12
bool done() const &noexcept
Has this stream reached the end of its data?
Definition: stream_query.hxx:94
std::pair< line_handle, std::size_t > read_line(sl) &
Read a COPY line from the server.
Definition: stream_query_impl.hxx:151
std::tuple< TYPE... > parse_line(std::string_view line) &
Parse and convert the latest line of data we received.
Definition: stream_query.hxx:110
std::unique_ptr< char[], void(*)(void const *)> line_handle
Definition: stream_query.hxx:70
auto begin() &
Begin iterator. Only for use by "range for.".
Definition: stream_query_impl.hxx:143
result const & expect_rows(size_type n, sl loc=sl::current()) const
Check that result contains exactly n rows.
Definition: result.hxx:413
result const & expect_columns(row_size_type cols, sl loc=sl::current()) const
Expect that result consists of exactly cols columns.
Definition: result.hxx:476
Base class for things that monopolise a transaction's attention.
Definition: transaction_focus.hxx:29
void register_me()
Definition: transaction_base.cxx:560
constexpr connection & conn() const noexcept
The connection in which this transaction lives.
Definition: transaction_base.hxx:1118
result exec(std::string_view query, std::string_view desc, sl=sl::current())
Execute a command.
Definition: transaction_base.cxx:286
Interface definition (and common code) for "transaction" classes.
Definition: transaction_base.hxx:151
void pqfreemem(void const *ptr) noexcept
Wrapper for PQfreemem(), with C++ linkage.
Definition: util.cxx:299
Private namespace for libpqxx's internal use; do not access.
Definition: connection.cxx:333
std::size_t(std::string_view haystack, std::size_t start, sl) char_finder_func
Function type: "find first occurrence of any of these ASCII characters.".
Definition: encoding_group.hxx:110
The end() iterator for a stream_query.
Definition: stream_query.hxx:35
The home of all libpqxx classes, functions, templates, etc.
Definition: array.cxx:26
std::source_location sl
Convenience alias for std::source_location. It's just too long.
Definition: types.hxx:38
format
Format code: is data text or binary?
Definition: types.hxx:121
Contextual parameters for string conversions implementations.
Definition: strconv.hxx:163
sl loc
A std::source_location for the call.
Definition: strconv.hxx:183