19 #ifndef PQXX_H_PIPELINE
20 #define PQXX_H_PIPELINE
22 #include "pqxx/compiler-public.hxx"
23 #include "pqxx/compiler-internal-pre.hxx"
25 #ifdef PQXX_HAVE_LIMITS
32 #include "pqxx/transaction_base"
64 const PGSTD::string &Name=PGSTD::string());
75 query_id insert(const PGSTD::
string &);
115 {
return retrieve(m_queries.find(qid)).second; }
119 PGSTD::pair<query_id, result> retrieve();
121 bool empty()
const throw () {
return m_queries.empty(); }
135 int retain(
int retain_max=2);
142 class PQXX_PRIVATE Query
145 explicit Query(
const PGSTD::string &q) : m_query(q), m_res() {}
147 const result &get_result()
const throw () {
return m_res; }
148 void set_result(
const result &r)
throw () { m_res = r; }
149 const PGSTD::string &get_query()
const throw () {
return m_query; }
152 PGSTD::string m_query;
156 typedef PGSTD::map<query_id,Query> QueryMap;
158 struct getquery:PGSTD::unary_function<QueryMap::const_iterator,PGSTD::string>
161 PGSTD::string operator()(QueryMap::const_iterator i)
const
162 {
return i->second.get_query(); }
169 static query_id qid_limit() throw ()
171 #if defined(PQXX_HAVE_LIMITS)
172 return PGSTD::numeric_limits<query_id>::max();
179 query_id PQXX_PRIVATE generate_id();
181 bool have_pending()
const throw ()
182 {
return m_issuedrange.second != m_issuedrange.first; }
184 void PQXX_PRIVATE issue();
187 void set_error_at(query_id qid)
throw () {
if (qid < m_error) m_error = qid; }
189 void PQXX_PRIVATE PQXX_NORETURN internal_error(
const PGSTD::string &err)
190 throw (PGSTD::logic_error);
192 bool PQXX_PRIVATE obtain_result(
bool expect_none=
false);
194 void PQXX_PRIVATE obtain_dummy();
195 void PQXX_PRIVATE get_further_available_results();
196 void PQXX_PRIVATE check_end_results();
199 void PQXX_PRIVATE receive_if_available();
202 void PQXX_PRIVATE receive(pipeline::QueryMap::const_iterator stop);
203 PGSTD::pair<pipeline::query_id, result>
204 retrieve(pipeline::QueryMap::iterator);
207 PGSTD::pair<QueryMap::iterator,QueryMap::iterator> m_issuedrange;
213 bool m_dummy_pending;
219 pipeline(
const pipeline &);
221 pipeline &operator=(
const pipeline &);
228 #include "pqxx/compiler-internal-post.hxx"