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

This is the documentation for an old version of Boost. Click here to view this page for the latest version.
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.

async_close_statement

Closes a statement, deallocating it from the server.

async_connect

Establishes a connection to a MySQL server.

async_execute_statement

Executes a prepared statement.

async_handshake

Performs the MySQL-level handshake.

async_ping

Checks whether the server is alive.

async_prepare_statement

Prepares a statement server-side.

async_query

Executes a SQL text query.

async_quit

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

async_read_some_rows

Reads a batch of rows.

async_start_query

Starts a text query as a multi-function operation.

async_start_statement_execution

Starts a statement execution as a multi-function operation.

close

Closes the connection to the server.

close_statement

Closes a statement, deallocating it from the server.

connect

Establishes a connection to a MySQL server.

connection [constructor]

Initializing constructor.

Initializing constructor with buffer params.

Move constructor.

execute_statement

Executes a prepared statement.

get_executor

Retrieves the executor associated to this object.

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.

prepare_statement

Prepares a statement server-side.

query

Executes a SQL text query.

quit

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

read_some_rows

Reads a batch of rows.

set_meta_mode

Sets the metadata mode.

start_query

Starts a text query as a multi-function operation.

start_statement_execution

Starts a statement 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.

Convenience header <boost/mysql.hpp>


PrevUpHomeNext