Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

PrevUpHomeNext

connection

A connection to a MySQL server.

Synopsis

Defined in header <boost/mysql/connection.hpp>

template<
    class Stream>
class connection
Types

Name

Description

executor_type

The executor type associated to this object.

rebind_executor

Rebinds the connection type to another executor.

stream_type

The Stream type this connection is using.

Member Functions

Name

Description

async_close

Closes the connection to the server.

Closes the connection to the server.

async_close_statement

Closes a statement, deallocating it from the server.

Closes a statement, deallocating it from the server.

async_connect

Establishes a connection to a MySQL server.

Establishes a connection to a MySQL server.

async_execute

Executes a text query or prepared statement.

Executes a text query or prepared statement.

async_handshake

Performs the MySQL-level handshake.

Performs the MySQL-level handshake.

async_ping

Checks whether the server is alive.

Checks whether the server is alive.

async_prepare_statement

Prepares a statement server-side.

Prepares a statement server-side.

async_quit

Notifies the MySQL server that the client wants to end the session and shutdowns SSL.

Notifies the MySQL server that the client wants to end the session and shutdowns SSL.

async_read_resultset_head

Reads metadata for subsequent resultsets in a multi-resultset operation.

Reads metadata for subsequent resultsets in a multi-resultset operation.

async_read_some_rows

Reads a batch of rows.

Reads a batch of rows.

Reads a batch of rows.

async_reset_connection

Resets server-side session state, like variables and prepared statements.

Resets server-side session state, like variables and prepared statements.

async_start_execution

Starts a SQL execution as a multi-function operation.

Starts a SQL execution as a multi-function operation.

close

Closes the connection to the server.

Closes the connection to the server.

close_statement

Closes a statement, deallocating it from the server.

Closes a statement, deallocating it from the server.

connect

Establishes a connection to a MySQL server.

Establishes a connection to a MySQL server.

connection [constructor]

Initializing constructor.

Initializing constructor with buffer params.

Move constructor.

execute

Executes a text query or prepared statement.

Executes a text query or prepared statement.

get_executor

Retrieves the executor associated to this object.

handshake

Performs the MySQL-level handshake.

Performs the MySQL-level handshake.

meta_mode

Returns the current metadata mode that this connection is using.

operator=

Move assignment.

ping

Checks whether the server is alive.

Checks whether the server is alive.

prepare_statement

Prepares a statement server-side.

Prepares a statement server-side.

quit

Notifies the MySQL server that the client wants to end the session and shutdowns SSL.

Notifies the MySQL server that the client wants to end the session and shutdowns SSL.

read_resultset_head

Reads metadata for subsequent resultsets in a multi-resultset operation.

Reads metadata for subsequent resultsets in a multi-resultset operation.

read_some_rows

Reads a batch of rows.

Reads a batch of rows.

reset_connection

Resets server-side session state, like variables and prepared statements.

Resets server-side session state, like variables and prepared statements.

set_meta_mode

Sets the metadata mode.

start_execution

Starts a SQL execution as a multi-function operation.

Starts a SQL execution as a multi-function operation.

stream

Retrieves the underlying Stream object.

uses_ssl

Returns whether the connection negotiated the use of SSL or not.

Description

Represents a connection to a MySQL server.

connectionis the main I/O object that this library implements. It owns a Stream object that is accessed by functions involving network operations, as well as session state. You can access the stream using connection::stream, and its executor via connection::get_executor. The executor used by this object is always the same as the underlying stream.

Thread safety

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.


PrevUpHomeNext