MySQL 8.4.2
Source Code Documentation
Protocol_binary Class Referencefinal

#include <protocol_classic.h>

Inheritance diagram for Protocol_binary:
[legend]

Public Member Functions

 Protocol_binary ()=default
 
 Protocol_binary (THD *thd_arg)
 
void start_row () override
 Result set sending functions. More...
 
bool store_null () override
 
bool store_tiny (longlong from, uint32 zerofill) override
 
bool store_short (longlong from, uint32 zerofill) override
 
bool store_long (longlong from, uint32 zerofill) override
 
bool store_longlong (longlong from, bool unsigned_flag, uint32 zerofill) override
 
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 nr, uint32 decimals, uint32 zerofill) override
 
bool store_double (double from, uint32 decimals, uint32 zerofill) override
 
bool start_result_metadata (uint num_cols, uint flags, const CHARSET_INFO *resultcs) override
 Prepares the server for metadata sending. More...
 
bool send_parameters (List< Item_param > *parameters, bool is_sql_prepare) override
 Sends OUT-parameters by writing the values to the protocol. More...
 
enum enum_protocol_type type () const override
 
bool store_decimal (const my_decimal *, uint, uint) final
 
- Public Member Functions inherited from Protocol_text
 Protocol_text ()=default
 
 Protocol_text (THD *thd_arg)
 
- Public Member Functions inherited from Protocol_classic
 Protocol_classic ()
 
 Protocol_classic (THD *thd)
 
void init (THD *thd_arg)
 
bool store_field (const Field *field) final
 
bool store_string (const char *from, size_t length, const CHARSET_INFO *cs) final
 
int read_packet () override
 Read packet from client. More...
 
int get_command (COM_DATA *com_data, enum_server_command *cmd) override
 Reads the command from the protocol and creates a command. More...
 
bool create_command (COM_DATA *com_data, enum_server_command cmd, uchar *pkt, size_t length)
 Parses the passed parameters and creates a command. More...
 
bool flush () override
 Used for the classic protocol. More...
 
void end_partial_result_set () override
 Finish the result set with EOF packet, as is expected by the client, if there is an error evaluating the next row and a continue handler for the error. More...
 
bool end_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 end_result_metadata () override
 Signals the client that the metadata sending is done. More...
 
bool send_field_metadata (Send_field *field, const CHARSET_INFO *item_charset) override
 Sends a single column metadata. More...
 
void abort_row () override
 
enum enum_vio_type connection_type () const override
 Returns the type of the connection. More...
 
my_socket get_socket ()
 
bool init_net (Vio *vio)
 
void claim_memory_ownership (bool claim)
 
void end_net ()
 
bool write (const uchar *ptr, size_t len)
 
uchar get_error ()
 
void set_max_packet_size (ulong max_packet_size)
 
int shutdown (bool server_shutdown=false) override
 Thread is being shut down, disconnect and free resources. More...
 
void wipe_net ()
 
bool connection_alive () const override
 Checks if the protocol's connection with the client is still alive. More...
 
ulong get_client_capabilities () override
 Returns the client capabilities stored on the protocol. More...
 
void set_client_capabilities (ulong client_capabilities)
 
void add_client_capability (ulong client_capability)
 
void remove_client_capability (unsigned long capability)
 
bool has_client_capability (unsigned long client_capability) override
 Checks if the client capabilities include the one specified as parameter. More...
 
NETget_net ()
 
Vioget_vio ()
 
const Vioget_vio () const
 
void set_vio (Vio *vio)
 
void set_output_pkt_nr (uint pkt_nr)
 
uint get_output_pkt_nr ()
 
Stringget_output_packet ()
 
ulong get_packet_length ()
 
ucharget_raw_packet ()
 
virtual void set_read_timeout (ulong read_timeout, bool on_full_packet=false)
 
virtual void set_write_timeout (ulong write_timeout)
 
void set_result_character_set (const CHARSET_INFO *charset)
 Sets the character set expected by the client. More...
 
- Public Member Functions inherited from Protocol
virtual ~Protocol ()=default
 
Protocolpop_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 Attributes

uint bit_fields
 

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...
 
- Public Attributes inherited from Protocol_classic
bool bad_packet
 
- Protected Member Functions inherited from Protocol_classic
bool send_ok (uint server_status, uint statement_warn_count, ulonglong affected_rows, ulonglong last_insert_id, const char *message) override
 A default implementation of "OK" packet response to the client. More...
 
bool send_eof (uint server_status, uint statement_warn_count) override
 A default implementation of "EOF" packet response to the client. More...
 
bool send_error (uint sql_errno, const char *err_msg, const char *sql_state) override
 A default implementation of "ERROR" packet response to the client. 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...
 
- Protected Attributes inherited from Protocol_classic
THDm_thd
 
Stringpacket
 
String convert
 
uint field_pos
 
bool send_metadata
 
enum enum_field_typesfield_types
 
uint count
 
uint field_count
 
uint sending_flags
 
ulong input_packet_length
 
ucharinput_raw_packet
 
const CHARSET_INFOresult_cs
 

Constructor & Destructor Documentation

◆ Protocol_binary() [1/2]

Protocol_binary::Protocol_binary ( )
default

◆ Protocol_binary() [2/2]

Protocol_binary::Protocol_binary ( THD thd_arg)
inline

Member Function Documentation

◆ send_parameters()

bool Protocol_binary::send_parameters ( List< Item_param > *  parameters,
bool  is_sql_prepare 
)
overridevirtual

Sends OUT-parameters by writing the values to the protocol.

Parameters
parametersList of PS/SP parameters (both input and output).
is_sql_prepareIf it's an sql prepare then text protocol will be used.
Returns
Error status.
Return values
falseSuccess.
trueError.

Reimplemented from Protocol_text.

◆ start_result_metadata()

bool Protocol_binary::start_result_metadata ( uint  num_cols,
uint  flags,
const CHARSET_INFO resultcs 
)
overridevirtual

Prepares the server for metadata sending.

Notifies the client that the metadata sending will start.

Parameters
num_colsNumber of columns that will be sent
flagsFlags to alter the metadata sending Can be any of the following: SEND_NUM_ROWS, SEND_DEFAULTS, SEND_EOF
resultcsCharset to convert to
Return values
falseOk
trueAn error occurred

Reimplemented from Protocol_classic.

◆ start_row()

void Protocol_binary::start_row ( )
overridevirtual

Result set sending functions.

Server uses following schema to send result: ... sending metadata ... | start_result_metadata(...) | start_row() | send_field_metadata(...) | end_row() ... same for each field sent ... | end_result_metadata(...) | ... sending result ... | start_row(...) | store_xxx(...) ... store_xxx(..) is called for each field ... | end_row(...) ... same for each row, until all rows are sent ... | send_ok/eof/error(...) However, a protocol implementation might use different schema. For example, Protocol_callback ignores start/end_row when metadata is being sent.

Reimplemented from Protocol_text.

◆ store_date()

bool Protocol_binary::store_date ( const MYSQL_TIME time)
overridevirtual

Reimplemented from Protocol_text.

◆ store_datetime()

bool Protocol_binary::store_datetime ( const MYSQL_TIME time,
uint  precision 
)
overridevirtual

Reimplemented from Protocol_text.

◆ store_decimal()

bool Protocol_text::store_decimal ( const my_decimal d,
uint  prec,
uint  dec 
)
finalvirtual

Reimplemented from Protocol_text.

◆ store_double()

bool Protocol_binary::store_double ( double  from,
uint32  decimals,
uint32  zerofill 
)
overridevirtual

Reimplemented from Protocol_text.

◆ store_float()

bool Protocol_binary::store_float ( float  nr,
uint32  decimals,
uint32  zerofill 
)
overridevirtual

Reimplemented from Protocol_text.

◆ store_long()

bool Protocol_binary::store_long ( longlong  from,
uint32  zerofill 
)
overridevirtual

Reimplemented from Protocol_text.

◆ store_longlong()

bool Protocol_binary::store_longlong ( longlong  from,
bool  unsigned_flag,
uint32  zerofill 
)
overridevirtual

Reimplemented from Protocol_text.

◆ store_null()

bool Protocol_binary::store_null ( )
overridevirtual

Reimplemented from Protocol_text.

◆ store_short()

bool Protocol_binary::store_short ( longlong  from,
uint32  zerofill 
)
overridevirtual

Reimplemented from Protocol_text.

◆ store_time()

bool Protocol_binary::store_time ( const MYSQL_TIME time,
uint  precision 
)
overridevirtual

Reimplemented from Protocol_text.

◆ store_tiny()

bool Protocol_binary::store_tiny ( longlong  from,
uint32  zerofill 
)
overridevirtual

Reimplemented from Protocol_text.

◆ type()

enum enum_protocol_type Protocol_binary::type ( ) const
inlineoverridevirtual

Reimplemented from Protocol_text.

Member Data Documentation

◆ bit_fields

uint Protocol_binary::bit_fields
private

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