Wt: Wt::Dbo::FixedSqlConnectionPool Class Reference

Wt 3.3.0

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes

- Class List
- Class Hierarchy
- Class Members

Public Member Functions
Wt::Dbo::FixedSqlConnectionPool Class Reference
Database Objects (Wt::Dbo)

A connection pool of fixed size. More...

`#include <Wt/Dbo/FixedSqlConnectionPool>`

Inheritance diagram for Wt::Dbo::FixedSqlConnectionPool:
[legend]

List of all members.

## Public Member Functions
| FixedSqlConnectionPool (SqlConnection *connection, int size)
| Creates a fixed connection pool.
virtual SqlConnection * | getConnection ()
| Uses a connection from the pool.
virtual void | returnConnection (SqlConnection *)
| Returns a connection to the pool.
virtual void | prepareForDropTables () const
| Prepares all connections in the pool for dropping the tables.

## Detailed Description

A connection pool of fixed size.

This provides a connection pool of fixed size: its size is determined at startup time, and the pool will not grow as more connections are needed.

This is adequate when the number of threads (which need different connections to work with) is also bounded, like when using a fixed size thread pool. This is for example the case when used in conjunction with Wt. Note that you do not need as many connections as sessions, since Session will only use a connection while processing a transaction.

## Constructor & Destructor Documentation

Wt::Dbo::FixedSqlConnectionPool::FixedSqlConnectionPool | ( | SqlConnection * | connection,
|  | int | size
| ) |  |

Creates a fixed connection pool.

The pool is initialized with the provided `connection`, which is cloned (`size` - 1) times.

The pool thus takes ownership of the given connection.

## Member Function Documentation

SqlConnection * Wt::Dbo::FixedSqlConnectionPool::getConnection | ( |  | ) | `[virtual]`

Uses a connection from the pool.

This returns a connection from the pool that can be used. If the pool has no more connection available, the pool may decide to grow or block until a connection is returned.

This method is called by a Session when a new transaction is started.

Implements Wt::Dbo::SqlConnectionPool.

void Wt::Dbo::FixedSqlConnectionPool::returnConnection | ( | SqlConnection * |  | ) | `[virtual]`

Returns a connection to the pool.

This returns a connection to the pool. This method is called by a Session after a transaction has been finished.

Implements Wt::Dbo::SqlConnectionPool.

All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator