MySQL 8.4.2
Source Code Documentation
Sql_service_context Class Reference

#include <sql_service_context.h>

Inheritance diagram for Sql_service_context:
[legend]

Public Member Functions

 Sql_service_context (Sql_resultset *rset)
 
 ~Sql_service_context () override=default
 
int start_result_metadata (uint num_cols, uint flags, const CHARSET_INFO *resultcs) override
 Getting metadata. More...
 
int field_metadata (struct st_send_field *field, const CHARSET_INFO *charset) override
 Field metadata is provided via this callback. More...
 
int end_result_metadata (uint server_status, uint warn_count) override
 Indicates end of metadata for the result set. More...
 
int start_row () override
 Indicates the beginning of a new row in the result set/metadata. More...
 
int end_row () override
 Indicates end of the row in the result set/metadata. More...
 
void abort_row () override
 An error occurred during execution. More...
 
ulong get_client_capabilities () override
 Return client's capabilities (see mysql_com.h, CLIENT_*) More...
 
int get_null () override
 Getting data. More...
 
int get_integer (longlong value) override
 Get TINY/SHORT/LONG value from server. More...
 
int get_longlong (longlong value, uint is_unsigned) override
 Get LONGLONG value from server. More...
 
int get_decimal (const decimal_t *value) override
 Receive DECIMAL value from server. More...
 
int get_double (double value, uint32 decimals) override
 Receive DOUBLE value from server. More...
 
int get_date (const MYSQL_TIME *value) override
 Get DATE value from server. More...
 
int get_time (const MYSQL_TIME *value, uint decimals) override
 Get TIME value from server. More...
 
int get_datetime (const MYSQL_TIME *value, uint decimals) override
 Get DATETIME value from server. More...
 
int get_string (const char *const value, size_t length, const CHARSET_INFO *const valuecs) override
 Get STRING value from server. More...
 
void handle_ok (uint server_status, uint statement_warn_count, ulonglong affected_rows, ulonglong last_insert_id, const char *const message) override
 Getting execution status. More...
 
void handle_error (uint sql_errno, const char *const err_msg, const char *const sqlstate) override
 Command ended with ERROR. More...
 
void shutdown (int flag) override
 Session was shutdown while command was running. More...
 
bool connection_alive () override
 Check if the connection is still alive. More...
 
- Public Member Functions inherited from Sql_service_context_base
 Sql_service_context_base ()=default
 Sql_service_context_base constructor resets all variables. More...
 
virtual ~Sql_service_context_base ()=default
 

Private Attributes

Sql_resultsetresultset
 

Additional Inherited Members

- Static Public Attributes inherited from Sql_service_context_base
static const st_command_service_cbs sql_service_callbacks
 The sql service callbacks that will call the below virtual methods. More...
 

Constructor & Destructor Documentation

◆ Sql_service_context()

Sql_service_context::Sql_service_context ( Sql_resultset rset)
inline

◆ ~Sql_service_context()

Sql_service_context::~Sql_service_context ( )
overridedefault

Member Function Documentation

◆ abort_row()

void Sql_service_context::abort_row ( )
overridevirtual

An error occurred during execution.

This callback indicates that an error occurreded during command execution and the partial row should be dropped. Server will raise error and return.

Implements Sql_service_context_base.

◆ connection_alive()

bool Sql_service_context::connection_alive ( )
inlineoverridevirtual

Check if the connection is still alive.

Implements Sql_service_context_base.

◆ end_result_metadata()

int Sql_service_context::end_result_metadata ( uint  server_status,
uint  warn_count 
)
overridevirtual

Indicates end of metadata for the result set.

Parameters
server_statusStatus of server (see mysql_com.h SERVER_STATUS_*)
warn_countNumber of warnings thrown during execution
Return values
1Error
0OK

Implements Sql_service_context_base.

◆ end_row()

int Sql_service_context::end_row ( )
overridevirtual

Indicates end of the row in the result set/metadata.

Return values
1Error
0OK

Implements Sql_service_context_base.

◆ field_metadata()

int Sql_service_context::field_metadata ( struct st_send_field field,
const CHARSET_INFO charset 
)
overridevirtual

Field metadata is provided via this callback.

Parameters
fieldField's metadata (see field.h)
charsetField's charset
Return values
1Error
0OK

Implements Sql_service_context_base.

◆ get_client_capabilities()

ulong Sql_service_context::get_client_capabilities ( )
overridevirtual

Return client's capabilities (see mysql_com.h, CLIENT_*)

Returns
Bitmap of client's capabilities

Implements Sql_service_context_base.

◆ get_date()

int Sql_service_context::get_date ( const MYSQL_TIME value)
overridevirtual

Get DATE value from server.

Parameters
valueValue received
Returns
status
Return values
1Error
0OK

Implements Sql_service_context_base.

◆ get_datetime()

int Sql_service_context::get_datetime ( const MYSQL_TIME value,
uint  decimals 
)
overridevirtual

Get DATETIME value from server.

Parameters
valueValue received
decimalsNumber of decimals
Returns
status
Return values
1Error
0OK

Implements Sql_service_context_base.

◆ get_decimal()

int Sql_service_context::get_decimal ( const decimal_t value)
overridevirtual

Receive DECIMAL value from server.

Parameters
valueValue received
Returns
status
Return values
1Error
0OK

Implements Sql_service_context_base.

◆ get_double()

int Sql_service_context::get_double ( double  value,
uint32  decimals 
)
overridevirtual

Receive DOUBLE value from server.

Returns
status
Return values
1Error
0OK

Implements Sql_service_context_base.

◆ get_integer()

int Sql_service_context::get_integer ( longlong  value)
overridevirtual

Get TINY/SHORT/LONG value from server.

Parameters
valueValue received
Note
In order to know which type exactly was received, the plugin must track the metadata that was sent just prior to the result set.
Returns
status
Return values
1Error
0OK

Implements Sql_service_context_base.

◆ get_longlong()

int Sql_service_context::get_longlong ( longlong  value,
uint  is_unsigned 
)
overridevirtual

Get LONGLONG value from server.

Parameters
valueValue received
is_unsignedTRUE <=> value is unsigned
Returns
status
Return values
1Error
0OK

Implements Sql_service_context_base.

◆ get_null()

int Sql_service_context::get_null ( )
overridevirtual

Getting data.

Receive NULL value from server

Returns
status
Return values
1Error
0OK

Implements Sql_service_context_base.

◆ get_string()

int Sql_service_context::get_string ( const char *const  value,
size_t  length,
const CHARSET_INFO *const  valuecs 
)
overridevirtual

Get STRING value from server.

Parameters
valueValue received
lengthValue's length
valuecsValue's charset
Returns
status
Return values
1Error
0OK

Implements Sql_service_context_base.

◆ get_time()

int Sql_service_context::get_time ( const MYSQL_TIME value,
uint  decimals 
)
overridevirtual

Get TIME value from server.

Parameters
valueValue received
decimalsNumber of decimals
Returns
status
Return values
1Error
0OK

Implements Sql_service_context_base.

◆ handle_error()

void Sql_service_context::handle_error ( uint  sql_errno,
const char *const  err_msg,
const char *const  sqlstate 
)
overridevirtual

Command ended with ERROR.

Parameters
sql_errnoError code
err_msgError message
sqlstateSQL state correspongin to the error code

Implements Sql_service_context_base.

◆ handle_ok()

void Sql_service_context::handle_ok ( uint  server_status,
uint  statement_warn_count,
ulonglong  affected_rows,
ulonglong  last_insert_id,
const char *const  message 
)
overridevirtual

Getting execution status.

Command ended with success

Parameters
server_statusStatus of server (see mysql_com.h, SERVER_STATUS_*)
statement_warn_countNumber of warnings thrown during execution
affected_rowsNumber of rows affected by the command
last_insert_idLast insert id being assigned during execution
messageA message from server

Implements Sql_service_context_base.

◆ shutdown()

void Sql_service_context::shutdown ( int  flag)
overridevirtual

Session was shutdown while command was running.

Implements Sql_service_context_base.

◆ start_result_metadata()

int Sql_service_context::start_result_metadata ( uint  num_cols,
uint  flags,
const CHARSET_INFO resultcs 
)
overridevirtual

Getting metadata.

Indicates start of metadata for the result set

Parameters
num_colsNumber of fields being sent
flagsFlags to alter the metadata sending
resultcsCharset of the result set
Return values
1Error
0OK

Implements Sql_service_context_base.

◆ start_row()

int Sql_service_context::start_row ( )
overridevirtual

Indicates the beginning of a new row in the result set/metadata.

Return values
1Error
0OK

Implements Sql_service_context_base.

Member Data Documentation

◆ resultset

Sql_resultset* Sql_service_context::resultset
private

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