MySQL 8.0.32
Source Code Documentation
Mysql::Tools::Base::Options::Mysql_connection_options Class Reference

Options provider providing options to specify connection to MySQL server. More...

#include <mysql_connection_options.h>

Inheritance diagram for Mysql::Tools::Base::Options::Mysql_connection_options:
[legend]

Classes

class  Ssl_options
 Options provider enclosing options related to SSL settings of connection to MySQL server. More...
 

Public Member Functions

 Mysql_connection_options (Abstract_program *program)
 Constructs new MySQL server connection options provider. More...
 
void create_options () override
 Creates all options that will be provided. More...
 
MYSQLcreate_connection () override
 Provides new connection to MySQL database server based on option values. More...
 
CHARSET_INFOget_current_charset () const
 Retrieves charset that will be used in new MySQL connections. More...
 
void set_current_charset (CHARSET_INFO *charset)
 Sets charset that will be used in new MySQL connections. More...
 
- Public Member Functions inherited from Mysql::Tools::Base::Options::Composite_options_provider
void add_providers (I_options_provider *first,...)
 Adds new providers to list. More...
 
void add_provider (I_options_provider *options_provider)
 Adds new provider to list. More...
 
void options_parsed () override
 This callback is to be called after all options were parsed. More...
 
std::vector< my_optiongenerate_options () override
 Aggregates all options from itsself and all contained providers. More...
 
- Public Member Functions inherited from Mysql::Tools::Base::Options::Abstract_options_provider
Simple_optioncreate_new_option (std::string name, std::string description)
 Creates and attach new simple option. More...
 
Disabled_optioncreate_new_disabled_option (std::string name, std::string description)
 Creates and attach new disabled option. More...
 
Char_array_optioncreate_new_option (char **value, std::string name, std::string description)
 Creates and attach new string option stored in char* type object. More...
 
Password_optioncreate_new_password_option (std::optional< std::string > *value, std::string name, std::string description)
 Creates and attach new password option. More...
 
String_optioncreate_new_option (std::optional< std::string > *value, std::string name, std::string description)
 Creates and attach new string option. More...
 
Number_option< int32 > * create_new_option (int32 *value, std::string name, std::string description)
 Creates and attach new 32-bit signed number option. More...
 
Number_option< uint32 > * create_new_option (uint32 *value, std::string name, std::string description)
 Creates and attach new 32-bit unsigned number option. More...
 
Number_option< int64 > * create_new_option (int64 *value, std::string name, std::string description)
 Creates and attach new 64-bit signed number option. More...
 
Number_option< uint64 > * create_new_option (uint64 *value, std::string name, std::string description)
 Creates and attach new 64-bit unsigned number option. More...
 
Number_option< double > * create_new_option (double *value, std::string name, std::string description)
 Creates and attach new floating-point number option. More...
 
Bool_optioncreate_new_option (bool *value, std::string name, std::string description)
 Creates and attach new boolean option with value received from argument. More...
 
template<typename T_type , typename T_typelib >
Enum_option< T_type, T_typelib > * create_new_enum_option (T_type *value, const T_typelib *type, std::string name, std::string description)
 
- Public Member Functions inherited from Mysql::Tools::Base::Options::I_option_changed_listener
virtual ~I_option_changed_listener ()=default
 

Private Member Functions

const char * get_null_or_string (std::optional< std::string > &maybeString)
 Returns pointer to constant array containing specified string or NULL value if string has length 0. More...
 
void db_error (MYSQL *connection, const char *when)
 Prints database connection error and exits program. More...
 
void protocol_callback (char *not_used)
 
- Private Member Functions inherited from Mysql::Tools::Base::I_connection_factory
virtual ~I_connection_factory ()=default
 

Private Attributes

Ssl_options m_ssl_options_provider
 
Abstract_programm_program
 
std::optional< std::string > m_protocol_string
 
uint32 m_protocol
 
std::optional< std::string > m_bind_addr
 
std::optional< std::string > m_host
 
uint32 m_mysql_port
 
std::optional< std::string > m_mysql_unix_port
 
std::optional< std::string > m_default_auth
 
std::optional< std::string > m_plugin_dir
 
uint32 m_net_buffer_length
 
uint32 m_max_allowed_packet
 
bool m_compress
 
std::optional< std::string > m_user
 
std::optional< std::string > m_password [3]
 
std::optional< std::string > m_default_charset
 
std::optional< std::string > m_server_public_key
 
bool m_get_server_public_key
 
uint m_zstd_compress_level
 
std::optional< std::string > m_compress_algorithm
 

Static Private Attributes

static bool mysql_inited
 

Additional Inherited Members

- Protected Member Functions inherited from Mysql::Tools::Base::Options::Abstract_options_provider
 Abstract_options_provider ()
 
 ~Abstract_options_provider () override
 
void set_option_changed_listener (I_option_changed_listener *listener) override
 Sets optional option changes listener to which all changes in all options contained in this provider should be reported. More...
 

Detailed Description

Options provider providing options to specify connection to MySQL server.

Constructor & Destructor Documentation

◆ Mysql_connection_options()

Mysql_connection_options::Mysql_connection_options ( Abstract_program program)
explicit

Constructs new MySQL server connection options provider.

Calling this function from multiple threads simultaneously is not thread safe.

Parameters
programPointer to main program class.

Member Function Documentation

◆ create_connection()

MYSQL * Mysql_connection_options::create_connection ( )
overridevirtual

Provides new connection to MySQL database server based on option values.

Implementation of I_connection_factory interface.

Implements Mysql::Tools::Base::I_connection_factory.

◆ create_options()

void Mysql_connection_options::create_options ( )
overridevirtual

Creates all options that will be provided.

Implementation of Abstract_options_provider virtual method.

Implements Mysql::Tools::Base::Options::Abstract_options_provider.

◆ db_error()

void Mysql_connection_options::db_error ( MYSQL connection,
const char *  when 
)
private

Prints database connection error and exits program.

◆ get_current_charset()

CHARSET_INFO * Mysql_connection_options::get_current_charset ( ) const

Retrieves charset that will be used in new MySQL connections.

. Can be NULL if none was set explicitly.

◆ get_null_or_string()

const char * Mysql_connection_options::get_null_or_string ( std::optional< std::string > &  maybeString)
private

Returns pointer to constant array containing specified string or NULL value if string has length 0.

◆ protocol_callback()

void Mysql_connection_options::protocol_callback ( char *  not_used)
private

◆ set_current_charset()

void Mysql_connection_options::set_current_charset ( CHARSET_INFO charset)

Sets charset that will be used in new MySQL connections.

Member Data Documentation

◆ m_bind_addr

std::optional<std::string> Mysql::Tools::Base::Options::Mysql_connection_options::m_bind_addr
private

◆ m_compress

bool Mysql::Tools::Base::Options::Mysql_connection_options::m_compress
private

◆ m_compress_algorithm

std::optional<std::string> Mysql::Tools::Base::Options::Mysql_connection_options::m_compress_algorithm
private

◆ m_default_auth

std::optional<std::string> Mysql::Tools::Base::Options::Mysql_connection_options::m_default_auth
private

◆ m_default_charset

std::optional<std::string> Mysql::Tools::Base::Options::Mysql_connection_options::m_default_charset
private

◆ m_get_server_public_key

bool Mysql::Tools::Base::Options::Mysql_connection_options::m_get_server_public_key
private

◆ m_host

std::optional<std::string> Mysql::Tools::Base::Options::Mysql_connection_options::m_host
private

◆ m_max_allowed_packet

uint32 Mysql::Tools::Base::Options::Mysql_connection_options::m_max_allowed_packet
private

◆ m_mysql_port

uint32 Mysql::Tools::Base::Options::Mysql_connection_options::m_mysql_port
private

◆ m_mysql_unix_port

std::optional<std::string> Mysql::Tools::Base::Options::Mysql_connection_options::m_mysql_unix_port
private

◆ m_net_buffer_length

uint32 Mysql::Tools::Base::Options::Mysql_connection_options::m_net_buffer_length
private

◆ m_password

std::optional<std::string> Mysql::Tools::Base::Options::Mysql_connection_options::m_password[3]
private

◆ m_plugin_dir

std::optional<std::string> Mysql::Tools::Base::Options::Mysql_connection_options::m_plugin_dir
private

◆ m_program

Abstract_program* Mysql::Tools::Base::Options::Mysql_connection_options::m_program
private

◆ m_protocol

uint32 Mysql::Tools::Base::Options::Mysql_connection_options::m_protocol
private

◆ m_protocol_string

std::optional<std::string> Mysql::Tools::Base::Options::Mysql_connection_options::m_protocol_string
private

◆ m_server_public_key

std::optional<std::string> Mysql::Tools::Base::Options::Mysql_connection_options::m_server_public_key
private

◆ m_ssl_options_provider

Ssl_options Mysql::Tools::Base::Options::Mysql_connection_options::m_ssl_options_provider
private

◆ m_user

std::optional<std::string> Mysql::Tools::Base::Options::Mysql_connection_options::m_user
private

◆ m_zstd_compress_level

uint Mysql::Tools::Base::Options::Mysql_connection_options::m_zstd_compress_level
private

◆ mysql_inited

bool Mysql_connection_options::mysql_inited
staticprivate

The documentation for this class was generated from the following files: