db_conn
v0.2.1-alpha
Database Connection API
|
connection - is a class that manages native driver connection handle. More...
#include <connection.hpp>
Public Member Functions | |
connection (connection &&conn) | |
Move constructor. More... | |
connection & | operator= (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... | |
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.
|
inline |
|
inline |
Function checks if connection to the database is alive.
Definition at line 148 of file connection.hpp.
|
inline |
Function sets auto-commit option, default is 'true'.
ac | - true to set auto-commit ON, false - OFF |
Definition at line 114 of file connection.hpp.
|
inline |
Function opens connection to the database.
Definition at line 97 of file connection.hpp.
|
inline |
Function checks if connection to the database is opened.
Definition at line 139 of file connection.hpp.
|
inline |
Function returns statement object for the connection.
Definition at line 157 of file connection.hpp.
|
inlineexplicit |
Conversion operator to the concrete database connection implementation.
Definition at line 167 of file connection.hpp.
|
inline |