libpqxx
connection.hxx
1 
13 #ifndef PQXX_H_CONNECTION
14 #define PQXX_H_CONNECTION
15 
16 #include "pqxx/compiler-public.hxx"
17 #include "pqxx/compiler-internal-pre.hxx"
18 
19 #include "pqxx/connectionpolicy.hxx"
20 #include "pqxx/basic_connection.hxx"
21 
22 namespace pqxx
23 {
24 
67 
78 class PQXX_LIBEXPORT connect_direct : public connectionpolicy
79 {
80 public:
83  explicit connect_direct(const std::string &opts) : connectionpolicy(opts) {}
84  virtual handle do_startconnect(handle) override;
85 };
86 
89 
90 
92 
96 class PQXX_LIBEXPORT connect_lazy : public connectionpolicy
97 {
98 public:
101  explicit connect_lazy(const std::string &opts) : connectionpolicy(opts) {}
102  virtual handle do_completeconnect(handle) override;
103 };
104 
105 
108 
109 
111 
117 class PQXX_LIBEXPORT connect_async : public connectionpolicy
118 {
119 public:
122  explicit connect_async(const std::string &opts);
123  virtual handle do_startconnect(handle) override;
124  virtual handle do_completeconnect(handle) override;
125  virtual handle do_dropconnect(handle) noexcept override;
126  virtual bool is_ready(handle) const noexcept override;
127 
128 private:
130  bool m_connecting;
131 };
132 
133 
136 
137 
139 
143 class PQXX_LIBEXPORT connect_null : public connectionpolicy
144 {
145 public:
146  explicit connect_null(const std::string &opts) : connectionpolicy(opts) {}
147 };
148 
149 
152 
157 }
158 
159 #include "pqxx/compiler-internal-post.hxx"
160 
161 #endif
Asynchronous connection policy; connects "in the background".
Definition: connection.hxx:117
Definition: connectionpolicy.hxx:31
connect_null(const std::string &opts)
Definition: connection.hxx:146
connect_direct(const std::string &opts)
Definition: connection.hxx:83
Lazy connection policy; causes connection to be deferred until first use.
Definition: connection.hxx:96
Base-class template for all libpqxx connection types.
Definition: basic_connection.hxx:41
The home of all libpqxx classes, functions, templates, etc.
Definition: array.hxx:22
Nonfunctional, always-down connection policy for testing/debugging purposes.
Definition: connection.hxx:143
internal::pq::PGconn * handle
Definition: connectionpolicy.hxx:34
Connection policy; creates an immediate connection to a database.
Definition: connection.hxx:78
connect_lazy(const std::string &opts)
Definition: connection.hxx:101