Lightweight 0.20260921.0
Loading...
Searching...
No Matches
Lightweight::SqlConnectionDataSource Struct Reference

#include <SqlConnectInfo.hpp>

Public Member Functions

LIGHTWEIGHT_API SqlConnectionString ToConnectionString () const
 
auto operator<=> (SqlConnectionDataSource const &) const noexcept=default
 Three-way comparison operator.
 

Static Public Member Functions

static LIGHTWEIGHT_API SqlConnectionDataSource FromConnectionString (SqlConnectionString const &value)
 Constructs a SqlConnectionDataSource from the given connection string.
 

Public Attributes

std::string datasource
 The ODBC data source name (DSN).
 
std::string username
 The username for authentication.
 
std::string password
 The password for authentication.
 
std::chrono::seconds timeout { 5 }
 The connection timeout duration.
 
std::size_t defaultPrefetchDepth = PrefetchDepthDefault
 Default block-prefetch depth applied to statements created on the resulting connection (rows requested per SQLFetchScroll round-trip on the transparent per-row fetch path).
 
SqlEncryptionMode encryption = SqlEncryptionMode::DriverDefault
 Whether to request a TLS-encrypted connection.
 
std::size_t preparedStatementCacheCapacity = PreparedStatementCacheCapacityDefault
 Capacity of the prepared-statement cache on the resulting connection: how many already-prepared ODBC statement handles are kept alive so that re-preparing the same SQL text re-executes one instead of paying the server-side parse again.
 

Detailed Description

Represents a connection data source as a DSN, username, password, and timeout.

Definition at line 127 of file SqlConnectInfo.hpp.

Member Function Documentation

◆ ToConnectionString()

LIGHTWEIGHT_API SqlConnectionString Lightweight::SqlConnectionDataSource::ToConnectionString ( ) const
inline

Converts this data source to an ODBC connection string.

The Encrypt= keyword is emitted only when encryption is not SqlEncryptionMode::DriverDefault, so the rendering of a data source that did not opt in is byte-for-byte what it always was.

Definition at line 168 of file SqlConnectInfo.hpp.

References Lightweight::SqlConnectionString::value.

Member Data Documentation

◆ datasource

std::string Lightweight::SqlConnectionDataSource::datasource

The ODBC data source name (DSN).

Definition at line 130 of file SqlConnectInfo.hpp.

◆ username

std::string Lightweight::SqlConnectionDataSource::username

The username for authentication.

Definition at line 132 of file SqlConnectInfo.hpp.

◆ password

std::string Lightweight::SqlConnectionDataSource::password

The password for authentication.

Definition at line 134 of file SqlConnectInfo.hpp.

◆ timeout

std::chrono::seconds Lightweight::SqlConnectionDataSource::timeout { 5 }

The connection timeout duration.

Definition at line 136 of file SqlConnectInfo.hpp.

◆ defaultPrefetchDepth

std::size_t Lightweight::SqlConnectionDataSource::defaultPrefetchDepth = PrefetchDepthDefault

Default block-prefetch depth applied to statements created on the resulting connection (rows requested per SQLFetchScroll round-trip on the transparent per-row fetch path).

A value <= 1 disables prefetch (every classic loop keeps issuing one SQLFetch per row). Defaults to PrefetchDepthDefault. Has effect only on backends whose driver supports native row-array fetching (see SqlConnection::SupportsNativeRowArrayFetch).

Definition at line 143 of file SqlConnectInfo.hpp.

◆ encryption

SqlEncryptionMode Lightweight::SqlConnectionDataSource::encryption = SqlEncryptionMode::DriverDefault

Whether to request a TLS-encrypted connection.

Defaults to SqlEncryptionMode::DriverDefault, which leaves the driver's own configuration in charge. Any other value is applied to the connection handle before connecting, and a driver that rejects it fails the connection rather than silently downgrading to plaintext.

Definition at line 150 of file SqlConnectInfo.hpp.

◆ preparedStatementCacheCapacity

std::size_t Lightweight::SqlConnectionDataSource::preparedStatementCacheCapacity = PreparedStatementCacheCapacityDefault

Capacity of the prepared-statement cache on the resulting connection: how many already-prepared ODBC statement handles are kept alive so that re-preparing the same SQL text re-executes one instead of paying the server-side parse again.

Defaults to PreparedStatementCacheCapacityDefault (zero, i.e. disabled). See SqlConnection::SetPreparedStatementCacheCapacity for the implications of enabling it.

Definition at line 158 of file SqlConnectInfo.hpp.


The documentation for this struct was generated from the following file: