MySQL 9.1.0
Source Code Documentation
Connection Class Reference

Connection class. More...

#include <common.h>

Public Member Functions

 Connection (MYSQL_PLUGIN_VIO *vio)
 Connection class. More...
 
int write (const Blob &)
 Write data to the connection. More...
 
Blob read ()
 Read data from connection. More...
 
int error () const
 

Private Attributes

MYSQL_PLUGIN_VIOm_vio
 Pointer to MYSQL_PLUGIN_VIO structure. More...
 
int m_error
 If non-zero, indicates that connection is broken. More...
 

Detailed Description

Connection class.

Convenience wrapper around MYSQL_PLUGIN_VIO object providing basic read/write operations.

Constructor & Destructor Documentation

◆ Connection()

Connection::Connection ( MYSQL_PLUGIN_VIO vio)
explicit

Connection class.

Create connection out of an active MYSQL_PLUGIN_VIO object.

Parameters
[in]viopointer to a MYSQL_PLUGIN_VIO object used for connection - it can not be nullptr

Member Function Documentation

◆ error()

int Connection::error ( ) const
inline

◆ read()

Blob Connection::read ( )

Read data from connection.

Returns
A Blob containing read packet or null Blob in case of error.
Note
In case of error, VIO error code is stored in the connection object and can be obtained with error() method.

◆ write()

int Connection::write ( const Blob blob)

Write data to the connection.

Parameters
[in]blobdata to be written
Returns
0 on success, VIO error code on failure.
Note
In case of error, VIO error code is stored in the connection object and can be obtained with error() method.

Member Data Documentation

◆ m_error

int Connection::m_error
private

If non-zero, indicates that connection is broken.

If this has happened because of failed operation, stores non-zero error code from that failure.

◆ m_vio

MYSQL_PLUGIN_VIO* Connection::m_vio
private

Pointer to MYSQL_PLUGIN_VIO structure.


The documentation for this class was generated from the following files: