MySQL 9.0.0
Source Code Documentation
|
This is extention of Protocol_local. More...
#include <protocol_local_v2.h>
Public Member Functions | |
Protocol_local_v2 (THD *thd, Statement_handle *execute_statement) | |
~Protocol_local_v2 () override | |
int | read_packet () override |
Read packet from client. More... | |
int | get_command (COM_DATA *, enum_server_command *) override |
Reads the command from the protocol and creates a command. More... | |
ulong | get_client_capabilities () override |
Returns the client capabilities stored on the protocol. More... | |
bool | has_client_capability (unsigned long client_capability) override |
Checks if the client capabilities include the one specified as parameter. More... | |
void | end_partial_result_set () override |
int | shutdown (bool server_shutdown=false) override |
Thread is being shut down, disconnect and free resources. More... | |
bool | connection_alive () const override |
Checks if the protocol's connection with the client is still alive. More... | |
void | start_row () override |
Called between two result set rows. More... | |
bool | end_row () override |
Add the current row to the result set. More... | |
void | abort_row () override |
uint | get_rw_status () override |
Returns the read/writing status. More... | |
bool | get_compression () override |
Returns if the protocol is compressed or not. More... | |
char * | get_compression_algorithm () override |
Returns compression algorithm name. More... | |
uint | get_compression_level () override |
Returns compression level. More... | |
bool | start_result_metadata (uint num_cols, uint flags, const CHARSET_INFO *resultcs) override |
Prepares the server for metadata sending. More... | |
bool | end_result_metadata () override |
Signals the client that the metadata sending is done. More... | |
bool | send_field_metadata (Send_field *field, const CHARSET_INFO *charset) override |
Sends field metadata. More... | |
bool | flush () override |
Used for the classic protocol. More... | |
bool | send_parameters (List< Item_param > *, bool) override |
Sends the OUT-parameters to the client. More... | |
bool | store_ps_status (ulong, uint, uint, ulong) override |
Sends prepared statement's id and metadata to the client after prepare. More... | |
void | set_result_set_capacity (size_t capacity) |
Set the capacity in bytes allowed for caching results. More... | |
size_t | get_result_set_capacity () |
Get the capacity in bytes allowed for caching results. More... | |
void | clear_resultset_mem_root () |
Clear MEM_ROOT and related members. More... | |
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) |
Protected Member Functions | |
bool | store_null () override |
Add a NULL column to the current row. More... | |
bool | store_tiny (longlong from, uint32) override |
bool | store_short (longlong from, uint32) override |
bool | store_long (longlong from, uint32) override |
bool | store_longlong (longlong from, bool unsigned_flag, uint32) override |
bool | store_decimal (const my_decimal *, uint, uint) override |
bool | store_string (const char *from, size_t length, const CHARSET_INFO *cs) override |
Convert to cs_results and store a string. More... | |
bool | store_datetime (const MYSQL_TIME &time, uint precision) override |
bool | store_date (const MYSQL_TIME &time) override |
bool | store_time (const MYSQL_TIME &time, uint precision) override |
bool | store_float (float value, uint32 decimals, uint32 zerofill) override |
bool | store_double (double value, uint32 decimals, uint32 zerofill) override |
bool | store_field (const Field *field) override |
enum enum_protocol_type | type () const override |
enum enum_vio_type | connection_type () const override |
bool | send_ok (uint server_status, uint statement_warn_count, ulonglong affected_rows, ulonglong last_insert_id, const char *message) override |
Called for statements that don't have a result set, at statement end. More... | |
bool | send_eof (uint server_status, uint statement_warn_count) override |
Send eof message to the client. More... | |
bool | send_error (uint sql_errno, const char *err_msg, const char *sqlstate) override |
Called at the end of a result set. More... | |
uint | get_current_column_number () |
Private Member Functions | |
bool | store_string (const char *str, size_t length, const CHARSET_INFO *src_cs, const CHARSET_INFO *dst_cs) |
Store a string value in a result set column, optionally having converted it to character_set_results. More... | |
bool | store_longlong (longlong value) |
bool | store_floating_type (double value) |
bool | store_temporal (const MYSQL_TIME &time) |
void | add_row_to_result_set () |
template<typename T , typename V > | |
bool | allocate_type (V *value) |
Private Attributes | |
Statement_handle * | m_execute_statement |
MEM_ROOT | m_result_set_mem_root |
Result_set * | m_result_set = nullptr |
List< Row< value_t > > * | m_data_rows |
Row< Column_metadata > * | m_fields |
value_t * | m_current_row |
value_t * | m_current_column |
Column_metadata * | m_metadata_row |
Column_metadata * | m_current_metadata_column |
bool | m_send_metadata |
size_t | m_column_count |
THD * | m_thd |
uint | m_current_row_index = 0 |
Result_set_capacity | m_result_set_capacity |
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... | |
This is extention of Protocol_local.
We support reading field metadata and field data attributes.
Protocol_local_v2::Protocol_local_v2 | ( | THD * | thd, |
Statement_handle * | execute_statement | ||
) |
|
inlineoverride |
|
inlineoverridevirtual |
Implements Protocol.
|
private |
|
private |
void Protocol_local_v2::clear_resultset_mem_root | ( | ) |
Clear MEM_ROOT and related members.
|
overridevirtual |
Checks if the protocol's connection with the client is still alive.
It should always return true unless the protocol closed the connection.
true | if the connection is still alive |
false | otherwise |
Implements Protocol.
|
inlineoverrideprotectedvirtual |
Implements Protocol.
|
overridevirtual |
Implements Protocol.
|
overridevirtual |
Signals the client that the metadata sending is done.
Clears the server after sending the metadata.
false | Ok |
true | An error occurred |
Implements Protocol.
|
overridevirtual |
Add the current row to the result set.
Implements Protocol.
|
inlineoverridevirtual |
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 client capabilities stored on the protocol.
The available capabilities are defined in mysql_com.h
Implements Protocol.
|
inlineoverridevirtual |
Reads the command from the protocol and creates a command.
com_data | out parameter |
cmd | out parameter |
Implements Protocol.
|
overridevirtual |
Returns if the protocol is compressed or not.
false | Not compressed |
true | Compressed |
Implements Protocol.
|
overridevirtual |
Returns compression algorithm name.
string | compression method name |
NULL | if no compression is enabled |
Implements Protocol.
|
overridevirtual |
|
inlineprotected |
|
inline |
Get the capacity in bytes allowed for caching results.
|
overridevirtual |
Returns the read/writing status.
1 | Read |
2 | Write |
0 | Other(Idle, Killed) |
Implements Protocol.
|
overridevirtual |
Checks if the client capabilities include the one specified as parameter.
true | if it includes the specified capability |
false | otherwise |
Implements Protocol.
|
overridevirtual |
|
overrideprotectedvirtual |
Send eof message to the client.
server_status | The server status |
statement_warn_count | Total number of warnings |
false | The message was successfully sent |
true | An error occurred and the messages wasn't sent properly |
Implements Protocol.
|
overrideprotectedvirtual |
Called at the end of a result set.
Append a complete result set to the list.
Don't send anything to the client, but instead finish building of the result set at hand. Called to send an error to the client at the end of a statement.
Implements Protocol.
|
overridevirtual |
Sends field metadata.
field | Field metadata to be send to the client |
charset | Field's charset: in case it is different than the one used by the connection it will be used to convert the value to the connection's charset |
false | The metadata was successfully sent |
true | An error occurred |
Implements Protocol.
|
overrideprotectedvirtual |
Called for statements that don't have a result set, at statement end.
Implements Protocol.
|
inlineoverridevirtual |
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.
|
inline |
Set the capacity in bytes allowed for caching results.
capacity | capacity of the result set |
|
overridevirtual |
Thread is being shut down, disconnect and free resources.
server_shutdown | If false then this is normal thread shutdown. If true then the server is shutting down. |
Implements Protocol.
|
overridevirtual |
Prepares the server for metadata sending.
Notifies the client that the metadata sending will start.
num_cols | Number of columns that will be sent |
flags | Flags to alter the metadata sending Can be any of the following: SEND_NUM_ROWS, SEND_DEFAULTS, SEND_EOF |
resultcs | Charset to convert to |
false | Ok |
true | An error occurred |
Implements Protocol.
|
overridevirtual |
Called between two result set rows.
Prepare structures to fill result set rows. Unfortunately, we can't return an error here. If memory allocation fails, we'll have to return an error later. And so is done in methods such as
Implements Protocol.
|
overrideprotectedvirtual |
Implements Protocol.
|
overrideprotectedvirtual |
Implements Protocol.
|
overrideprotectedvirtual |
Implements Protocol.
|
overrideprotectedvirtual |
Implements Protocol.
|
overrideprotectedvirtual |
Implements Protocol.
|
overrideprotectedvirtual |
Implements Protocol.
|
private |
Implements Protocol.
|
overrideprotectedvirtual |
Implements Protocol.
|
private |
|
overrideprotectedvirtual |
Add a NULL column to the current row.
Implements Protocol.
|
inlineoverridevirtual |
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.
Implements Protocol.
|
overrideprotectedvirtual |
Convert to cs_results and store a string.
Implements Protocol.
|
private |
Store a string value in a result set column, optionally having converted it to character_set_results.
|
private |
|
overrideprotectedvirtual |
Implements Protocol.
Implements Protocol.
|
inlineoverrideprotectedvirtual |
Implements Protocol.
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |