Connections pool, allows to handle multiple connections for specific connection string. More...
#include <cppdb/pool.h>
Classes | |
struct | entry |
Public Types | |
typedef ref_ptr< pool > | pointer |
Public Member Functions | |
ref_ptr< backend::connection > | open () |
void | gc () |
void | clear () |
Static Public Member Functions | |
static ref_ptr< pool > | create (std::string const &connection_string) |
Create new pool for connection_string. | |
static ref_ptr< pool > | create (connection_info const &ci) |
Create new pool for a parsed connection string ci. |
Connections pool, allows to handle multiple connections for specific connection string.
Note connections_manager provide more generic interface and hides pools inside it. So you generally should use this class only when you prefer to avoid using some global singleton object.
Unlike connections_manager, it uses pool by default unless its size defined as 0.
All this class member functions are thread safe to use from several threads for the same object
typedef ref_ptr<pool> cppdb::pool::pointer |
Shortcut of cppdb::ref_ptr<cppdb::pool> as cppdb::pool::pointer.
The pointer that is used to handle pool object
void cppdb::pool::clear | ( | ) |
Remove all connections from the pool
void cppdb::pool::gc | ( | ) |
Collect connections that were not used for a long time (close them)
Get a open a connection, it may be fetched either from pool or new one may be created