libpqxx: connection.hxx Source File

libpqxx 4.0.1

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes

connection.hxx
1 /*-------------------------------------------------------------------------
2 *
3 * FILE
4 * pqxx/connection.hxx
5 *
6 * DESCRIPTION
7 * definition of the pqxx::connection and pqxx::lazyconnection classes.
8 * Different ways of setting up a backend connection.
9 * DO NOT INCLUDE THIS FILE DIRECTLY; include pqxx/connection instead.
10 *
11 * Copyright (c) 2001-2011, Jeroen T. Vermeulen <jtv@xs4all.nl>
12 *
13 * See COPYING for copyright license. If you did not receive a file called
14 * COPYING with this source code, please notify the distributor of this mistake,
15 * or contact the author.
16 *
17 *-------------------------------------------------------------------------
18 */
19 #ifndef PQXX_H_CONNECTION
20 #define PQXX_H_CONNECTION
21
22 #include "pqxx/compiler-public.hxx"
23 #include "pqxx/compiler-internal-pre.hxx"
24
25 #include "pqxx/connectionpolicy"
26 #include "pqxx/basic_connection"
27
28 namespace pqxx
29 {
30
73
74
84 class PQXX_LIBEXPORT connect_direct : public connectionpolicy
85 {
86 public:
87 explicit connect_direct(const PGSTD::string &opts) : connectionpolicy(opts) {}
88 virtual handle do_startconnect(handle);
89 };
90
92 typedef basic_connection<connect_direct> connection;
93
94
96
100 class PQXX_LIBEXPORT connect_lazy : public connectionpolicy
101 {
102 public:
103 explicit connect_lazy(const PGSTD::string &opts) : connectionpolicy(opts) {}
104 virtual handle do_completeconnect(handle);
105 };
106
107
109 typedef basic_connection<connect_lazy> lazyconnection;
110
111
113
119 class PQXX_LIBEXPORT connect_async : public connectionpolicy
120 {
121 public:
122 explicit connect_async(const PGSTD::string &opts);
123 virtual handle do_startconnect(handle);
124 virtual handle do_completeconnect(handle);
125 virtual handle do_dropconnect(handle) throw ();
126 virtual bool is_ready(handle) const throw ();
127
128 private:
130 bool m_connecting;
131 };
132
133
135 typedef basic_connection<connect_async> asyncconnection;
136
137
139
143 class PQXX_LIBEXPORT connect_null : public connectionpolicy
144 {
145 public:
146 explicit connect_null(const PGSTD::string &opts) : connectionpolicy(opts) {}
147 };
148
149
151 typedef basic_connection<connect_null> nullconnection;
152
157 }
158
159 #include "pqxx/compiler-internal-post.hxx"
160
161 #endif
162