libpqxx 4.0
|
00001 /*------------------------------------------------------------------------- 00002 * 00003 * FILE 00004 * pqxx/connectionpolicy.hxx 00005 * 00006 * DESCRIPTION 00007 * definition of the connection policy classes 00008 * Interface for defining connection policies 00009 * DO NOT INCLUDE THIS FILE DIRECTLY; include pqxx/connection instead. 00010 * 00011 * Copyright (c) 2005-2011, Jeroen T. Vermeulen <jtv@xs4all.nl> 00012 * 00013 * See COPYING for copyright license. If you did not receive a file called 00014 * COPYING with this source code, please notify the distributor of this mistake, 00015 * or contact the author. 00016 * 00017 *------------------------------------------------------------------------- 00018 */ 00019 #ifndef PQXX_H_CONNECTIONPOLICY 00020 #define PQXX_H_CONNECTIONPOLICY 00021 00022 #include "pqxx/compiler-public.hxx" 00023 #include "pqxx/compiler-internal-pre.hxx" 00024 00025 #include <string> 00026 00027 #include "pqxx/internal/libpq-forward.hxx" 00028 00029 00030 namespace pqxx 00031 { 00032 00033 00038 00039 class PQXX_LIBEXPORT connectionpolicy 00040 { 00041 public: 00042 typedef internal::pq::PGconn *handle; 00043 00044 explicit connectionpolicy(const PGSTD::string &opts); 00045 virtual ~connectionpolicy() throw (); 00046 00047 const PGSTD::string &options() const throw () { return m_options; } 00048 00049 virtual handle do_startconnect(handle orig); 00050 virtual handle do_completeconnect(handle orig); 00051 virtual handle do_dropconnect(handle orig) throw (); 00052 virtual handle do_disconnect(handle orig) throw (); 00053 virtual bool is_ready(handle) const throw (); 00054 00055 protected: 00056 handle normalconnect(handle); 00057 00058 private: 00059 PGSTD::string m_options; 00060 }; 00061 00063 } // namespace 00064 00065 #include "pqxx/compiler-internal-post.hxx" 00066 00067 #endif 00068