Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

pipeline.hxx

Go to the documentation of this file.
00001 /*------------------------------------------------------------------------- 00002 * 00003 * FILE 00004 * pqxx/pipeline.hxx 00005 * 00006 * DESCRIPTION 00007 * definition of the pqxx::pipeline class. 00008 * Throughput-optimized query manager 00009 * DO NOT INCLUDE THIS FILE DIRECTLY; include pqxx/pipeline instead. 00010 * 00011 * Copyright (c) 2003-2004, Jeroen T. Vermeulen <jtv@xs4all.nl> 00012 * 00013 * See COPYING for copyright license. If you did not receive a file called 00014 * COPYING with this source code, please notify the distributor of this mistake, 00015 * or contact the author. 00016 * 00017 *------------------------------------------------------------------------- 00018 */ 00019 #include "pqxx/libcompiler.h" 00020 00021 #include <deque> 00022 #include <map> 00023 #include <string> 00024 #include <vector> 00025 00026 #include "pqxx/transaction_base" 00027 00028 00029 /* Methods tested in eg. self-test program test001 are marked with "//[t1]" 00030 */ 00031 00032 namespace pqxx 00033 { 00034 00036 00059 class PQXX_LIBEXPORT pipeline : public internal::transactionfocus 00060 { 00061 public: 00062 typedef unsigned query_id; 00063 00064 explicit pipeline(transaction_base &t, 00065 const PGSTD::string &PName=""); //[t69] 00066 00067 ~pipeline() throw (); 00068 00070 00075 query_id insert(const PGSTD::string &); //[t69] 00076 00078 void complete(); //[t71] 00079 00081 void flush(); //[t70] 00082 00084 bool is_running(query_id) const; //[t71] 00085 00087 bool is_finished(query_id) const; //[t71] 00088 00090 00093 result retrieve(query_id); //[t71] 00094 00096 PGSTD::pair<query_id, result> retrieve(); //[t69] 00097 00098 bool empty() const throw (); //[t69] 00099 00101 00117 void retain() { m_retain = true; } //[t70] 00118 // TODO: Make retain() set a max. number of queries to retain 00119 00121 void resume(); //[t70] 00122 00123 private: 00125 query_id generate_id(); 00127 void send_waiting(); 00129 void consumeresults(); 00130 00131 typedef PGSTD::map<query_id, result> ResultsMap; 00132 typedef PGSTD::map<query_id, PGSTD::string> QueryMap; 00133 typedef PGSTD::deque<query_id> QueryQueue; 00134 00136 ResultsMap::value_type deliver(ResultsMap::iterator); 00137 00138 QueryMap m_queries; 00139 QueryQueue m_waiting, m_sent; 00140 ResultsMap m_completed; 00141 query_id m_nextid; 00142 bool m_retain; 00143 bool m_error; 00144 00146 bool m_bsgt; 00147 00149 pipeline(const pipeline &); 00151 pipeline &operator=(const pipeline &); 00152 }; 00153 00154 00155 } // namespace 00156 00157

Generated on Sun Jun 6 20:55:10 2004 for libpqxx by doxygen 1.3.7