MySQL connection. More...
#include <mysqlConnection.hpp>
Public Member Functions | |
MySQLConnection (const SqlConnectionConfiguration &config) | |
MySQLConnection (const MySQLConnection &) | |
virtual | ~MySQLConnection () noexcept |
![]() | |
Connection () | |
Connection (const Connection &)=delete | |
virtual | ~Connection () noexcept |
void | startTransaction () |
void | begin () |
void | commit () |
void | rollback () |
void | release () noexcept |
PreparedStatement & | prepareStatement (const std::string &query) |
ResultSet * | query (const std::string &query) |
void | queryMapRow (const std::string &sqlQuery, std::function< void(ResultSet &)> rowMapper) |
void | queryExtract (const std::string &sqlQuery, std::function< void(ResultSet &)> resExtractor) |
template<typename T, typename... Q> | |
ResultSet * | query (const std::string &query, const T &value, const Q &... values) |
template<typename T, typename... Q> | |
void | queryMapRow (const std::string &query, std::function< void(ResultSet &)> rowMapper, const T &value, const Q &... values) |
template<typename T, typename... Q> | |
void | queryExtract (const std::string &query, std::function< void(ResultSet &)> resExtractor, const T &value, const Q &... values) |
uint64_t | update (const std::string &query) |
template<typename T, typename... Q> | |
uint64_t | update (const std::string &query, const T &value, const Q &... values) |
template<typename T, typename Iterable> | |
uint64_t | batchUpdate (const std::string &query, std::function< void(PreparedStatement &, const T &)> mapper, const Iterable &values) |
bool | isValid () const noexcept |
Protected Member Functions | |
virtual ResultSet * | executeQuery (const std::string &query) override |
virtual uint64_t | executeUpdate (const std::string &query) override |
virtual void | sendCommit () override |
virtual void | sendRollback () override |
virtual void | sendStartTransaction () override |
virtual PreparedStatement * | makePrepared (const std::string &query) override |
![]() | |
void | setValid (bool valid) noexcept |
Additional Inherited Members | |
![]() | |
bool | _valid |
bool | _transaction |
std::map< std::string, PreparedStatement * > | _stmts |
bool | _errors |
MySQL connection.
SQL connection implementation through MySQL native library
anch::sql::MySQLConnection::MySQLConnection | ( | const SqlConnectionConfiguration & | config | ) |
MySQLConnection constructor
config | the MySQL database configuration |
SqlException | any error |
anch::sql::MySQLConnection::MySQLConnection | ( | const MySQLConnection & | ) |
|
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 SQL query to prepare SQL statement
query | the SQL query |
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 start transaction to database server
SqlException | any error |
Implements anch::sql::Connection.