PostgreSQL connection. More...
#include <postgresqlConnection.hpp>
Public Member Functions | |
| PostgreSQLConnection (const std::string &connStr) | |
| PostgreSQLConnection (const SqlConnectionConfiguration &config) | |
| PostgreSQLConnection (const PostgreSQLConnection &)=delete | |
| virtual | ~PostgreSQLConnection () noexcept |
| Public Member Functions inherited from anch::sql::Connection | |
| 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 |
| Protected Member Functions inherited from anch::sql::Connection | |
| void | setValid (bool valid) noexcept |
Additional Inherited Members | |
| Protected Attributes inherited from anch::sql::Connection | |
| bool | _valid |
| bool | _transaction |
| std::map< std::string, PreparedStatement * > | _stmts |
| bool | _errors |
PostgreSQL connection.
SQL connection implementation through PostgreSQL native library
| anch::sql::PostgreSQLConnection::PostgreSQLConnection | ( | const std::string & | connStr | ) |
PostgreSQLConnection constructor
| connStr | the PostgreSQL connection string |
| SqlException | fail to create connection |
| anch::sql::PostgreSQLConnection::PostgreSQLConnection | ( | const SqlConnectionConfiguration & | config | ) |
PostgreSQLConnection constructor
| config | the PostgreSQL database configuration |
| SqlException | fail to create connection |
|
delete |
|
virtualnoexcept |
PostgreSQLConnection 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.