![]() |
AnCH Framework
0.1
Another C++ Hack Framework
|
MySQL connection. More...
#include <mysqlConnection.hpp>
Public Member Functions | |
MySQLConnection (const std::string &host, const std::string &user, const std::string &password, const std::string &database, int port, const std::string &app="AnCH") throw (SqlException) | |
MySQLConnection (const SqlConnectionConfiguration &config) throw (SqlException) | |
MySQLConnection (const MySQLConnection &) throw (SqlException) | |
virtual | ~MySQLConnection () noexcept |
![]() | |
Connection () throw (SqlException) | |
Connection (const Connection &)=delete | |
virtual | ~Connection () |
void | commit () throw (SqlException) |
void | rollback () throw (SqlException) |
void | setAutoCommit (bool autoCommit) throw (SqlException) |
ResultSet * | query (const std::string &query) throw (SqlException) |
void | queryMapRow (const std::string &sqlQuery, std::function< void(ResultSet &)> rowMapper) throw (SqlException) |
void | queryExtract (const std::string &sqlQuery, std::function< void(ResultSet &)> resExtractor) throw (SqlException) |
uint64_t | update (const std::string &query) throw (SqlException) |
bool | isAutoCommit () const |
bool | isValid () const |
Protected Member Functions | |
virtual ResultSet * | executeQuery (const std::string &query) override throw (SqlException) |
virtual uint64_t | executeUpdate (const std::string &query) override throw (SqlException) |
virtual void | sendCommit () override throw (SqlException) |
virtual void | sendRollback () override throw (SqlException) |
virtual void | toggleAutoCommit (bool autoCommit) override throw (SqlException) |
![]() | |
void | setValid (bool valid) |
Additional Inherited Members | |
![]() | |
bool | _autoCommit |
bool | _valid |
MySQL connection.
SQL connection implementation through MySQL native library
MySQLConnection::MySQLConnection | ( | const std::string & | host, |
const std::string & | user, | ||
const std::string & | password, | ||
const std::string & | database, | ||
int | port, | ||
const std::string & | app = "AnCH" |
||
) | |||
throw | ( | SqlException | |
) |
MySQLConnection constructor
host | the MySQL server host |
user | the connection user |
password | the connection password |
database | the database name |
port | the connection port |
app | the client application (default: AnCH) ; used to retrieve configuration per application if declared in my.cnf |
SqlException | any error |
MySQLConnection::MySQLConnection | ( | const SqlConnectionConfiguration & | config | ) | |
throw | ( | SqlException | |||
) |
MySQLConnection constructor
config | the MySQL database configuration |
SqlException | any error |
anch::sql::MySQLConnection::MySQLConnection | ( | const MySQLConnection & | ) | ||
throw | ( | SqlException | |||
) |
Prohibits MySQLConnection copy constructor
|
virtualnoexcept |
MySQLConnection destructor
|
overrideprotectedvirtual |
Execute SQL select query
query | the SQL query to execute |
SqlException | any error |
Implements anch::sql::Connection.
|
overrideprotectedvirtual |
Execute SQL update query
query | the SQL query to execute |
SqlException | any error |
Implements anch::sql::Connection.
|
overrideprotectedvirtual |
Send commit to database server
SqlException | fail to commit transaction |
Implements anch::sql::Connection.
|
overrideprotectedvirtual |
Send rollback to database server
SqlException | fail to rollback transaction |
Implements anch::sql::Connection.
|
overrideprotectedvirtual |
Send auto commit status modification to server
autoCommit | the status to send |
SqlException | any error |
Implements anch::sql::Connection.