MySQL 9.1.0
Source Code Documentation
|
#include <protocol_callback.h>
Public Member Functions | |
Protocol_callback (const struct st_command_service_cbs *cbs, enum cs_text_or_binary t_or_b, void *cbs_ctx) | |
int | read_packet () override |
Forces read of packet from the connection. More... | |
int | get_command (COM_DATA *com_data, enum_server_command *cmd) override |
Reads from the line and parses the data into union COM_DATA. More... | |
enum enum_protocol_type | type () const override |
Returns the type of the protocol. More... | |
enum enum_vio_type | connection_type () const override |
Returns the type of the connection. More... | |
bool | store_null () override |
Sends null value. More... | |
bool | store_tiny (longlong from, uint32) override |
Sends TINYINT value. More... | |
bool | store_short (longlong from, uint32) override |
Sends SMALLINT value. More... | |
bool | store_long (longlong from, uint32) override |
Sends INT/INTEGER value. More... | |
bool | store_longlong (longlong from, bool is_unsigned, uint32) override |
Sends BIGINT value. More... | |
bool | store_decimal (const my_decimal *d, uint, uint) override |
Sends DECIMAL value. More... | |
bool | store_string (const char *from, size_t length, const CHARSET_INFO *fromcs) override |
Sends string (CHAR/VARCHAR/TEXT/BLOB) value. More... | |
bool | store_float (float from, uint32 decimals, uint32) override |
Sends FLOAT value. More... | |
bool | store_double (double from, uint32 decimals, uint32) override |
Sends DOUBLE value. More... | |
bool | store_datetime (const MYSQL_TIME &time, uint precision) override |
Sends DATETIME value. More... | |
bool | store_date (const MYSQL_TIME &time) override |
Sends DATE value. More... | |
bool | store_time (const MYSQL_TIME &time, uint precision) override |
Sends TIME value. More... | |
bool | store_field (const Field *field) override |
Sends Field. More... | |
ulong | get_client_capabilities () override |
Returns the capabilities supported by the protocol. More... | |
bool | has_client_capability (unsigned long capability) override |
Checks if the protocol supports a capability. More... | |
void | start_row () override |
Called BEFORE sending data row or before field_metadata. More... | |
bool | end_row () override |
Called AFTER sending data row or before field_metadata. More... | |
void | abort_row () override |
Called when a row is aborted. More... | |
void | end_partial_result_set () override |
Called in case of error while sending data. More... | |
int | shutdown (bool server_shutdown=false) override |
Called when the server shuts down the connection (THD is being destroyed). More... | |
bool | connection_alive () const override |
This function always returns true as in many places in the server this is a prerequisite for continuing operations. More... | |
uint | get_rw_status () override |
Should return protocol's reading/writing status. More... | |
bool | get_compression () override |
Checks if compression is enabled. More... | |
char * | get_compression_algorithm () override |
Checks if compression is enabled and return compression method name. More... | |
uint | get_compression_level () override |
Checks if compression is enabled and return compression level. More... | |
bool | start_result_metadata (uint num_cols, uint flags, const CHARSET_INFO *resultcs) override |
Called BEFORE sending metadata. More... | |
bool | send_field_metadata (Send_field *field, const CHARSET_INFO *cs) override |
Sends metadata of one field. More... | |
bool | end_result_metadata () override |
Called AFTER sending metadata. More... | |
bool | send_ok (uint server_status, uint warn_count, ulonglong affected_rows, ulonglong last_insert_id, const char *message) override |
Sends OK. More... | |
bool | send_eof (uint server_status, uint warn_count) override |
Sends end of file. More... | |
bool | send_error (uint sql_errno, const char *err_msg, const char *sql_state) override |
Sends error. More... | |
bool | store_ps_status (ulong stmt_id, uint column_count, uint param_count, ulong cond_count) override |
Sends prepared statement's id and metadata to the client after prepare. More... | |
bool | send_parameters (List< Item_param > *parameters, bool is_sql_prepare) override |
Sends the OUT-parameters to the client. More... | |
bool | flush () override |
Used for the classic protocol. More... | |
virtual bool | store_long (longlong from, uint32 zerofill)=0 |
bool | store_long (longlong from) |
virtual bool | store_short (longlong from, uint32 zerofill)=0 |
bool | store_short (longlong from) |
Public Member Functions inherited from Protocol | |
virtual | ~Protocol ()=default |
Protocol * | pop_protocol () |
Remove the reference to the previous protocol and return it. More... | |
void | push_protocol (Protocol *protocol) |
Set reference to "this" as the previous protocol on the protocol provided as argument. More... | |
bool | store (int from) |
bool | store (uint32 from) |
bool | store (longlong from) |
bool | store (ulonglong from) |
bool | store_tiny (longlong from) |
bool | store_short (longlong from) |
bool | store_long (longlong from) |
bool | store_longlong (longlong from, bool unsigned_flag) |
bool | store (const char *from, const CHARSET_INFO *fromcs) |
Send \0 end terminated string. More... | |
bool | store (String *str) |
bool | store (const LEX_STRING &s, const CHARSET_INFO *cs) |
Private Member Functions | |
bool | set_variables_from_parameters (List< Item_param > *parameters) |
Set output parameters to variables bound at PS execution. More... | |
Private Attributes | |
void * | callbacks_ctx |
struct st_command_service_cbs | callbacks |
unsigned long | client_capabilities |
bool | client_capabilities_set |
enum cs_text_or_binary | text_or_binary |
bool | in_meta_sending |
Additional Inherited Members | |
Public Types inherited from Protocol | |
enum | enum_protocol_type { PROTOCOL_TEXT = 0 , PROTOCOL_BINARY = 1 , PROTOCOL_LOCAL = 2 , PROTOCOL_ERROR = 3 , PROTOCOL_PLUGIN = 4 } |
Enum used by type() to specify the protocol type. More... | |
enum | { SEND_NUM_ROWS = 1 , SEND_DEFAULTS = 2 , SEND_EOF = 4 } |
Flags available to alter the way the messages are sent to the client. More... | |
using | Type = BaseProtocol::Type |
Static Public Member Functions inherited from Protocol | |
static Type | get_default () |
static Type | get_by_name (const std::string &name) |
Returns type of the protocol by its name. More... | |
static std::string | to_string (const Type &type) |
static uint16_t | get_default_port (Type type) |
Returns default port for the selected protocol. More... | |
|
inline |
|
overridevirtual |
Called when a row is aborted.
Implements Protocol.
|
overridevirtual |
This function always returns true as in many places in the server this is a prerequisite for continuing operations.
Returns if the connection is alive or dead.
true | alive |
Implements Protocol.
|
overridevirtual |
|
overridevirtual |
Called in case of error while sending data.
Implements Protocol.
|
overridevirtual |
Called AFTER sending metadata.
true | failure |
false | success |
Implements Protocol.
|
overridevirtual |
Called AFTER sending data row or before field_metadata.
Called AFTER sending all fields of a row, or after field_metadata().
Please read the big comment in start_row() for explanation why in_meta_sending is used.
Implements Protocol.
|
overridevirtual |
Used for the classic protocol.
Makes the protocol send the messages/data to the client.
false | The flush was successful. |
true | An error occurred. |
Implements Protocol.
|
overridevirtual |
Returns the capabilities supported by the protocol.
Implements Protocol.
|
overridevirtual |
Reads from the line and parses the data into union COM_DATA.
Practically does nothing.
-1 | failure |
See the comment of read_packet(). Always returns -1.
Implements Protocol.
|
overridevirtual |
Checks if compression is enabled.
Should check if compression is enabled.
true | enabled |
false | disabled |
Returns always false (no compression)
Implements Protocol.
|
overridevirtual |
Checks if compression is enabled and return compression method name.
Always returns null.
Implements Protocol.
|
overridevirtual |
Checks if compression is enabled and return compression level.
Always returns 0.
Implements Protocol.
|
overridevirtual |
Should return protocol's reading/writing status.
Returns 0 (idle) as it this is the best guess that can be made as there is no callback for get_rw_status().
Returns 0 (idle) as it this is the best guess that can be made as there is no callback for get_rw_status().
Implements Protocol.
|
overridevirtual |
Checks if the protocol supports a capability.
capability | the capability |
true | supports |
false | does not support |
Implements Protocol.
|
overridevirtual |
Forces read of packet from the connection.
Practically does nothing.
-1 | failure |
Returns -1, error, for the case this will be called. It should happen. read_packet() is called by get_command() which in turn is called by do_command() in sql_parse. After that COM_DATA is filled with proper info that in turn is passed to dispatch_command(). The Command service doesn't use do_command() but dispatch_command() and passes COM_DATA directly from the user(plugin).
Implements Protocol.
|
overridevirtual |
Sends end of file.
This will be called once all data has been sent.
server_status | Bit field with different statuses. See SERVER_STATUS_* |
warn_count | The warning count generated by the execution of the statement. |
true | failure |
false | success |
Implements Protocol.
|
overridevirtual |
Sends error.
sql_errno | Error number, beginning from 1000 |
err_msg | The error message |
sql_state | The SQL state - 5 char string |
true | failure |
false | success |
Implements Protocol.
|
overridevirtual |
Sends metadata of one field.
Called for every column in the result set.
field | Field's metadata |
cs | Charset |
true | failure |
false | success |
Called for every column in the result set.
Implements Protocol.
|
overridevirtual |
Sends OK.
server_status | Bit field with different statuses. See SERVER_STATUS_* |
warn_count | Warning count from the execution |
affected_rows | Rows changed/deleted during the operation |
last_insert_id | ID of the last insert row, which has AUTO_INCROMENT column |
message | Textual message from the execution. May be NULL. |
true | failure |
false | success |
Implements Protocol.
|
overridevirtual |
Sends the OUT-parameters to the client.
parameters | List of PS/SP parameters (both input and output). |
is_sql_prepare | Used for the legacy protocol. If we're dealing with sql prepare then text protocol will be used. |
false | Success. |
true | Error. |
Implements Protocol.
|
private |
Set output parameters to variables bound at PS execution.
This method handles the case when preparing and executing was done through SQL (not by COM_STMT_PREPARE/COM_STMT_EXECUTE) in which output parameters are not going to be send to client (or 'st_command_service_cbs'), instead they will set concrete session variables.
parameters | List of PS/SP parameters (both input and output). |
false | success |
true | failure |
|
overridevirtual |
Called when the server shuts down the connection (THD is being destroyed).
In this regard, this is also called when the server shuts down. The callback implementor can differentiate between those 2 events by inspecting the shutdown_type parameter.
server_shutdown | Whether this is a normal connection shutdown (false) or a server shutdown (true). |
0 | success |
!0 | failure |
In this regard, this is also called when the server shuts down. The callback implementor can differentiate between those 2 events by inspecting the server_shutdown parameter.
server_shutdown | Whether this is a normal connection shutdown (false) or a server shutdown (true). |
Implements Protocol.
|
overridevirtual |
Called BEFORE sending metadata.
num_cols | Number of columns in the result set |
flags | flags to be used to alter the way the messages are sent to the client, see Protocol class for SEND_NUM_ROWS, SEND_DEFAULTS, SEND_EOF |
resultcs | The character set of the results. Can be different from the one in the field metadata. |
true | failure |
false | success |
Implements Protocol.
|
overridevirtual |
Called BEFORE sending data row or before field_metadata.
Implements Protocol.
|
overridevirtual |
|
overridevirtual |
Sends DATETIME value.
time | value |
precision | fractional seconds precision. 0 ... DATETIME_MAX_DECIMALS |
false | success |
true | failure |
Implements Protocol.
|
overridevirtual |
Sends DECIMAL value.
d | value |
false | success |
true | failure |
d | value |
Implements Protocol.
Sends DOUBLE value.
from | value |
decimals | number of digits to use after decimal point, unless it is DECIMAL_NOT_SPECIFIED |
false | success |
true | failure |
Implements Protocol.
|
overridevirtual |
Sends Field.
field | the field to be sent through the protocol |
false | success |
true | failure |
Implements Protocol.
Sends FLOAT value.
from | value |
decimals | number of digits to use after decimal point, unless it is DECIMAL_NOT_SPECIFIED |
false | success |
true | failure |
Implements Protocol.
|
inline |
Sends INT/INTEGER value.
from | value |
false | success |
true | failure |
Implements Protocol.
Sends BIGINT value.
from | value |
is_unsigned | from is unsigned |
false | success |
true | failure |
Implements Protocol.
|
overridevirtual |
|
overridevirtual |
Sends prepared statement's id and metadata to the client after prepare.
stmt_id | Statement id. |
column_count | Number of columns. |
param_count | Number of parameters. |
cond_count | Number of conditions raised by the current statement. |
false | The send was successful. |
true | An error occurred. |
Implements Protocol.
|
inline |
Sends SMALLINT value.
from | value |
false | success |
true | failure |
Implements Protocol.
|
overridevirtual |
Sends string (CHAR/VARCHAR/TEXT/BLOB) value.
false | success |
true | failure |
Implements Protocol.
|
overridevirtual |
Sends TIME value.
time | value |
precision | fractional seconds precision. 0 ... DATETIME_MAX_DECIMALS |
false | success |
true | failure |
Implements Protocol.
Sends TINYINT value.
from | value |
false | success |
true | failure |
Implements Protocol.
|
inlineoverridevirtual |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |