![]() |
Home | Libraries | People | FAQ | More |
A proxy to a connection owned by a pool that returns it to the pool when destroyed.
Defined in header <boost/mysql/connection_pool.hpp>
class pooled_connection;
|
Name |
Description |
|---|---|
|
Retrieves the connection owned by this object. |
|
|
Retrieves the connection owned by this object. |
|
|
Move assignment. |
|
|
pooled_connection [constructor] |
Constructs an invalid pooled connection. |
|
Returns the owned connection to the pool and marks it as not requiring reset. |
|
|
Returns whether the object owns a connection or not. |
|
|
~pooled_connection [destructor] |
Destructor. |
A pooled_connection behaves
like to a std::unique_ptr: it has exclusive ownership
of an any_connection created by the pool.
When destroyed, it returns the connection to the pool. A pooled_connection
may own nothing. We say such a connection is invalid (this->valid() == false).
This class is movable but not copyable.
While *this
is alive, the connection_pool internal data will
be kept alive automatically. It's safe to destroy the connection_pool
object before *this.
This object and the any_connection object it may point
to are not thread safe, even if the connection
pool used to obtain them was constructed with pool_params::thread_safe set to true.
Functions that return the underlying connection to the pool cause a mutation
on the pool state object. Calling such functions on objects obtained from
the same pool is thread-safe only if the pool was constructed with pool_params::thread_safe
set to true.
In other words, individual connections can't be shared between threads. Pools
can be shared only if they're constructed with pool_params::thread_safe set to true.
connection_pool that was used
to obtain the objects was created with pool_params::thread_safe set to true. Otherwise,
unsafe.
Convenience header <boost/mysql.hpp>