#include <ConnectionManager.h>
Public Member Functions | |
ConnectionManager (const std::string &connInfo, WinLogger *logger, bool autoReconnect=true) | |
Constructor. | |
PGconn * | getConnection () |
Establishes a connection. | |
void | setAutoReconnect (bool value) |
Switch Connection Manager to wotk in auto reconnect way. | |
const bool | isConnected () |
Checks if connection is established. |
Establishes a connection to postgresql DB
ConnectionManager::ConnectionManager | ( | const std::string & | connInfo, | |
WinLogger * | logger, | |||
bool | autoReconnect = true | |||
) | [inline] |
Constructor.
connInfo | connection info | |
logger | logger |
PGconn * ConnectionManager::getConnection | ( | ) |
Establishes a connection.
If a connection was established early it returns old connection if the connection lost it try to established new connection
void ConnectionManager::setAutoReconnect | ( | bool | value | ) | [inline] |
Switch Connection Manager to wotk in auto reconnect way.
If the option set to true a connection is re-establishing autmatically otherwise a broken connection exception is broken.
const bool ConnectionManager::isConnected | ( | ) | [inline] |
Checks if connection is established.