MySQL 8.4.2
Source Code Documentation
|
Command service implementation. More...
#include "my_command.h"
#include "mysql/service_command.h"
#include "mysql/strings/m_ctype.h"
#include "sql/srv_session.h"
Functions | |
int | command_service_run_command (Srv_session *session, enum enum_server_command command, const union COM_DATA *data, const CHARSET_INFO *client_cs, const struct st_command_service_cbs *callbacks, enum cs_text_or_binary text_or_binary, void *service_callbacks_ctx) |
Executes a server command in a session. More... | |
Command service implementation.
For more information please check the function comments.
int command_service_run_command | ( | Srv_session * | session, |
enum enum_server_command | command, | ||
const union COM_DATA * | data, | ||
const CHARSET_INFO * | client_cs, | ||
const struct st_command_service_cbs * | callbacks, | ||
enum cs_text_or_binary | text_or_binary, | ||
void * | service_callbacks_ctx | ||
) |
Executes a server command in a session.
There are two cases. Execution in a physical thread :
In case of 1, if there is currently attached session, and it is different from the passed one, the former will be automatically detached. The session to be used for the execution will then be attached. After the command is executed, the attached session will not be detached. It will be detached by a next call to run_command() with another session as parameter. In other words, for all sessions used in a physical thread, there will be at most one in attached state.
In case of 2, the current state (current_thd) will be preserved. Then the given session will move to attached state and the command will be executed. After the execution the state of the session will be changed to detached and the preserved state (current_thd) will be restored.
The client charset is used for commands like COM_QUERY and COM_STMT_PREPARE to know how to threat the char* fields. This charset will be used until the next call of run_command when it may be changed again.
session | The session |
command | The command to be executed. |
data | The data needed for the command to be executed |
client_cs | The charset for the string data input(COM_QUERY for example) |
callbacks | Callbacks to be used by the server to encode data and to communicate with the client (plugin) side. |
text_or_binary | See enum cs_text_or_binary |
service_callbacks_ctx | Context passed to the command service callbacks |