From f26337fb02c2f01382486407c2b3d7432df9bd37 Mon Sep 17 00:00:00 2001 From: Constantin Michael Date: Mon, 9 May 2011 16:45:31 +0200 Subject: Add connection and connection factory implementations --- odb/pgsql/connection.hxx | 121 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 121 insertions(+) create mode 100644 odb/pgsql/connection.hxx (limited to 'odb/pgsql/connection.hxx') diff --git a/odb/pgsql/connection.hxx b/odb/pgsql/connection.hxx new file mode 100644 index 0000000..038ce70 --- /dev/null +++ b/odb/pgsql/connection.hxx @@ -0,0 +1,121 @@ +// file : odb/pgsql/connection.hxx +// author : Constantin Michael +// copyright : Copyright (c) 2005-2011 Code Synthesis Tools CC +// license : GNU GPL v2; see accompanying LICENSE file + +#ifndef ODB_PGSQL_CONNECTION_HXX +#define ODB_PGSQL_CONNECTION_HXX + +#include + +#include +#include // std::auto_ptr + +#include + +#include + +#include + +#include +#include + +#include + +namespace odb +{ + namespace pgsql + { + class statement; + class statement_cache; + + class LIBODB_PGSQL_EXPORT connection: public details::shared_base + { + public: + // typedef pgsql::statement_cache statement_cache_type; + typedef pgsql::database database_type; + + virtual + ~connection (); + + connection (database_type&); + + database_type& + database () + { + return db_; + } + + public: + PGconn* + handle () + { + return handle_; + } + + // statement_cache_type& + // statement_cache () + // { + // return *statement_cache_; + // } + + public: + // statement* + // active () + // { + // return active_; + // } + + // void + // active (statement* s) + // { + // active_ = s; + + // if (s == 0 && stmt_handles_.size () > 0) + // free_stmt_handles (); + // } + + // // Cancel and clear the active statement, if any. + // // + // void + // clear () + // { + // if (active_ != 0) + // clear_ (); + // } + + public: + // MYSQL_STMT* + // alloc_stmt_handle (); + + // void + // free_stmt_handle (MYSQL_STMT*); + + private: + connection (const connection&); + connection& operator= (const connection&); + + private: + // void + // free_stmt_handles (); + + // void + // clear_ (); + + private: + database_type& db_; + + PGconn* handle_; + + // statement* active_; + // std::auto_ptr statement_cache_; + + // typedef std::vector stmt_handles; + // stmt_handles stmt_handles_; + }; + } +} + +#include + +#endif // ODB_PGSQL_CONNECTION_HXX -- cgit v1.1