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" 51 namedclass{
"pipeline"},
56 pipeline(transaction_base &t,
char const name[]) :
57 namedclass{
"pipeline", name},
62 pipeline(transaction_base &t, std::string &&name) :
63 namedclass{
"pipeline", std::move(name)},
68 pipeline(transaction_base &t, std::string_view name) :
69 namedclass{
"pipeline", name},
84 query_id insert(std::string_view);
119 [[nodiscard]]
bool is_finished(query_id) const;
130 return retrieve(m_queries.find(qid)).second;
135 std::pair<query_id, result> retrieve();
137 [[nodiscard]]
bool empty() const noexcept {
return m_queries.empty(); }
152 int retain(
int retain_max = 2);
159 class PQXX_PRIVATE Query
162 explicit Query(std::string_view q) :
163 m_query{std::make_shared<std::string>(q)},
167 result
const &get_result() const noexcept {
return m_res; }
168 void set_result(result
const &r) noexcept { m_res = r; }
169 std::shared_ptr<std::string> get_query() const noexcept {
return m_query; }
172 std::shared_ptr<std::string> m_query;
176 using QueryMap = std::map<query_id, Query>;
183 static constexpr query_id qid_limit() noexcept
189 return (std::numeric_limits<query_id>::max)();
193 PQXX_PRIVATE query_id generate_id();
195 bool have_pending() const noexcept
197 return m_issuedrange.second != m_issuedrange.first;
200 PQXX_PRIVATE
void issue();
203 void set_error_at(query_id qid) noexcept
210 [[noreturn]] PQXX_PRIVATE
void internal_error(std::string
const &err);
212 PQXX_PRIVATE
bool obtain_result(
bool expect_none =
false);
214 PQXX_PRIVATE
void obtain_dummy();
215 PQXX_PRIVATE
void get_further_available_results();
216 PQXX_PRIVATE
void check_end_results();
219 PQXX_PRIVATE
void receive_if_available();
222 PQXX_PRIVATE
void receive(pipeline::QueryMap::const_iterator stop);
223 std::pair<pipeline::query_id, result> retrieve(pipeline::QueryMap::iterator);
226 std::pair<QueryMap::iterator, QueryMap::iterator> m_issuedrange;
228 int m_num_waiting = 0;
232 bool m_dummy_pending =
false;
235 query_id m_error = qid_limit();
239 #include "pqxx/internal/compiler-internal-post.hxx" Definition: transaction_base.hxx:42
pipeline(transaction_base &t)
Definition: pipeline.hxx:50
long query_id
Definition: pipeline.hxx:45
bool empty() const noexcept
Definition: pipeline.hxx:137
pipeline(transaction_base &t, char const name[])
Definition: pipeline.hxx:56
pipeline(transaction_base &t, std::string_view name)
Definition: pipeline.hxx:68
Processes several queries in FIFO manner, optimized for high throughput.
Definition: pipeline.hxx:42
pipeline(transaction_base &t, std::string &&name)
Definition: pipeline.hxx:62
Dedicated namespace for helper types related to prepared statements.
Definition: array.hxx:25