OCILIB (C and C++ Driver for Oracle)
4.7.5
Open source and cross platform Oracle Driver delivering efficient access to Oracle databases.
|
A connection or session Pool. More...
#include <types.hpp>
Inherits ocilib::core::HandleHolder< OCI_Pool * >.
Public Types | |
enum | PoolTypeValues { ConnectionPool = OCI_POOL_CONNECTION , SessionPool = OCI_POOL_SESSION } |
Pool type enumerated values. More... | |
typedef core::Enum< PoolTypeValues > | PoolType |
Type of Pool. | |
Public Member Functions | |
Pool () | |
Default constructor. | |
Pool (const ostring &db, const ostring &user, const ostring &pwd, Pool::PoolType poolType, unsigned int minSize, unsigned int maxSize, unsigned int increment=1, Environment::SessionFlags sessionFlags=Environment::SessionDefault) | |
Constructor that creates an underlying pool with the given information. | |
void | Open (const ostring &db, const ostring &user, const ostring &pwd, Pool::PoolType poolType, unsigned int minSize, unsigned int maxSize, unsigned int increment=1, Environment::SessionFlags sessionFlags=Environment::SessionDefault) |
Create an Oracle pool of connections or sessions. | |
void | Close () |
Destroy the current Oracle pool of connections or sessions. | |
Connection | GetConnection (const ostring &sessionTag=OTEXT("")) |
Get a connection from the pool. | |
unsigned int | GetTimeout () const |
Get the idle timeout for connections/sessions in the pool. | |
void | SetTimeout (unsigned int value) |
Set the connections/sessions idle timeout. | |
bool | GetNoWait () const |
Get the waiting mode used when no more connections/sessions are available from the pool. | |
void | SetNoWait (bool value) |
Set the waiting mode used when no more connections/sessions are available from the pool. | |
unsigned int | GetBusyConnectionsCount () const |
Return the current number of busy connections/sessions. | |
unsigned int | GetOpenedConnectionsCount () const |
Return the current number of opened connections/sessions. | |
unsigned int | GetMinSize () const |
Return the minimum number of connections/sessions that can be opened to the database. | |
unsigned int | GetMaxSize () const |
Return the maximum number of connections/sessions that can be opened to the database. | |
unsigned int | GetIncrement () const |
Return the increment for connections/sessions to be opened to the database when the pool is not full. | |
unsigned int | GetStatementCacheSize () const |
Return the maximum number of statements to keep in the pool's statement cache. | |
void | SetStatementCacheSize (unsigned int value) |
Set the maximum number of statements to keep in the pool's statement cache. | |
A connection or session Pool.
This class wraps the OCILIB object handle OCI_Pool and its related methods
|
inline |
Constructor that creates an underlying pool with the given information.
db | - Oracle Service Name |
user | - Oracle User name |
pwd | - Oracle User password |
poolType | - Type of pool |
sessionFlags | - session Flags |
minSize | - minimum number of connections/sessions that can be opened. |
maxSize | - maximum number of connections/sessions that can be opened. |
increment | - next increment for connections/sessions to be opened |
Definition at line 37 of file Pool.hpp.
References Open().
|
inline |
Create an Oracle pool of connections or sessions.
db | - Oracle Service Name |
user | - Oracle User name |
pwd | - Oracle User password |
poolType | - Type of pool |
sessionFlags | - session Flags |
minSize | - minimum number of connections/sessions that can be opened. |
maxSize | - maximum number of connections/sessions that can be opened. |
increment | - next increment for connections/sessions to be opened |
Definition at line 43 of file Pool.hpp.
References ocilib::core::Check(), and OCI_PoolCreate().
Referenced by Pool().
|
inline |
|
inline |
Get a connection from the pool.
sessionTag | - Session user tag string |
Session pools have a nice feature called 'session tagging' It's possible to tag a session with a string identifier when the session is returned to the pool, it keeps its tags. When requesting a connection from the session pool, it's possible to request a session that has the given 'tag' parameter If one exists, it is returned. If not and if an untagged session is available, it is then returned. So check the connection tag property with OCI_GetSessionTag() to find out if the returned connection is tagged or not.
This features is described in the OCI developer guide as the following :
"The tags provide a way for users to customize sessions in the pool. A client may get a default or untagged session from a pool, set certain attributes on the session (such as NLS settings), and return the session to the pool, labeling it with an appropriate tag. The user may request a session with the same tags in order to have a session with the same attributes"
Definition at line 63 of file Pool.hpp.
References ocilib::core::Check(), and OCI_PoolGetConnection().
|
inline |
Get the idle timeout for connections/sessions in the pool.
Definition at line 68 of file Pool.hpp.
References ocilib::core::Check(), and OCI_PoolGetTimeout().
|
inline |
Set the connections/sessions idle timeout.
value | - Timeout value |
Definition at line 73 of file Pool.hpp.
References ocilib::core::Check(), and OCI_PoolSetTimeout().
|
inline |
Get the waiting mode used when no more connections/sessions are available from the pool.
Definition at line 78 of file Pool.hpp.
References ocilib::core::Check(), and OCI_PoolGetNoWait().
|
inline |
Set the waiting mode used when no more connections/sessions are available from the pool.
value | - wait for object |
Definition at line 83 of file Pool.hpp.
References ocilib::core::Check(), and OCI_PoolSetNoWait().
|
inline |
Return the current number of busy connections/sessions.
Definition at line 88 of file Pool.hpp.
References ocilib::core::Check(), and OCI_PoolGetBusyCount().
|
inline |
Return the current number of opened connections/sessions.
Definition at line 93 of file Pool.hpp.
References ocilib::core::Check(), and OCI_PoolGetOpenedCount().
|
inline |
Return the minimum number of connections/sessions that can be opened to the database.
Definition at line 98 of file Pool.hpp.
References ocilib::core::Check(), and OCI_PoolGetMin().
|
inline |
Return the maximum number of connections/sessions that can be opened to the database.
Definition at line 103 of file Pool.hpp.
References ocilib::core::Check(), and OCI_PoolGetMax().
|
inline |
Return the increment for connections/sessions to be opened to the database when the pool is not full.
Definition at line 108 of file Pool.hpp.
References ocilib::core::Check(), and OCI_PoolGetIncrement().
|
inline |
Return the maximum number of statements to keep in the pool's statement cache.
Definition at line 113 of file Pool.hpp.
References ocilib::core::Check(), and OCI_PoolGetStatementCacheSize().
|
inline |
Set the maximum number of statements to keep in the pool's statement cache.
value | - maximum number of statements in the cache |
Definition at line 118 of file Pool.hpp.
References ocilib::core::Check(), and OCI_PoolSetStatementCacheSize().