My Project
|
#include "sql_priv.h"
#include "unireg.h"
#include "protocol.h"
#include "sql_class.h"
#include <stdarg.h>
Functions | |
bool | net_send_error_packet (THD *, uint, const char *, const char *) |
bool | net_send_ok (THD *, uint, uint, ulonglong, ulonglong, const char *) |
bool | net_send_eof (THD *thd, uint server_status, uint statement_warn_count) |
bool | net_send_error (THD *thd, uint sql_errno, const char *err, const char *sqlstate) |
uchar * | net_store_data (uchar *to, const uchar *from, size_t length) |
uchar * | net_store_data (uchar *to, int32 from) |
uchar * | net_store_data (uchar *to, longlong from) |
Low level functions for storing data to be send to the MySQL client. The actual communction is handled by the net_xxx functions in net_serv.cc
bool net_send_eof | ( | THD * | thd, |
uint | server_status, | ||
uint | statement_warn_count | ||
) |
Send eof (= end of result set) to the client.
The eof packet has the following structure:
Note that the warning count will not be sent if 'no_flush' is set as we don't want to report the warning count until all data is sent to the client.
thd | Thread handler |
server_status | The server status |
statement_warn_count | Total number of warnings |
FALSE | The message was successfully sent |
TRUE | An error occurred and the message wasn't sent properly |
bool net_send_error | ( | THD * | thd, |
uint | sql_errno, | ||
const char * | err, | ||
const char * | sqlstate | ||
) |
Send a error string to client.
Design note:
net_printf_error and net_send_error are low-level functions that shall be used only when a new connection is being established or at server startup.
For SIGNAL/RESIGNAL and GET DIAGNOSTICS functionality it's critical that every error that can be intercepted is issued in one place only, my_message_sql.
thd | Thread handler |
sql_errno | The error code to send |
err | A pointer to the error message |
FALSE | The message was sent to the client |
TRUE | An error occurred and the message wasn't sent properly |
bool net_send_error_packet | ( | THD * | thd, |
uint | sql_errno, | ||
const char * | err, | ||
const char * | sqlstate | ||
) |
thd | Thread handler |
sql_errno | The error code to send |
err | A pointer to the error message |
FALSE | The message was successfully sent |
TRUE | An error occurred and the messages wasn't sent properly |
bool net_send_ok | ( | THD * | thd, |
uint | server_status, | ||
uint | statement_warn_count, | ||
ulonglong | affected_rows, | ||
ulonglong | id, | ||
const char * | message | ||
) |
Return ok to the client.
The ok packet has the following structure:
thd | Thread handler |
server_status | The server status |
statement_warn_count | Total number of warnings |
affected_rows | Number of rows changed by statement |
id | Auto_increment id for first row (if used) |
message | Message to send to the client (Used by mysql_status) |
FALSE | The message was successfully sent |
TRUE | An error occurred and the messages wasn't sent properly |