db_conn  v0.2.1-alpha
Database Connection API
vgi::dbconn::dbi::connection Class Reference

connection - is a class that manages native driver connection handle. More...

#include <connection.hpp>

Public Member Functions

 connection (connection &&conn)
 Move constructor. More...
 
connectionoperator= (connection &&conn)
 Move assign operator. More...
 
 ~connection ()
 Destructor.
 
bool connect ()
 Function opens connection to the database. More...
 
void disconnect ()
 Function closes connection to the database.
 
void autocommit (bool ac)
 Function sets auto-commit option, default is 'true'. More...
 
void commit ()
 Function commits changes to the database.
 
void rollback ()
 Function rolls back uncommitted changes.
 
bool connected () const
 Function checks if connection to the database is opened. More...
 
bool alive () const
 Function checks if connection to the database is alive. More...
 
statement get_statement ()
 Function returns statement object for the connection. More...
 
template<typename T >
 operator T & () const
 Conversion operator to the concrete database connection implementation. More...
 

Detailed Description

connection - is a class that manages native driver connection handle.

connection object cannot be instantiated directly, only via driver get_connection() function call. connection objects automatically delete the native connection handle they manage as soon as they themselves are destroyed, or as soon as their value changes by an assignment operation. When an assignment operation takes place between two connection objects, ownership of native connection handle is transferred, which means that the object losing ownership is no longer has access to the native connection handle.

Definition at line 62 of file connection.hpp.

Constructor & Destructor Documentation

vgi::dbconn::dbi::connection::connection ( connection &&  conn)
inline

Move constructor.

Parameters
conn

Definition at line 69 of file connection.hpp.

Member Function Documentation

bool vgi::dbconn::dbi::connection::alive ( ) const
inline

Function checks if connection to the database is alive.

Returns
true on success, false otherwise

Definition at line 148 of file connection.hpp.

void vgi::dbconn::dbi::connection::autocommit ( bool  ac)
inline

Function sets auto-commit option, default is 'true'.

Parameters
ac- true to set auto-commit ON, false - OFF

Definition at line 114 of file connection.hpp.

bool vgi::dbconn::dbi::connection::connect ( )
inline

Function opens connection to the database.

Returns
true on success, false otherwise

Definition at line 97 of file connection.hpp.

bool vgi::dbconn::dbi::connection::connected ( ) const
inline

Function checks if connection to the database is opened.

Returns
true on success, false otherwise

Definition at line 139 of file connection.hpp.

statement vgi::dbconn::dbi::connection::get_statement ( )
inline

Function returns statement object for the connection.

Returns

Definition at line 157 of file connection.hpp.

template<typename T >
vgi::dbconn::dbi::connection::operator T & ( ) const
inlineexplicit

Conversion operator to the concrete database connection implementation.

Returns

Definition at line 167 of file connection.hpp.

connection& vgi::dbconn::dbi::connection::operator= ( connection &&  conn)
inline

Move assign operator.

Parameters
conn
Returns

Definition at line 78 of file connection.hpp.


The documentation for this class was generated from the following file: