aboutsummaryrefslogtreecommitdiff
path: root/odb/pgsql/connection.hxx
diff options
context:
space:
mode:
authorConstantin Michael <constantin@codesynthesis.com>2011-05-09 16:45:31 +0200
committerConstantin Michael <constantin@codesynthesis.com>2011-05-11 09:27:40 +0200
commitf26337fb02c2f01382486407c2b3d7432df9bd37 (patch)
tree0ddc753671f25c0605a0180c2740963c3a0bb845 /odb/pgsql/connection.hxx
parent74d9ab3518d50ebafb12e8252c01fa904b089481 (diff)
Add connection and connection factory implementations
Diffstat (limited to 'odb/pgsql/connection.hxx')
-rw-r--r--odb/pgsql/connection.hxx121
1 files changed, 121 insertions, 0 deletions
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 <constantin@codesynthesis.com>
+// 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 <odb/pre.hxx>
+
+#include <vector>
+#include <memory> // std::auto_ptr
+
+#include <libpq-fe.h>
+
+#include <odb/forward.hxx>
+
+#include <odb/details/shared-ptr.hxx>
+
+#include <odb/pgsql/version.hxx>
+#include <odb/pgsql/forward.hxx>
+
+#include <odb/pgsql/details/export.hxx>
+
+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_type> statement_cache_;
+
+ // typedef std::vector<MYSQL_STMT*> stmt_handles;
+ // stmt_handles stmt_handles_;
+ };
+ }
+}
+
+#include <odb/post.hxx>
+
+#endif // ODB_PGSQL_CONNECTION_HXX