An asynchronous MySQL client using coroutines and a network Proactor.
More...
#include <MysqlClient.hpp>
An asynchronous MySQL client using coroutines and a network Proactor.
◆ MysqlClient() [1/2]
Constructs a new MysqlClient.
- Parameters
-
| proactor | The network Proactor to use for async events. |
| config | The configuration settings for the MySQL connection. |
◆ ~MysqlClient()
| orbit::database::MysqlClient::~MysqlClient |
( |
| ) |
|
◆ MysqlClient() [2/2]
| orbit::database::MysqlClient::MysqlClient |
( |
const MysqlClient & |
| ) |
|
|
delete |
◆ close()
| void orbit::database::MysqlClient::close |
( |
| ) |
|
Closes the MySQL connection.
◆ connect_async()
Connects to the MySQL database asynchronously.
- Returns
- A ConnectAwaiter that can be co_awaited.
◆ escape()
| std::string orbit::database::MysqlClient::escape |
( |
const std::string & |
value | ) |
|
Escapes value for use inside a single-quoted SQL literal, using the connection's character set (mysql_real_escape_string).
◆ get_mysql()
| MYSQL * orbit::database::MysqlClient::get_mysql |
( |
| ) |
|
|
inline |
Gets the underlying MySQL connection object.
- Returns
- Pointer to the MYSQL object.
◆ get_proactor()
Gets the associated network proactor.
- Returns
- Reference to the network Proactor.
◆ operator=()
◆ query_async()
| QueryAwaiter orbit::database::MysqlClient::query_async |
( |
std::string |
query | ) |
|
Executes a query asynchronously.
- Parameters
-
| query | The SQL query string. |
- Returns
- A QueryAwaiter that can be co_awaited for the result.
auto result = co_await client.query_async("SELECT * FROM users");
◆ wait_for_status()
| void orbit::database::MysqlClient::wait_for_status |
( |
int |
status, |
|
|
std::function< void()> |
callback |
|
) |
| |
|
private |
◆ config_
| Config orbit::database::MysqlClient::config_ |
|
private |
◆ connected_
| bool orbit::database::MysqlClient::connected_ {false} |
|
private |
◆ mysql_
| MYSQL* orbit::database::MysqlClient::mysql_ {nullptr} |
|
private |
◆ proactor_
The documentation for this class was generated from the following file: