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 <memory>
00026 #include <string>
00027
00028 #include "pqxx/connection_base"
00029
00030
00031 namespace pqxx
00032 {
00033
00034
00036
00050 template<typename CONNECTPOLICY> class basic_connection :
00051 public connection_base
00052 {
00053 public:
00054 basic_connection() :
00055 connection_base(m_policy),
00056 m_options(std::string()),
00057 m_policy(m_options)
00058 { init(); }
00059
00060 explicit basic_connection(const std::string &opt) :
00061 connection_base(m_policy), m_options(opt), m_policy(m_options) {init();}
00062
00063 explicit basic_connection(const char opt[]) :
00064 connection_base(m_policy),
00065 m_options(opt?opt:std::string()),
00066 m_policy(m_options)
00067 { init(); }
00068
00069 ~basic_connection() PQXX_NOEXCEPT { close(); }
00070
00071 const std::string &options() const PQXX_NOEXCEPT
00072 {return m_policy.options();}
00073
00074 private:
00076 std::string m_options;
00078 CONNECTPOLICY m_policy;
00079 };
00080
00081 }
00082
00083 #include "pqxx/compiler-internal-post.hxx"
00084
00085 #endif