|
#include <DatabaseConnectionPool.h>
Public Member Functions | |
| DatabaseConnectionPool (const String &connectionString, unsigned maxConnections=100, std::chrono::seconds connectionTimeout=std::chrono::seconds(60)) | |
| DatabaseConnection | getConnection () |
| std::chrono::seconds | connectionTimeout () const |
Public Member Functions inherited from sptk::DatabaseConnectionString | |
| DatabaseConnectionString (const String &connectionString="") | |
| DatabaseConnectionString (const DatabaseConnectionString &cs)=default | |
| DatabaseConnectionString & | operator= (const DatabaseConnectionString &cs)=default |
| String | toString () const |
| const String & | driverName () const |
| const String & | hostName () const |
| const String & | userName () const |
| const String & | password () const |
| const String & | databaseName () const |
| const String & | schema () const |
| uint16_t | portNumber () const |
| void | userName (const String &user) |
| void | password (const String &pass) |
| String | parameter (const String &name) const |
| bool | empty () const |
Protected Member Functions | |
| void | load () |
| SPoolDatabaseConnection | createConnection () |
| void | releaseConnection (const SPoolDatabaseConnection &connection) |
Protected Member Functions inherited from sptk::DatabaseConnectionString | |
| void | parse () |
Friends | |
| class | AutoDatabaseConnection |
Database driver loader
Loads and initializes SPTK database driver by request. Already loaded drivers are cached.
| sptk::DatabaseConnectionPool::DatabaseConnectionPool | ( | const String & | connectionString, |
| unsigned | maxConnections = 100, |
||
| std::chrono::seconds | connectionTimeout = std::chrono::seconds(60) |
||
| ) |
Constructor
Database connection string is the same for all connections, created with this object.
| connectionString | Database connection string |
| maxConnections | Maximum number of connections in the pool |
|
protected |
Creates database connection
|
protected |
Loads database driver
First successfull driver load places driver into driver cache.
|
protected |
Returns used database connection back to the pool
| connection | Database that is no longer in use and may be returned to the pool |