MySQL Connector/C++ 9.1.0
MySQL connector library for C and C++ applications
|
ClientSettings are used to construct Client objects. More...
Public Member Functions | |
ClientSettings (const string &uri) | |
Create client settings from a connection string. More... | |
ClientSettings (const string &uri, ClientSettings &opts) | |
Create client settings from a connection string and a ClientSettings object. More... | |
ClientSettings (const string &uri, const DbDoc &options) | |
Create client settings from a connection string and. More... | |
ClientSettings (const string &uri, const char *options) | |
Create client settings from a connection string and. More... | |
template<typename... R> | |
ClientSettings (const string &uri, mysqlx::ClientOption opt, R... rest) | |
Create client settings from a connection string and client settings as a list of client options. More... | |
Value | find (mysqlx::ClientOption opt) |
Find the specified option opt and returns its Value. More... | |
template<typename OPT , typename... R> | |
void | set (OPT opt, R &&... rest) |
Set client and session options. More... | |
void | clear () |
Clear all settings specified so far. | |
void | erase (mysqlx::ClientOption opt) |
Remove the given option opt . | |
bool | has_option (ClientOption::Enum opt) |
Check if option opt was defined. | |
bool | has_option (SessionOption::Enum opt) |
Check if option opt was defined. | |
ClientSettings are used to construct Client objects.
It can be constructed using a connection string plus a JSON with client options, or by setting each ClientOption and SessionOption with its correspondant value.
|
inline |
Create client settings from a connection string.
|
inline |
Create client settings from a connection string and a ClientSettings object.
|
inline |
Create client settings from a connection string and.
Client options are expressed in JSON format. Here is an example:
All options are defined under a document with key vale "pooling". Inside the document, the available options are these:
enabled
: boolean value that enable or disable connection pooling. If disabled, session created from pool are the same as created directly without client handle. Enabled by default.maxSize
: integer that defines the max pooling sessions possible. If uses tries to get session from pool when maximum sessions are used, it will wait for an available session untill queueTimeout
. Defaults to 25.queueTimeout
: integer value that defines the time, in milliseconds, that client will wait to get an available session. By default it doesn't timeouts.maxIdleTime
: integer value that defines the time, in milliseconds, that an available session will wait in the pool before it is removed. By default it doesn't cleans sessions.
|
inline |
Create client settings from a connection string and.
Client options are expressed in JSON format. Here is an example:
All options are defined under a document with key vale "pooling". Inside the document, the available options are these:
enabled
: boolean value that enable or disable connection pooling. If disabled, session created from pool are the same as created directly without client handle. Enabled by default.maxSize
: integer that defines the max pooling sessions possible. If uses tries to get session from pool when maximum sessions are used, it will wait for an available session untill queueTimeout
. Defaults to 25.queueTimeout
: integer value that defines the time, in milliseconds, that client will wait to get an available session. By default it doesn't timeouts.maxIdleTime
: integer value that defines the time, in milliseconds, that an available session will wait in the pool before it is removed. By default it doesn't cleans sessions.
|
inline |
Create client settings from a connection string and client settings as a list of client options.
The list of options consist of a ClientOption constant, identifying the option to set, followed by the value of the option.
Example:
ClientOption::POOL_QUEUE_TIMEOUT and ClientOption::POOL_MAX_IDLE_TIME can be specified using std::chrono::duration objects, or by integer values, with the latest to be specified in milliseconds.
|
inline |
|
inline |
Set client and session options.
Accepts a list of one or more ClientOption
or SessionOption
constants, each followed by the option value. Options specified here are added to the current settings.
Repeated HOST
, PORT
, SOCKET
and PRIORITY
options build a list of hosts to be used by the fail-over logic. For other options, if they are set again, the new value overrides the previous setting.
HOST
, PORT
and PRIORITY
options to specify a single host, all have to be specified in the same set()
call.