MySQL  8.0.16
Source Code Documentation
Protocol_binary Class Reference

#include <protocol_classic.h>

Inheritance diagram for Protocol_binary:
Protocol_text Protocol_classic Protocol

Public Member Functions

 Protocol_binary ()
 
 Protocol_binary (THD *thd_arg)
 
virtual void start_row ()
 Result set sending functions. More...
 
virtual bool store_null ()
 
virtual bool store_tiny (longlong from)
 
virtual bool store_short (longlong from)
 
virtual bool store_long (longlong from)
 
virtual bool store_longlong (longlong from, bool unsigned_flag)
 
virtual bool store_decimal (const my_decimal *, uint, uint)
 
virtual bool store (MYSQL_TIME *time, uint precision)
 
virtual bool store_date (MYSQL_TIME *time)
 
virtual bool store_time (MYSQL_TIME *time, uint precision)
 
virtual bool store (float nr, uint32 decimals, String *buffer)
 
virtual bool store (double from, uint32 decimals, String *buffer)
 
virtual bool store (Proto_field *field)
 
virtual bool store (const char *from, size_t length, const CHARSET_INFO *cs)
 
virtual bool start_result_metadata (uint num_cols, uint flags, const CHARSET_INFO *resultcs)
 Prepares the server for metadata sending. More...
 
virtual bool send_parameters (List< Item_param > *parameters, bool is_sql_prepare)
 Sends OUT-parameters by writing the values to the protocol. More...
 
virtual enum enum_protocol_type type () const
 
- Public Member Functions inherited from Protocol_text
 Protocol_text ()
 
 Protocol_text (THD *thd_arg)
 
- Public Member Functions inherited from Protocol_classic
 Protocol_classic ()
 
 Protocol_classic (THD *thd)
 
virtual ~Protocol_classic ()
 
void init (THD *thd_arg)
 
virtual int read_packet ()
 Read packet from client. More...
 
virtual int get_command (COM_DATA *com_data, enum_server_command *cmd)
 Reads the command from the protocol and creates a command. More...
 
virtual 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...
 
virtual bool flush ()
 Used for the classic protocol. More...
 
virtual void end_partial_result_set ()
 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...
 
virtual bool end_row ()
 
virtual uint get_rw_status ()
 Returns the read/writing status. More...
 
virtual bool get_compression ()
 Returns if the protocol is compressed or not. More...
 
virtual bool end_result_metadata ()
 Signals the client that the metadata sending is done. More...
 
virtual bool send_field_metadata (Send_field *field, const CHARSET_INFO *item_charset)
 Sends a single column metadata. More...
 
virtual void abort_row ()
 
virtual enum enum_vio_type connection_type () const
 Returns the type of the connection. More...
 
virtual my_socket get_socket ()
 
bool init_net (Vio *vio)
 
void claim_memory_ownership ()
 
void end_net ()
 
bool write (const uchar *ptr, size_t len)
 
uchar get_error ()
 
void set_max_packet_size (ulong max_packet_size)
 
virtual int shutdown (bool server_shutdown=false)
 Thread is being shut down, disconnect and free resources. More...
 
void wipe_net ()
 
virtual bool connection_alive () const
 Checks if the protocol's connection with the client is still alive. More...
 
virtual ulong get_client_capabilities ()
 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)
 
virtual bool has_client_capability (unsigned long client_capability)
 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 ()
 
uint get_packet_length ()
 
ucharget_raw_packet ()
 
virtual void set_read_timeout (ulong read_timeout)
 
virtual void set_write_timeout (ulong write_timeout)
 
- Public Member Functions inherited from Protocol
virtual ~Protocol ()
 
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 (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

virtual bool store (const char *from, size_t length, const CHARSET_INFO *fromcs, const CHARSET_INFO *tocs)
 
- Protected Member Functions inherited from Protocol_classic
bool net_store_data (const uchar *from, size_t length)
 
virtual bool net_store_data (const uchar *from, size_t length, const CHARSET_INFO *fromcs, const CHARSET_INFO *tocs)
 net_store_data() - extended version with character set conversion. More...
 
bool store_string_aux (const char *from, size_t length, const CHARSET_INFO *fromcs, const CHARSET_INFO *tocs)
 Auxilary function to convert string to the given character set and store in network buffer. More...
 
virtual bool send_ok (uint server_status, uint statement_warn_count, ulonglong affected_rows, ulonglong last_insert_id, const char *message)
 A default implementation of "OK" packet response to the client. More...
 
virtual bool send_eof (uint server_status, uint statement_warn_count)
 A default implementation of "EOF" packet response to the client. More...
 
virtual bool send_error (uint sql_errno, const char *err_msg, const char *sql_state)
 A default implementation of "ERROR" packet response to the client. More...
 
virtual bool store_ps_status (ulong stmt_id, uint column_count, uint param_count, ulong cond_count)
 Sends prepared statement's id and metadata to the client after prepare. More...
 

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 BaseProtocolcreate (Type type, routing::RoutingSockOpsInterface *routing_sock_ops)
 Factory method creating protocol object for handling the routing code that is protocol-specific. More...
 
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 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
 
CHARSET_INFOresult_cs
 

Constructor & Destructor Documentation

◆ Protocol_binary() [1/2]

Protocol_binary::Protocol_binary ( )
inline

◆ 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 
)
virtual

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 wil 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 
)
virtual

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
Returns
Return values
falseOk
trueAn error occurred

Reimplemented from Protocol_classic.

◆ start_row()

void Protocol_binary::start_row ( )
virtual

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() [1/6]

bool Protocol_binary::store ( MYSQL_TIME tm,
uint  decimals 
)
virtual

Reimplemented from Protocol_text.

◆ store() [2/6]

bool Protocol_binary::store ( float  nr,
uint32  decimals,
String buffer 
)
virtual

Reimplemented from Protocol_text.

◆ store() [3/6]

bool Protocol_binary::store ( double  from,
uint32  decimals,
String buffer 
)
virtual

Reimplemented from Protocol_text.

◆ store() [4/6]

bool Protocol_binary::store ( Proto_field field)
virtual

Reimplemented from Protocol_text.

◆ store() [5/6]

virtual bool Protocol_binary::store ( const char *  from,
size_t  length,
const CHARSET_INFO cs 
)
inlinevirtual

Reimplemented from Protocol_text.

◆ store() [6/6]

bool Protocol_binary::store ( const char *  from,
size_t  length,
const CHARSET_INFO fromcs,
const CHARSET_INFO tocs 
)
protectedvirtual

Reimplemented from Protocol_text.

◆ store_date()

bool Protocol_binary::store_date ( MYSQL_TIME time)
virtual

Reimplemented from Protocol_text.

◆ store_decimal()

bool Protocol_binary::store_decimal ( const my_decimal d,
uint  prec,
uint  dec 
)
virtual

Reimplemented from Protocol_text.

◆ store_long()

bool Protocol_binary::store_long ( longlong  from)
virtual

Reimplemented from Protocol_text.

◆ store_longlong()

bool Protocol_binary::store_longlong ( longlong  from,
bool  unsigned_flag 
)
virtual

Reimplemented from Protocol_text.

◆ store_null()

bool Protocol_binary::store_null ( )
virtual

Reimplemented from Protocol_text.

◆ store_short()

bool Protocol_binary::store_short ( longlong  from)
virtual

Reimplemented from Protocol_text.

◆ store_time()

bool Protocol_binary::store_time ( MYSQL_TIME time,
uint  precision 
)
virtual

Reimplemented from Protocol_text.

◆ store_tiny()

bool Protocol_binary::store_tiny ( longlong  from)
virtual

Reimplemented from Protocol_text.

◆ type()

virtual enum enum_protocol_type Protocol_binary::type ( ) const
inlinevirtual

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: