Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

PrevUpHomeNext

pooled_connection

(EXPERIMENTAL) A proxy to a connection owned by a pool that returns it to the pool when destroyed.

Synopsis

Defined in header <boost/mysql/connection_pool.hpp>

class pooled_connection
Member Functions

Name

Description

get

Retrieves the connection owned by this object.

Retrieves the connection owned by this object.

operator=

Move assignment.

operator->

Retrieves the connection owned by this object.

pooled_connection [constructor]

Constructs an invalid pooled connection.

Move constructor.

return_without_reset

Returns the owned connection to the pool and marks it as not requiring reset.

valid

Returns whether the object owns a connection or not.

~pooled_connection [destructor]

Destructor.

Description

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.

Object lifetimes

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.

Thread safety

By default, individual connections created by the pool are not thread-safe, even if the pool was created using pool_executor_params::thread_safe.

Distinct objects: safe.

Shared objects: unsafe.

Experimental

This part of the API is experimental, and may change in successive releases without previous notice.


PrevUpHomeNext