MySQL 8.0.40
Source Code Documentation
Sql_service_context_base Class Referenceabstract

#include <sql_service_context_base.h>

Inheritance diagram for Sql_service_context_base:
[legend]

Public Member Functions

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

Static Public Attributes

static const st_command_service_cbs sql_service_callbacks
 The sql service callbacks that will call the below virtual methods. More...
 

Static Private Member Functions

static int sql_start_result_metadata (void *ctx, uint num_cols, uint flags, const CHARSET_INFO *resultcs)
 
static int sql_field_metadata (void *ctx, struct st_send_field *field, const CHARSET_INFO *charset)
 
static int sql_end_result_metadata (void *ctx, uint server_status, uint warn_count)
 
static int sql_start_row (void *ctx)
 
static int sql_end_row (void *ctx)
 
static void sql_abort_row (void *ctx)
 
static ulong sql_get_client_capabilities (void *ctx)
 
static int sql_get_null (void *ctx)
 
static int sql_get_integer (void *ctx, longlong value)
 
static int sql_get_longlong (void *ctx, longlong value, uint is_unsigned)
 
static int sql_get_decimal (void *ctx, const decimal_t *value)
 
static int sql_get_double (void *ctx, double value, uint32 decimals)
 
static int sql_get_date (void *ctx, const MYSQL_TIME *value)
 
static int sql_get_time (void *ctx, const MYSQL_TIME *value, uint decimals)
 
static int sql_get_datetime (void *ctx, const MYSQL_TIME *value, uint decimals)
 
static int sql_get_string (void *ctx, const char *const value, size_t length, const CHARSET_INFO *const valuecs)
 
static void sql_handle_ok (void *ctx, uint server_status, uint statement_warn_count, ulonglong affected_rows, ulonglong last_insert_id, const char *const message)
 
static void sql_handle_error (void *ctx, uint sql_errno, const char *const err_msg, const char *const sqlstate)
 
static void sql_shutdown (void *ctx, int flag)
 
static bool sql_connection_alive (void *ctx)
 

Constructor & Destructor Documentation

◆ Sql_service_context_base()

Sql_service_context_base::Sql_service_context_base ( )
default

Sql_service_context_base constructor resets all variables.

◆ ~Sql_service_context_base()

virtual Sql_service_context_base::~Sql_service_context_base ( )
virtualdefault

Member Function Documentation

◆ abort_row()

virtual void Sql_service_context_base::abort_row ( )
pure virtual

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.

Implemented in Sql_service_context.

◆ connection_alive()

virtual bool Sql_service_context_base::connection_alive ( )
pure virtual

Check if the connection is still alive.

It should always return true unless the protocol closed the connection.

Implemented in Sql_service_context.

◆ end_result_metadata()

virtual int Sql_service_context_base::end_result_metadata ( uint  server_status,
uint  warn_count 
)
pure virtual

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

Implemented in Sql_service_context.

◆ end_row()

virtual int Sql_service_context_base::end_row ( )
pure virtual

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

Return values
1Error
0OK

Implemented in Sql_service_context.

◆ field_metadata()

virtual int Sql_service_context_base::field_metadata ( struct st_send_field field,
const CHARSET_INFO charset 
)
pure virtual

Field metadata is provided via this callback.

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

Implemented in Sql_service_context.

◆ get_client_capabilities()

virtual ulong Sql_service_context_base::get_client_capabilities ( )
pure virtual

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

Returns
Bitmap of client's capabilities

Implemented in Sql_service_context.

◆ get_date()

virtual int Sql_service_context_base::get_date ( const MYSQL_TIME value)
pure virtual

Get DATE value from server.

Parameters
valueValue received
Returns
status
Return values
1Error
0OK

Implemented in Sql_service_context.

◆ get_datetime()

virtual int Sql_service_context_base::get_datetime ( const MYSQL_TIME value,
uint  decimals 
)
pure virtual

Get DATETIME value from server.

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

Implemented in Sql_service_context.

◆ get_decimal()

virtual int Sql_service_context_base::get_decimal ( const decimal_t value)
pure virtual

Receive DECIMAL value from server.

Parameters
valueValue received
Returns
status
Return values
1Error
0OK

Implemented in Sql_service_context.

◆ get_double()

virtual int Sql_service_context_base::get_double ( double  value,
uint32  decimals 
)
pure virtual
Returns
status
Return values
1Error
0OK

Implemented in Sql_service_context.

◆ get_integer()

virtual int Sql_service_context_base::get_integer ( longlong  value)
pure virtual

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

Implemented in Sql_service_context.

◆ get_longlong()

virtual int Sql_service_context_base::get_longlong ( longlong  value,
uint  is_unsigned 
)
pure virtual

Get LONGLONG value from server.

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

Implemented in Sql_service_context.

◆ get_null()

virtual int Sql_service_context_base::get_null ( )
pure virtual

Getting data.

Receive NULL value from server

Returns
status
Return values
1Error
0OK

Implemented in Sql_service_context.

◆ get_string()

virtual int Sql_service_context_base::get_string ( const char *const  value,
size_t  length,
const CHARSET_INFO *const  valuecs 
)
pure virtual

Get STRING value from server.

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

Implemented in Sql_service_context.

◆ get_time()

virtual int Sql_service_context_base::get_time ( const MYSQL_TIME value,
uint  decimals 
)
pure virtual

Get TIME value from server.

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

Implemented in Sql_service_context.

◆ handle_error()

virtual void Sql_service_context_base::handle_error ( uint  sql_errno,
const char *const  err_msg,
const char *const  sqlstate 
)
pure virtual

Command ended with ERROR.

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

Implemented in Sql_service_context.

◆ handle_ok()

virtual void Sql_service_context_base::handle_ok ( uint  server_status,
uint  statement_warn_count,
ulonglong  affected_rows,
ulonglong  last_insert_id,
const char *const  message 
)
pure virtual

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

Implemented in Sql_service_context.

◆ shutdown()

virtual void Sql_service_context_base::shutdown ( int  flag)
pure virtual

Session was shutdown while command was running.

Implemented in Sql_service_context.

◆ sql_abort_row()

static void Sql_service_context_base::sql_abort_row ( void *  ctx)
inlinestaticprivate

◆ sql_connection_alive()

static bool Sql_service_context_base::sql_connection_alive ( void *  ctx)
inlinestaticprivate

◆ sql_end_result_metadata()

static int Sql_service_context_base::sql_end_result_metadata ( void *  ctx,
uint  server_status,
uint  warn_count 
)
inlinestaticprivate

◆ sql_end_row()

static int Sql_service_context_base::sql_end_row ( void *  ctx)
inlinestaticprivate

◆ sql_field_metadata()

static int Sql_service_context_base::sql_field_metadata ( void *  ctx,
struct st_send_field field,
const CHARSET_INFO charset 
)
inlinestaticprivate

◆ sql_get_client_capabilities()

static ulong Sql_service_context_base::sql_get_client_capabilities ( void *  ctx)
inlinestaticprivate

◆ sql_get_date()

static int Sql_service_context_base::sql_get_date ( void *  ctx,
const MYSQL_TIME value 
)
inlinestaticprivate

◆ sql_get_datetime()

static int Sql_service_context_base::sql_get_datetime ( void *  ctx,
const MYSQL_TIME value,
uint  decimals 
)
inlinestaticprivate

◆ sql_get_decimal()

static int Sql_service_context_base::sql_get_decimal ( void *  ctx,
const decimal_t value 
)
inlinestaticprivate

◆ sql_get_double()

static int Sql_service_context_base::sql_get_double ( void *  ctx,
double  value,
uint32  decimals 
)
inlinestaticprivate

◆ sql_get_integer()

static int Sql_service_context_base::sql_get_integer ( void *  ctx,
longlong  value 
)
inlinestaticprivate

◆ sql_get_longlong()

static int Sql_service_context_base::sql_get_longlong ( void *  ctx,
longlong  value,
uint  is_unsigned 
)
inlinestaticprivate

◆ sql_get_null()

static int Sql_service_context_base::sql_get_null ( void *  ctx)
inlinestaticprivate

◆ sql_get_string()

static int Sql_service_context_base::sql_get_string ( void *  ctx,
const char *const  value,
size_t  length,
const CHARSET_INFO *const  valuecs 
)
inlinestaticprivate

◆ sql_get_time()

static int Sql_service_context_base::sql_get_time ( void *  ctx,
const MYSQL_TIME value,
uint  decimals 
)
inlinestaticprivate

◆ sql_handle_error()

static void Sql_service_context_base::sql_handle_error ( void *  ctx,
uint  sql_errno,
const char *const  err_msg,
const char *const  sqlstate 
)
inlinestaticprivate

◆ sql_handle_ok()

static void Sql_service_context_base::sql_handle_ok ( void *  ctx,
uint  server_status,
uint  statement_warn_count,
ulonglong  affected_rows,
ulonglong  last_insert_id,
const char *const  message 
)
inlinestaticprivate

◆ sql_shutdown()

static void Sql_service_context_base::sql_shutdown ( void *  ctx,
int  flag 
)
inlinestaticprivate

◆ sql_start_result_metadata()

static int Sql_service_context_base::sql_start_result_metadata ( void *  ctx,
uint  num_cols,
uint  flags,
const CHARSET_INFO resultcs 
)
inlinestaticprivate

◆ sql_start_row()

static int Sql_service_context_base::sql_start_row ( void *  ctx)
inlinestaticprivate

◆ start_result_metadata()

virtual int Sql_service_context_base::start_result_metadata ( uint  num_cols,
uint  flags,
const CHARSET_INFO resultcs 
)
pure virtual

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

Implemented in Sql_service_context.

◆ start_row()

virtual int Sql_service_context_base::start_row ( )
pure virtual

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

Return values
1Error
0OK

Implemented in Sql_service_context.

Member Data Documentation

◆ sql_service_callbacks

const st_command_service_cbs Sql_service_context_base::sql_service_callbacks
static
Initial value:
= {
}
static ulong sql_get_client_capabilities(void *ctx)
Definition: sql_service_context_base.h:286
static int sql_get_date(void *ctx, const MYSQL_TIME *value)
Definition: sql_service_context_base.h:310
static int sql_end_row(void *ctx)
Definition: sql_service_context_base.h:277
static int sql_get_integer(void *ctx, longlong value)
Definition: sql_service_context_base.h:294
static void sql_abort_row(void *ctx)
Definition: sql_service_context_base.h:281
static int sql_get_datetime(void *ctx, const MYSQL_TIME *value, uint decimals)
Definition: sql_service_context_base.h:318
static int sql_end_result_metadata(void *ctx, uint server_status, uint warn_count)
Definition: sql_service_context_base.h:267
static void sql_shutdown(void *ctx, int flag)
Definition: sql_service_context_base.h:345
static bool sql_connection_alive(void *ctx)
Definition: sql_service_context_base.h:349
static int sql_get_longlong(void *ctx, longlong value, uint is_unsigned)
Definition: sql_service_context_base.h:298
static int sql_get_double(void *ctx, double value, uint32 decimals)
Definition: sql_service_context_base.h:306
static int sql_start_row(void *ctx)
Definition: sql_service_context_base.h:273
static int sql_field_metadata(void *ctx, struct st_send_field *field, const CHARSET_INFO *charset)
Definition: sql_service_context_base.h:262
static int sql_get_string(void *ctx, const char *const value, size_t length, const CHARSET_INFO *const valuecs)
Definition: sql_service_context_base.h:323
static int sql_get_time(void *ctx, const MYSQL_TIME *value, uint decimals)
Definition: sql_service_context_base.h:314
static int sql_get_decimal(void *ctx, const decimal_t *value)
Definition: sql_service_context_base.h:302
static void sql_handle_error(void *ctx, uint sql_errno, const char *const err_msg, const char *const sqlstate)
Definition: sql_service_context_base.h:338
static int sql_get_null(void *ctx)
Definition: sql_service_context_base.h:290
static int sql_start_result_metadata(void *ctx, uint num_cols, uint flags, const CHARSET_INFO *resultcs)
Definition: sql_service_context_base.h:256
static void sql_handle_ok(void *ctx, uint server_status, uint statement_warn_count, ulonglong affected_rows, ulonglong last_insert_id, const char *const message)
Definition: sql_service_context_base.h:329

The sql service callbacks that will call the below virtual methods.


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