basic_connection.hxx
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef PQXX_H_BASIC_CONNECTION
00020 #define PQXX_H_BASIC_CONNECTION
00021
00022 #include "pqxx/compiler-public.hxx"
00023 #include "pqxx/compiler-internal-pre.hxx"
00024
00025 #include <string>
00026
00027 #include "pqxx/connection_base"
00028
00029 namespace pqxx
00030 {
00031
00032
00034
00048 template<typename CONNECTPOLICY> class basic_connection :
00049 public connection_base
00050 {
00051 public:
00052 basic_connection() :
00053 connection_base(m_policy),
00054 m_options(PGSTD::string()),
00055 m_policy(m_options)
00056 { init(); }
00057
00058 explicit basic_connection(const PGSTD::string &opt) :
00059 connection_base(m_policy), m_options(opt), m_policy(m_options) {init();}
00060
00061 explicit basic_connection(const char opt[]) :
00062 connection_base(m_policy),
00063 m_options(opt?opt:PGSTD::string()),
00064 m_policy(m_options)
00065 { init(); }
00066
00067 ~basic_connection() throw ()
00068 {
00069 #ifdef PQXX_QUIET_DESTRUCTORS
00070 PGSTD::auto_ptr<noticer> n(new nonnoticer);
00071 set_noticer(n);
00072 #endif
00073 close();
00074 }
00075
00076 const PGSTD::string &options() const throw ()
00077 {return m_policy.options();}
00078
00079 private:
00081 PGSTD::string m_options;
00083 CONNECTPOLICY m_policy;
00084 };
00085
00086 }
00087
00088 #include "pqxx/compiler-internal-post.hxx"
00089
00090 #endif
00091