Mysql client connection wrapper class to connect MySQL, execute SQL query and fetch query results.
More...
#include <rpl_mysql_connect.h>
Mysql client connection wrapper class to connect MySQL, execute SQL query and fetch query results.
◆ Mysql_connection()
Mysql_connection::Mysql_connection |
( |
THD * |
thd, |
|
|
Master_info * |
mi, |
|
|
std::string |
host, |
|
|
uint |
port, |
|
|
std::string |
network_namespace, |
|
|
bool |
is_io_thread = false |
|
) |
| |
Mysql_connection class constructor.
- Parameters
-
[in] | thd | The thread object. |
[in] | mi | the pointer to the Master_info object. |
[in] | host | the host or ip address for mysql client connection. |
[in] | port | the port for mysql client connection. |
[in] | network_namespace | the network_namespace for mysql client connection. |
[in] | is_io_thread | to determine its IO or Monitor IO thread. |
◆ ~Mysql_connection()
Mysql_connection::~Mysql_connection |
( |
| ) |
|
Mysql_connection class destructor.
◆ execute_query()
Execute given sql query on connected mysql server.
- Parameters
-
[in] | query | sql query to execute. |
- Returns
- result of executed query in rows<cols<result>> format where rows and cols both are std::vector and result is std::string. So other then character strings need to be converted.
◆ get_mysql()
MYSQL * Mysql_connection::get_mysql |
( |
| ) |
|
|
inline |
Get Mysql client connection object.
- Returns
- Mysql client connection object.
◆ is_connected()
bool Mysql_connection::is_connected |
( |
| ) |
|
Determine if its connected to mysql server.
- Returns
- true if connected, false otherwise.
◆ reconnect()
bool Mysql_connection::reconnect |
( |
| ) |
|
Re-connect to mysql server.
- Returns
- true if successfully reconnected, false otherwise.
◆ safe_connect()
bool Mysql_connection::safe_connect |
( |
THD * |
thd, |
|
|
Master_info * |
mi, |
|
|
std::string |
host, |
|
|
uint |
port, |
|
|
std::string |
network_namespace |
|
) |
| |
|
private |
To connect to mysql server.
- Parameters
-
[in] | thd | The thread object. |
[in] | mi | the pointer to the Master_info object. |
[in] | host | the host or ip address for mysql client connection. |
[in] | port | the port for mysql client connection. |
[in] | network_namespace | the network_namespace for mysql client connection. |
◆ safe_reconnect()
bool Mysql_connection::safe_reconnect |
( |
THD * |
thd, |
|
|
Master_info * |
mi, |
|
|
bool |
suppress_warnings, |
|
|
std::string |
host, |
|
|
uint |
port |
|
) |
| |
|
private |
To re-connect to mysql server.
- Parameters
-
[in] | thd | The thread object. |
[in] | mi | the pointer to the Master_info object. |
[in] | suppress_warnings | Suppress reconnect warning |
[in] | host | the host or ip address for mysql client connection. |
[in] | port | the port for mysql client connection. |
◆ m_conn
◆ m_connected
bool Mysql_connection::m_connected {false} |
|
private |
◆ m_host
std::string Mysql_connection::m_host |
|
private |
◆ m_init
bool Mysql_connection::m_init {false} |
|
private |
◆ m_is_io_thread
bool Mysql_connection::m_is_io_thread {false} |
|
private |
◆ m_mi
◆ m_network_namespace
std::string Mysql_connection::m_network_namespace |
|
private |
◆ m_port
uint Mysql_connection::m_port {0} |
|
private |
◆ m_thd
The documentation for this class was generated from the following files: