13 #ifndef PQXX_H_PIPELINE 14 #define PQXX_H_PIPELINE 16 #include "pqxx/compiler-public.hxx" 17 #include "pqxx/internal/compiler-internal-pre.hxx" 23 #include "pqxx/transaction_base.hxx" 42 class PQXX_LIBEXPORT
pipeline :
public internal::transactionfocus
51 namedclass{
"pipeline"}, transactionfocus{t}
56 namedclass{
"pipeline", name}, transactionfocus{t}
61 namedclass{
"pipeline", std::move(name)}, transactionfocus{t}
66 namedclass{
"pipeline", name}, transactionfocus{t}
115 [[nodiscard]]
bool is_finished(
query_id)
const;
126 return retrieve(m_queries.find(qid)).second;
131 std::pair<query_id, result> retrieve();
133 [[nodiscard]]
bool empty() const noexcept {
return m_queries.empty(); }
148 int retain(
int retain_max = 2);
155 struct PQXX_PRIVATE Query
157 explicit Query(std::string_view q) :
158 query{std::make_shared<std::string>(q)}
161 std::shared_ptr<std::string> query;
165 using QueryMap = std::map<query_id, Query>;
172 static constexpr
query_id qid_limit() noexcept
178 return (std::numeric_limits<query_id>::max)();
182 PQXX_PRIVATE
query_id generate_id();
184 bool have_pending()
const noexcept
186 return m_issuedrange.second != m_issuedrange.first;
189 PQXX_PRIVATE
void issue();
192 void set_error_at(
query_id qid) noexcept
199 [[noreturn]] PQXX_PRIVATE
void internal_error(std::string
const &err);
201 PQXX_PRIVATE
bool obtain_result(
bool expect_none =
false);
203 PQXX_PRIVATE
void obtain_dummy();
204 PQXX_PRIVATE
void get_further_available_results();
205 PQXX_PRIVATE
void check_end_results();
208 PQXX_PRIVATE
void receive_if_available();
211 PQXX_PRIVATE
void receive(pipeline::QueryMap::const_iterator stop);
212 std::pair<pipeline::query_id, result> retrieve(pipeline::QueryMap::iterator);
215 std::pair<QueryMap::iterator, QueryMap::iterator> m_issuedrange;
217 int m_num_waiting = 0;
221 bool m_dummy_pending =
false;
230 internal::encoding_group m_encoding;
234 #include "pqxx/internal/compiler-internal-post.hxx" result retrieve(query_id qid)
Retrieve result for given query.
Definition: pipeline.hxx:124
pipeline(transaction_base &t, std::string_view name)
Definition: pipeline.hxx:65
The home of all libpqxx classes, functions, templates, etc.
Definition: array.hxx:25
bool empty() const noexcept
Definition: pipeline.hxx:133
Processes several queries in FIFO manner, optimized for high throughput.
Definition: pipeline.hxx:42
pipeline(transaction_base &t, char const name[])
Definition: pipeline.hxx:55
long query_id
Definition: pipeline.hxx:45
pipeline(transaction_base &t, std::string &&name)
Definition: pipeline.hxx:60
Result set containing data returned by a query or command.
Definition: result.hxx:70
pipeline(transaction_base &t)
Definition: pipeline.hxx:50
Interface definition (and common code) for "transaction" classes.
Definition: transaction_base.hxx:67
Internal error in libpqxx library.
Definition: except.hxx:158