24#ifndef SQL_PROTOCOL_LOCAL_H
25#define SQL_PROTOCOL_LOCAL_H
47 assert(column_index <
size());
81 const std::nothrow_t & = std::nothrow)
noexcept {
85 static void operator delete(
void *, size_t)
noexcept {
89 static void operator delete(
90 void *,
MEM_ROOT *,
const std::nothrow_t &)
noexcept {
137 int shutdown(
bool server_shutdown =
false)
override;
153 bool flush()
override {
return true; }
176 bool send_ok(uint server_status, uint statement_warn_count,
178 const char *message)
override;
180 bool send_eof(uint server_status, uint statement_warn_count)
override;
181 bool send_error(uint sql_errno,
const char *err_msg,
182 const char *sqlstate)
override;
Definition: ed_connection.h:33
Ed_result_set – a container with result set rows.
Definition: protocol_local.h:66
Ed_result_set(const Ed_result_set &)
MEM_ROOT m_mem_root
Definition: protocol_local.h:97
Ed_result_set & operator=(Ed_result_set &)
Ed_row * m_fields
Definition: protocol_local.h:100
Ed_result_set(List< Ed_row > *rows_arg, Ed_row *fields, size_t column_count, MEM_ROOT *mem_root_arg)
Initialize an instance of Ed_result_set.
Definition: protocol_local.cc:44
Ed_result_set * m_next_rset
Definition: protocol_local.h:101
Ed_row * get_fields()
Definition: protocol_local.h:70
size_t get_field_count() const
Definition: protocol_local.h:78
List< Ed_row > * m_rows
Definition: protocol_local.h:99
size_t m_column_count
Definition: protocol_local.h:98
unsigned int size() const
Definition: protocol_local.h:69
~Ed_result_set()=default
We don't call member destructors, they all are POD types.
One result set record.
Definition: protocol_local.h:41
const Ed_column * get_column(const unsigned int column_index) const
Definition: protocol_local.h:46
Ed_row(Ed_column *column_array_arg, size_t column_count_arg)
Definition: protocol_local.h:52
size_t size() const
Definition: protocol_local.h:50
size_t m_column_count
Definition: protocol_local.h:57
const Ed_column & operator[](const unsigned int column_index) const
Definition: protocol_local.h:43
Ed_column * m_column_array
Definition: protocol_local.h:56
Definition: sql_list.h:494
Protocol_local: a helper class to intercept the result of the data written to the network.
Definition: protocol_local.h:126
bool send_parameters(List< Item_param > *, bool) override
Sends the OUT-parameters to the client.
Definition: protocol_local.h:154
bool connection_alive() const override
Checks if the protocol's connection with the client is still alive.
Definition: protocol_local.cc:290
size_t m_column_count
Definition: protocol_local.h:194
bool store_column(const void *data, size_t length)
A helper method to add any column to the current row in its binary form.
Definition: protocol_local.cc:103
bool has_client_capability(unsigned long client_capability) override
Checks if the client capabilities include the one specified as parameter.
Definition: protocol_local.cc:288
bool store_time(const MYSQL_TIME &time, uint precision) override
Store MYSQL_TIME (in binary format)
Definition: protocol_local.cc:209
ulong get_client_capabilities() override
Returns the client capabilities stored on the protocol.
Definition: protocol_local.cc:286
bool end_row() override
Add the current row to the result set.
Definition: protocol_local.cc:319
bool store_tiny(longlong from, uint32) override
Store a tiny int as is (1 byte) in a result set column.
Definition: protocol_local.cc:147
int get_command(COM_DATA *com_data, enum_server_command *cmd) override
Reads the command from the protocol and creates a command.
Definition: protocol_local.cc:360
bool start_result_metadata(uint num_cols, uint flags, const CHARSET_INFO *resultcs) override
Prepares the server for metadata sending.
Definition: protocol_local.cc:332
char * get_compression_algorithm() override
Returns compression algorithm name.
Definition: protocol_local.cc:356
bool store_longlong(longlong from, bool unsigned_flag, uint32) override
Store a "longlong" as is (8 bytes, host order) in a result set column.
Definition: protocol_local.cc:168
bool store_datetime(const MYSQL_TIME &time, uint precision) override
Definition: protocol_local.cc:197
Protocol_local(THD *thd, Ed_connection *ed_connection)
Definition: protocol_local.cc:60
Ed_connection * m_connection
Definition: protocol_local.h:191
bool flush() override
Used for the classic protocol.
Definition: protocol_local.h:153
bool get_compression() override
Returns if the protocol is compressed or not.
Definition: protocol_local.cc:354
uint get_compression_level() override
Returns compression level.
Definition: protocol_local.cc:358
bool store_date(const MYSQL_TIME &time) override
Store MYSQL_TIME (in binary format)
Definition: protocol_local.cc:203
bool store_field(const Field *field) override
Definition: protocol_local.cc:227
bool send_field_metadata(Send_field *field, const CHARSET_INFO *charset) override
Sends field metadata.
Definition: protocol_local.cc:348
~Protocol_local() override
Definition: protocol_local.h:129
MEM_ROOT m_rset_root
Definition: protocol_local.h:192
bool store_ps_status(ulong, uint, uint, ulong) override
Sends prepared statement's id and metadata to the client after prepare.
Definition: protocol_local.h:155
void end_partial_result_set() override
Definition: protocol_local.cc:292
bool store_long(longlong from, uint32) override
Store a "long" as is (4 bytes, host order) in a result set column.
Definition: protocol_local.cc:161
bool send_error(uint sql_errno, const char *err_msg, const char *sqlstate) override
Called to send an error to the client at the end of a statement.
Definition: protocol_local.cc:275
enum enum_protocol_type type() const override
Definition: protocol_local.h:173
bool store_string(const char *from, size_t length, const CHARSET_INFO *cs) override
Convert to cs_results and store a string.
Definition: protocol_local.cc:187
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.
Definition: protocol_local.cc:233
bool store_double(double value, uint32 decimals, uint32 zerofill) override
Definition: protocol_local.cc:221
bool store_decimal(const my_decimal *, uint, uint) override
Store a decimal in string format in a result set column.
Definition: protocol_local.cc:175
Ed_column * m_current_row
Definition: protocol_local.h:195
void start_row() override
Called between two result set rows.
Definition: protocol_local.cc:304
Ed_column * m_current_column
Definition: protocol_local.h:196
List< Ed_row > * m_rset
Definition: protocol_local.h:193
bool send_eof(uint server_status, uint statement_warn_count) override
Called at the end of a result set.
Definition: protocol_local.cc:250
int shutdown(bool server_shutdown=false) override
Thread is being shut down, disconnect and free resources.
Definition: protocol_local.cc:294
bool store_null() override
Add a NULL column to the current row.
Definition: protocol_local.cc:87
enum enum_vio_type connection_type() const override
Definition: protocol_local.h:174
THD * m_thd
Definition: protocol_local.h:199
int read_packet() override
Read packet from client.
Definition: protocol_local.cc:284
bool store_short(longlong from, uint32) override
Store a short as is (2 bytes, host order) in a result set column.
Definition: protocol_local.cc:154
void abort_row() override
Definition: protocol_local.h:141
uint get_rw_status() override
Returns the read/writing status.
Definition: protocol_local.cc:330
bool store_float(float value, uint32 decimals, uint32 zerofill) override
Definition: protocol_local.cc:215
Ed_row * m_fields
Definition: protocol_local.h:197
bool end_result_metadata() override
Signals the client that the metadata sending is done.
Definition: protocol_local.cc:341
void opt_add_row_to_rset()
A helper function to add the current row to the current result set.
Definition: protocol_local.cc:75
bool m_send_metadata
Definition: protocol_local.h:198
Definition: protocol.h:33
enum_protocol_type
Enum used by type() to specify the protocol type.
Definition: protocol.h:101
@ PROTOCOL_LOCAL
Definition: protocol.h:105
For each client connection we create a separate thread with THD serving as a thread/connection descri...
Definition: sql_lexer_thd.h:36
my_decimal class limits 'decimal_t' type to what we need in MySQL.
Definition: my_decimal.h:96
static MEM_ROOT mem_root
Definition: client_plugin.cc:114
static int flags[50]
Definition: hp_test1.cc:40
enum_server_command
A list of all MySQL protocol commands.
Definition: my_command.h:48
unsigned long long int ulonglong
Definition: my_inttypes.h:56
long long int longlong
Definition: my_inttypes.h:55
uint32_t uint32
Definition: my_inttypes.h:67
std::string str(const mysqlrouter::ConfigGenerator::Options::Endpoint &ep)
Definition: config_generator.cc:1105
constexpr value_type zerofill
Definition: classic_protocol_constants.h:274
const std::string charset("charset")
Definition: commit_order_queue.h:34
bool length(const dd::Spatial_reference_system *srs, const Geometry *g1, double *length, bool *null) noexcept
Computes the length of linestrings and multilinestrings.
Definition: length.cc:76
Definition: m_ctype.h:421
One result set column.
Definition: protocol_local.h:35
The MEM_ROOT is a simple arena, where allocations are carved out of larger blocks.
Definition: my_alloc.h:83
void Clear()
Deallocate all the RAM used.
Definition: my_alloc.cc:172
void * Alloc(size_t length)
Allocate memory.
Definition: my_alloc.h:145
Definition: mysql_lex_string.h:35
Definition: mysql_time.h:82
Definition: com_data.h:104
enum_vio_type
Definition: violite.h:79
@ VIO_TYPE_LOCAL
Used internally by the prepared statements.
Definition: violite.h:107