#include <ozo/connection_info.h>
Connection source to a single host.
This connection source establishes a connection to a single host using (or via) the specified connection string.
| OidMap | — oid map type with custom types that should be used within a connection. |
| Statistics | — statistics type which defines statistics is collected for this connection. |
ConnectionSourceTypes | |
| using | connection_type = std::shared_ptr< ozo::connection< OidMap, Statistics > > |
| Type of connection which is produced by the source. | |
Public Member Functions | |
| connection_info (std::string conn_str, const OidMap &=OidMap{}, Statistics statistics=Statistics{}) | |
| Construct a new connection information object. More... | |
| template<typename TimeConstraint , typename Handler > | |
| void | operator() (io_context &io, TimeConstraint t, Handler &&handler) const |
Provides connection is binded to the given io_context More... | |
Related Functions | |
(Note that these are not member functions.) | |
| template<typename OidMap = empty_oid_map, typename Statistics = no_statistics> | |
| auto | make_connection_info (std::string conn_str, const OidMap &oid_map=OidMap{}, Statistics statistics=Statistics{}) |
Constructs ozo::connection_info ConnectionSource. More... | |
| ozo::connection_info< OidMap, Statistics >::connection_info | ( | std::string | conn_str, |
| const OidMap & | = OidMap{}, |
||
| Statistics | statistics = Statistics{} |
||
| ) |
Construct a new connection information object.
| conn_str | — connection string which is being used to create connection to a database. For details of how to make string see official libpq documentation |
| OidMap | — #OidMap for custom types support. |
| statistics | — statistics are being used for connections. |
| void ozo::connection_info< OidMap, Statistics >::operator() | ( | io_context & | io, |
| TimeConstraint | t, | ||
| Handler && | handler | ||
| ) | const |
Provides connection is binded to the given io_context
In case of success — the handler will be invoked as operation succeeded. In case of connection fail — the handler will be invoked as operation failed. This operation has a time constrain and would be interrupted if the time constrain expired by cancelling IO on a Connection's socket.
| io | — io_context for the connection IO. |
| t | — #TimeConstraint for the operation. |
| handler | — Handler. |