From 63295f6e051e75cf07cb6212a2631df8eb8a90c4 Mon Sep 17 00:00:00 2001 From: Constantin Michael Date: Mon, 5 Sep 2011 12:10:45 +0200 Subject: Add database, connection, connection-factory, and transaction support --- odb/oracle/connection.hxx | 105 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 105 insertions(+) create mode 100644 odb/oracle/connection.hxx (limited to 'odb/oracle/connection.hxx') diff --git a/odb/oracle/connection.hxx b/odb/oracle/connection.hxx new file mode 100644 index 0000000..8d0e447 --- /dev/null +++ b/odb/oracle/connection.hxx @@ -0,0 +1,105 @@ +// file : odb/oracle/connection.hxx +// author : Constantin Michael +// copyright : Copyright (c) 2005-2011 Code Synthesis Tools CC +// license : ODB NCUEL; see accompanying LICENSE file + +#ifndef ODB_ORACLE_CONNECTION_HXX +#define ODB_ORACLE_CONNECTION_HXX + +#include + +#include +#include // std::auto_ptr + +#include +#include + +#include + +#include +#include +#include +#include +#include + +#include + +namespace odb +{ + namespace oracle + { + class statement; + class statement_cache; + + class connection; + typedef details::shared_ptr connection_ptr; + + class LIBODB_ORACLE_EXPORT connection: public odb::connection + { + public: + typedef oracle::statement_cache statement_cache_type; + typedef oracle::database database_type; + + virtual + ~connection (); + + connection (database_type&); + connection (database_type&, OCISvcCtx* handle); + + database_type& + database () + { + return db_; + } + + public: + virtual transaction_impl* + begin (); + + public: + using odb::connection::execute; + + virtual unsigned long long + execute (const char* statement, std::size_t length); + + public: + OCISvcCtx* + handle () + { + return handle_; + } + + OCIError* + error_handle () + { + return error_; + } + + // statement_cache_type& + // statement_cache () + // { + // return *statement_cache_; + // } + + private: + connection (const connection&); + connection& operator= (const connection&); + + private: + database_type& db_; + + // It is important that the error_ member is declared before the + // handle_ member as handle_ depends on error_ during destruction. + // + auto_handle error_; + + auto_handle handle_; + + // std::auto_ptr statement_cache_; + }; + } +} + +#include + +#endif // ODB_ORACLE_CONNECTION_HXX -- cgit v1.1