19 #ifndef CONNECTION_HPP 20 #define CONNECTION_HPP 23 #include "statement.hpp" 26 namespace vgi {
namespace dbconn {
namespace dbd {
32 namespace vgi {
namespace dbconn {
namespace dbi {
41 virtual bool connect() = 0;
42 virtual void disconnect() = 0;
43 virtual void commit() = 0;
44 virtual void rollback() = 0;
45 virtual void autocommit(
bool ac) = 0;
46 virtual bool connected()
const = 0;
47 virtual bool alive()
const = 0;
81 conn_impl = std::move(conn.conn_impl);
99 return conn_impl->connect();
107 conn_impl->disconnect();
116 return conn_impl->autocommit(ac);
132 conn_impl->rollback();
141 return conn_impl->connected();
150 return conn_impl->alive();
159 return statement(conn_impl->get_statement(*(conn_impl.get())));
166 template <
typename T>
167 explicit operator T&()
const 169 return dynamic_cast<T&
>(*conn_impl);
183 std::unique_ptr<iconnection> conn_impl;
189 #endif // CONNECTION_HPP void autocommit(bool ac)
Function sets auto-commit option, default is 'true'.
void disconnect()
Function closes connection to the database.
statement - is a class that manages native driver statement handle.
driver is a singleton template class which creates a concrete driver on load() and returns its instan...
connection(connection &&conn)
Move constructor.
statement get_statement()
Function returns statement object for the connection.
istatement - is an interface that describes common functionality for all concrete native implementati...
iconnection - is an interface that describes common functionality for all concrete native implementat...
bool alive() const
Function checks if connection to the database is alive.
connection & operator=(connection &&conn)
Move assign operator.
bool connect()
Function opens connection to the database.
bool connected() const
Function checks if connection to the database is opened.
connection - is a class that manages native driver connection handle.
void commit()
Function commits changes to the database.
void rollback()
Function rolls back uncommitted changes.