// 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 #include // PGconn #include namespace odb { namespace pgsql { class statement; class statement_cache; class connection; typedef details::shared_ptr connection_ptr; class LIBODB_PGSQL_EXPORT connection: public odb::connection { public: typedef pgsql::statement_cache statement_cache_type; typedef pgsql::database database_type; virtual ~connection (); connection (database_type&); connection (database_type&, PGconn* 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: PGconn* handle () { return handle_; } statement_cache_type& statement_cache () { return *statement_cache_; } private: connection (const connection&); connection& operator= (const connection&); private: void init (); private: database_type& db_; PGconn* handle_; std::auto_ptr statement_cache_; }; } } #include #endif // ODB_PGSQL_CONNECTION_HXX