...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
A connection to a MySQL server.
Defined in header <boost/mysql/any_connection.hpp>
class any_connection;
Name |
Description |
---|---|
The executor type associated to this object. |
Name |
Description |
---|---|
any_connection [constructor] |
Constructs a connection object from an executor and an optional
set of parameters. |
Cleanly closes the connection to the server. |
|
Closes a statement, deallocating it from the server. |
|
Establishes a connection to a MySQL server. |
|
Executes a text query or prepared statement. |
|
Checks whether the server is alive. |
|
Prepares a statement server-side. |
|
Reads metadata for subsequent resultsets in a multi-resultset operation. |
|
Reads a batch of rows. |
|
Resets server-side session state, like variables and prepared statements. |
|
Runs a set of pipelined requests. |
|
Sets the connection's character set, as per SET NAMES. |
|
Starts a SQL execution as a multi-function operation. |
|
Returns whether backslashes are being treated as escape sequences. |
|
Cleanly closes the connection to the server. |
|
Closes a statement, deallocating it from the server. |
|
Establishes a connection to a MySQL server. |
|
Returns the character set used by this connection. |
|
Executes a text query or prepared statement. |
|
Returns format options suitable to format SQL according to the current connection configuation. |
|
Retrieves the executor associated to this object. |
|
Returns the current metadata mode that this connection is using. |
|
Move assignment. |
|
Checks whether the server is alive. |
|
Prepares a statement server-side. |
|
Reads metadata for subsequent resultsets in a multi-resultset operation. |
|
Reads a batch of rows. |
|
Resets server-side session state, like variables and prepared statements. |
|
Runs a set of pipelined requests. |
|
Sets the connection's character set, as per SET NAMES. |
|
Sets the metadata mode. |
|
Starts a SQL execution as a multi-function operation. |
|
Returns whether the connection negotiated the use of SSL or not. |
|
~any_connection [destructor] |
Destructor. |
Represents a connection to a MySQL server. This is the main I/O object that this library implements. It's logically comprised of session state and an internal stream (usually a socket). The stream is not directly accessible. It's constructed using the executor passed to the constructor.
This class supports establishing connections with servers using TCP, TCP over TLS and UNIX sockets.
The class is named any_connection
because it's not templated on a Stream
type, as opposed to connection
. New code should prefer
using any_connection
whenever
possible.
Compared to connection
, this class:
connect
and async_connect
handle hostname
resolution.
asio::any_io_executor
.
This is a move-only type.
The default completion token for all async operations in this class is with_diagnostics(asio::deferred)
,
which allows you to use co_await
and have the expected exceptions thrown on error.
Distinct objects: safe.
Shared objects: unsafe.
This class is not thread-safe: for a single object, if you call its member functions concurrently from separate threads, you will get a race condition.
Convenience header <boost/mysql.hpp>