userver: storages::odbc::Cluster Class Reference
Loading...
Searching...
No Matches
storages::odbc::Cluster Class Reference

#include </data/code/userver/odbc/include/userver/storages/odbc/cluster.hpp>

Detailed Description

ODBC cluster client: queries and transactions against pooled DSNs.

Definition at line 37 of file cluster.hpp.

Public Member Functions

 Cluster (const settings::ODBCClusterSettings &settings, clients::dns::Resolver *resolver)
 Cluster (const settings::ODBCClusterSettings &settings, clients::dns::Resolver *resolver, engine::TaskProcessor &blocking_task_processor)
template<typename... Args>
requires ((impl::kIsParameterArgument<Args> && ...))
ResultSet Execute (ClusterHostTypeFlags flags, const Query &query, const Args &... args)
 Execute a statement, binding every argument to an ODBC ? placeholder.
template<typename... Args>
requires ((impl::kIsParameterArgument<Args> && ...))
ResultSet Execute (ClusterHostTypeFlags flags, OptionalCommandControl command_control, const Query &query, const Args &... args)
 Execute a statement with per-operation timeout overrides.
ResultSet Execute (ClusterHostTypeFlags flags, const Query &query, const ParameterStore &store)
 Execute a statement with an owning dynamic parameter list.
ResultSet Execute (ClusterHostTypeFlags flags, OptionalCommandControl command_control, const Query &query, const ParameterStore &store)
 Execute a statement with a dynamic parameter list and timeout overrides.
template<typename... Args>
requires ((impl::kIsParameterArgument<Args> && ...))
Cursor ExecuteCursor (ClusterHostTypeFlags flags, const Query &query, const Args &... args)
 Execute a row-producing statement as an incremental cursor.
template<typename... Args>
requires ((impl::kIsParameterArgument<Args> && ...))
Cursor ExecuteCursor (ClusterHostTypeFlags flags, OptionalCommandControl command_control, const Query &query, const Args &... args)
 Execute an incremental cursor with per-operation timeout overrides. The resolved durations are reused as a fresh budget for every Fetch call.
Cursor ExecuteCursor (ClusterHostTypeFlags flags, const Query &query, const ParameterStore &store)
Cursor ExecuteCursor (ClusterHostTypeFlags flags, OptionalCommandControl command_control, const Query &query, const ParameterStore &store)
BulkResult ExecuteBulk (ClusterHostTypeFlags flags, const Query &query, const BulkParameterStore &rows, std::size_t chunk_rows=kDefaultBulkRows)
BulkResult ExecuteBulk (ClusterHostTypeFlags flags, OptionalCommandControl command_control, const Query &query, const BulkParameterStore &rows, std::size_t chunk_rows=kDefaultBulkRows)
 Execute bulk DML with per-operation timeout overrides.
Transaction Begin (ClusterHostTypeFlags flags)
Transaction Begin (ClusterHostTypeFlags flags, OptionalCommandControl command_control)
Transaction Begin (ClusterHostTypeFlags flags, const TransactionOptions &options)
 Start a transaction with explicit ODBC isolation/access options.
Transaction Begin (ClusterHostTypeFlags flags, const TransactionOptions &options, OptionalCommandControl command_control)
 Start a transaction with explicit options and timeout overrides.
void WriteStatistics (utils::statistics::Writer &writer) const
void SetDefaultCommandControl (const CommandControl &cc)
 Set default command control (timeouts) from dynamic config.
void SetHandlersCommandControl (CommandControlByHandlerMap command_control)
 Atomically replace command controls looked up by the current task-inherited HTTP handler path and method.
void SetQueriesCommandControl (CommandControlByQueryMap command_control)
 Atomically replace command controls looked up by Query name.
void SetStatementMetricsSettings (const settings::StatementMetricsSettings &settings)
 Set the per-pool bound for named query latency and error metrics.
void SetPreparedStatementCacheSettings (const settings::PreparedStatementCacheSettings &settings)
 Set the per-connection prepared statement cache bound.
void UpdateSettings (const settings::ODBCClusterSettings &settings)
 Atomically replace cluster pools for future operations. Existing queries and transactions keep their old pools alive.
std::optional< std::chrono::milliseconds > GetDefaultNetworkTimeout () const
 Get current default network timeout.
std::optional< std::chrono::milliseconds > GetDefaultStatementTimeout () const
 Get current default statement timeout.

Member Function Documentation

◆ Execute() [1/2]

template<typename... Args>
requires ((impl::kIsParameterArgument<Args> && ...))
ResultSet storages::odbc::Cluster::Execute ( ClusterHostTypeFlags flags,
const Query & query,
const Args &... args )
inline

Execute a statement, binding every argument to an ODBC ? placeholder.

Warning
Never interpolate untrusted values into query. Passing them as separate arguments ensures that they are sent to the ODBC driver as data.

Definition at line 54 of file cluster.hpp.

◆ Execute() [2/2]

template<typename... Args>
requires ((impl::kIsParameterArgument<Args> && ...))
ResultSet storages::odbc::Cluster::Execute ( ClusterHostTypeFlags flags,
OptionalCommandControl command_control,
const Query & query,
const Args &... args )
inline

Execute a statement with per-operation timeout overrides.

Definition at line 61 of file cluster.hpp.

◆ ExecuteBulk()

BulkResult storages::odbc::Cluster::ExecuteBulk ( ClusterHostTypeFlags flags,
const Query & query,
const BulkParameterStore & rows,
std::size_t chunk_rows = kDefaultBulkRows )

Execute rows as bounded chunks of DML that must not return result sets. Earlier chunks may remain committed if a later row fails; no executed chunk is retried. Use a Transaction when rollback atomicity is needed.

◆ ExecuteCursor() [1/2]

template<typename... Args>
requires ((impl::kIsParameterArgument<Args> && ...))
Cursor storages::odbc::Cluster::ExecuteCursor ( ClusterHostTypeFlags flags,
const Query & query,
const Args &... args )
inline

Execute a row-producing statement as an incremental cursor.

Warning
The cursor pins a pooled connection until it becomes terminal.

Definition at line 86 of file cluster.hpp.

◆ ExecuteCursor() [2/2]

template<typename... Args>
requires ((impl::kIsParameterArgument<Args> && ...))
Cursor storages::odbc::Cluster::ExecuteCursor ( ClusterHostTypeFlags flags,
OptionalCommandControl command_control,
const Query & query,
const Args &... args )
inline

Execute an incremental cursor with per-operation timeout overrides. The resolved durations are reused as a fresh budget for every Fetch call.

Definition at line 95 of file cluster.hpp.

◆ SetHandlersCommandControl()

void storages::odbc::Cluster::SetHandlersCommandControl ( CommandControlByHandlerMap command_control)

Atomically replace command controls looked up by the current task-inherited HTTP handler path and method.

Each configured field overlays the lower-priority default independently. Passing an empty map clears the complete handler layer.

◆ SetPreparedStatementCacheSettings()

void storages::odbc::Cluster::SetPreparedStatementCacheSettings ( const settings::PreparedStatementCacheSettings & settings)

Set the per-connection prepared statement cache bound.

A zero bound disables and clears the cache. Shrinking evicts the least recently used statements; growing preserves existing entries. Existing physical connections apply changes before their next operation.

◆ SetQueriesCommandControl()

void storages::odbc::Cluster::SetQueriesCommandControl ( CommandControlByQueryMap command_control)

Atomically replace command controls looked up by Query name.

Each configured field overlays default and handler fields independently. Unnamed queries skip this layer. Passing an empty map clears it.

◆ SetStatementMetricsSettings()

void storages::odbc::Cluster::SetStatementMetricsSettings ( const settings::StatementMetricsSettings & settings)

Set the per-pool bound for named query latency and error metrics.

A zero bound disables accounting and clears all retained named query names. Shrinking the bound evicts the least recently used names. Each retained name exports three metric series.


The documentation for this class was generated from the following file:
  • /data/code/userver/odbc/include/userver/storages/odbc/cluster.hpp