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
55 transactionfocus{t, s_classname, tname}
104 [[nodiscard]]
bool is_finished(
query_id)
const;
115 return retrieve(m_queries.find(qid)).second;
120 std::pair<query_id, result> retrieve();
122 [[nodiscard]]
bool empty() const noexcept {
return std::empty(m_queries); }
137 int retain(
int retain_max = 2);
144 struct PQXX_PRIVATE Query
146 explicit Query(std::string_view q) :
147 query{std::make_shared<std::string>(q)}
150 std::shared_ptr<std::string> query;
154 using QueryMap = std::map<query_id, Query>;
161 static constexpr
query_id qid_limit() noexcept
167 return (std::numeric_limits<query_id>::max)();
171 PQXX_PRIVATE
query_id generate_id();
173 bool have_pending()
const noexcept
175 return m_issuedrange.second != m_issuedrange.first;
178 PQXX_PRIVATE
void issue();
181 void set_error_at(
query_id qid) noexcept
188 [[noreturn]] PQXX_PRIVATE
void internal_error(std::string
const &err);
190 PQXX_PRIVATE
bool obtain_result(
bool expect_none =
false);
192 PQXX_PRIVATE
void obtain_dummy();
193 PQXX_PRIVATE
void get_further_available_results();
194 PQXX_PRIVATE
void check_end_results();
197 PQXX_PRIVATE
void receive_if_available();
200 PQXX_PRIVATE
void receive(pipeline::QueryMap::const_iterator stop);
201 std::pair<pipeline::query_id, result> retrieve(pipeline::QueryMap::iterator);
204 std::pair<QueryMap::iterator, QueryMap::iterator> m_issuedrange;
206 int m_num_waiting = 0;
210 bool m_dummy_pending =
false;
219 internal::encoding_group m_encoding;
221 constexpr
static std::string_view s_classname{
"pipeline"};
225 #include "pqxx/internal/compiler-internal-post.hxx" Interface definition (and common code) for "transaction" classes.
Definition: transaction_base.hxx:71
pipeline(transaction_base &t)
Definition: pipeline.hxx:50
long query_id
Definition: pipeline.hxx:45
Internal error in libpqxx library.
Definition: except.hxx:157
The home of all libpqxx classes, functions, templates, etc.
Definition: array.hxx:25
bool empty() const noexcept
Definition: pipeline.hxx:122
Processes several queries in FIFO manner, optimized for high throughput.
Definition: pipeline.hxx:42
result retrieve(query_id qid)
Retrieve result for given query.
Definition: pipeline.hxx:113
pipeline(transaction_base &t, std::string_view tname)
Definition: pipeline.hxx:54
Result set containing data returned by a query or command.
Definition: result.hxx:70