libpqxx  4.0.1
connectionpolicy.hxx
1 /*-------------------------------------------------------------------------
2  *
3  * FILE
4  * pqxx/connectionpolicy.hxx
5  *
6  * DESCRIPTION
7  * definition of the connection policy classes
8  * Interface for defining connection policies
9  * DO NOT INCLUDE THIS FILE DIRECTLY; include pqxx/connection instead.
10  *
11  * Copyright (c) 2005-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_CONNECTIONPOLICY
20 #define PQXX_H_CONNECTIONPOLICY
21 
22 #include "pqxx/compiler-public.hxx"
23 #include "pqxx/compiler-internal-pre.hxx"
24 
25 #include <string>
26 
27 #include "pqxx/internal/libpq-forward.hxx"
28 
29 
30 namespace pqxx
31 {
32 
33 
38 
39 class PQXX_LIBEXPORT connectionpolicy
40 {
41 public:
42  typedef internal::pq::PGconn *handle;
43 
44  explicit connectionpolicy(const PGSTD::string &opts);
45  virtual ~connectionpolicy() throw ();
46 
47  const PGSTD::string &options() const throw () { return m_options; }
48 
49  virtual handle do_startconnect(handle orig);
50  virtual handle do_completeconnect(handle orig);
51  virtual handle do_dropconnect(handle orig) throw ();
52  virtual handle do_disconnect(handle orig) throw ();
53  virtual bool is_ready(handle) const throw ();
54 
55 protected:
56  handle normalconnect(handle);
57 
58 private:
59  PGSTD::string m_options;
60 };
61 
63 } // namespace
64 
65 #include "pqxx/compiler-internal-post.hxx"
66 
67 #endif
68