13#ifndef PQXX_H_PIPELINE
14#define PQXX_H_PIPELINE
16#if !defined(PQXX_HEADER_PRE)
17# error "Include libpqxx headers as <pqxx/header>, not <pqxx/header.hxx>."
54 using query_id = long;
56 pipeline(pipeline
const &) =
delete;
57 pipeline &operator=(pipeline
const &) =
delete;
58 pipeline(pipeline &&) =
delete;
59 pipeline &operator=(pipeline &&) =
delete;
63 explicit pipeline(transaction_base &t) : transaction_focus{t, s_classname}
68 pipeline(transaction_base &t, std::string_view tname) :
69 transaction_focus{t, s_classname, tname}
84 query_id insert(std::string_view) &;
119 [[nodiscard]]
bool is_finished(query_id) const;
128 result retrieve(query_id qid)
130 return retrieve(m_queries.find(qid)).second;
135 std::pair<query_id, result> retrieve();
137 [[nodiscard]]
bool empty() const noexcept {
return std::empty(m_queries); }
152 int retain(
int retain_max = 2) &;
161 explicit Query(std::string_view q) :
162 query{std::make_shared<std::string>(q)}
165 std::shared_ptr<std::string> query;
169 using QueryMap = std::map<query_id, Query>;
176 static constexpr query_id qid_limit() noexcept
182 return (std::numeric_limits<query_id>::max)();
188 bool have_pending() const noexcept
190 return m_issuedrange.second != m_issuedrange.first;
196 void set_error_at(query_id qid)
noexcept
204 [[noreturn]]
PQXX_PRIVATE void internal_error(std::string
const &err);
206 PQXX_PRIVATE bool obtain_result(
bool expect_none =
false);
216 PQXX_PRIVATE void receive(pipeline::QueryMap::const_iterator stop);
217 std::pair<pipeline::query_id, result> retrieve(pipeline::QueryMap::iterator);
220 std::pair<QueryMap::iterator, QueryMap::iterator> m_issuedrange;
222 int m_num_waiting = 0;
226 bool m_dummy_pending =
false;
229 query_id m_error = qid_limit();
235 internal::encoding_group m_encoding;
237 static constexpr std::string_view s_classname{
"pipeline"};
Base class for things that monopolise a transaction's attention.
Definition transaction_focus.hxx:29
The home of all libpqxx classes, functions, templates, etc.
Definition array.cxx:27