OZO 「お象」
Boost.Asio and libpq based asynchronous PostgreSQL unofficial header-only C++17 client library.

Description

Connection related types.

Classes

class  ozo::connection< OidMap, Statistics >
 Default model for Connection concept. More...
 
struct  ozo::is_connection< typename, typename >
 Connection indicator. More...
 
struct  ozo::get_connection_type< ConnectionProvider >
 Connection type getter More...
 
class  ozo::connection_info< OidMap, Statistics >
 Connection source to a single host. More...
 
struct  ozo::connection_pool_config
 Connection pool configuration. More...
 
struct  ozo::connection_pool_timeouts
 [[DEPRECATED]] Timeouts for the ozo::get_connection() operation More...
 
struct  ozo::connection_traits< Rep >
 Connection traits depend on a representation type. More...
 
class  ozo::pooled_connection< Rep, Executor >
 Pool bound model for Connection concept. More...
 
class  ozo::connection_pool< Source, ThreadSafety >
 Connection pool implementation. More...
 
class  ozo::connection_provider< ConnectionSource >
 Default model for the ConnectionProvider concept. More...
 

Types

template<typename T >
using ozo::connection_type = typename get_connection_type< std::decay_t< T > >::type
 The connection object type that ConnectionProvider or ConnectionSource provide. More...
 

Enumerations

enum  ozo::transaction_status
 Transaction status of a Connection More...
 

Types

◆ connection_type

template<typename T >
using ozo::connection_type = typedef typename get_connection_type<std::decay_t<T> >::type

The connection object type that ConnectionProvider or ConnectionSource provide.

This type alias can be used to determine exact type of a connection object which can be obtained from a ConnectionSource or ConnectionProvider. It uses ozo::get_connection_type metafunction to get a Connection type.

Template Parameters
T- ConnectionSource or ConnectionProvider type.

Enumeration Type Documentation

◆ transaction_status

Transaction status of a Connection

Indicates current transaction status of a Connection object. It reflects (but not equal!) libpq PGTransactionStatusType.

Note
In case of developing own connection pool, it must be taking in account what Connection can be reused only with ozo::transaction_status::idle status, in case of the other status the Connection shall be closed rather than collected back into the pool.
Enumerator
unknown 

transaction state is unknown due to bad or invalid connection object, reflects PQTRANS_UNKNOWN

idle 

connection is in idle state and can be reused, reflects QTRANS_IDLE

active 

command execution is in progress, reflects PQTRANS_ACTIVE

transaction 

idle, but within transaction block, reflects PQTRANS_INTRANS

error 

idle, within failed transaction, reflects PQTRANS_INERROR