summaryrefslogtreecommitdiff
path: root/ext/mysqlnd/mysqlnd_commands.c
diff options
context:
space:
mode:
authorDmitry Stogov <dmitry@zend.com>2017-11-14 17:32:41 +0300
committerDmitry Stogov <dmitry@zend.com>2017-11-14 17:32:41 +0300
commit4d5330fbe1eab52835bb3dbf9c8dc85f31dfbc99 (patch)
tree7667a4141aaa1b1f79e3df5369c02eba32958838 /ext/mysqlnd/mysqlnd_commands.c
parent3077a14aea635f36fbd5b2dd28a435c58067bf59 (diff)
downloadphp-git-4d5330fbe1eab52835bb3dbf9c8dc85f31dfbc99.tar.gz
Run mysqlmd commands in one step (without separate create/run/free).
Diffstat (limited to 'ext/mysqlnd/mysqlnd_commands.c')
-rw-r--r--ext/mysqlnd/mysqlnd_commands.c609
1 files changed, 270 insertions, 339 deletions
diff --git a/ext/mysqlnd/mysqlnd_commands.c b/ext/mysqlnd/mysqlnd_commands.c
index 579ae25aef..5232055c90 100644
--- a/ext/mysqlnd/mysqlnd_commands.c
+++ b/ext/mysqlnd/mysqlnd_commands.c
@@ -29,28 +29,16 @@
struct st_mysqlnd_protocol_no_params_command
{
- struct st_mysqlnd_protocol_command parent;
struct st_mysqlnd_protocol_no_params_command_context
{
MYSQLND_CONN_DATA * conn;
} context;
};
-/* {{{ mysqlnd_com_no_params_free_command */
-static void
-mysqlnd_com_no_params_free_command(void * command)
-{
- DBG_ENTER("mysqlnd_com_no_params_free_command");
- mnd_efree(command);
- DBG_VOID_RETURN;
-}
-/* }}} */
-
/************************** COM_SET_OPTION ******************************************/
struct st_mysqlnd_protocol_com_set_option_command
{
- struct st_mysqlnd_protocol_command parent;
struct st_mysqlnd_com_set_option_context
{
MYSQLND_CONN_DATA * conn;
@@ -60,7 +48,7 @@ struct st_mysqlnd_protocol_com_set_option_command
/* {{{ mysqlnd_com_set_option_run */
-enum_func_status
+static enum_func_status
mysqlnd_com_set_option_run(void *cmd)
{
struct st_mysqlnd_protocol_com_set_option_command * command = (struct st_mysqlnd_protocol_com_set_option_command *) cmd;
@@ -90,22 +78,20 @@ mysqlnd_com_set_option_run(void *cmd)
/* }}} */
-/* {{{ mysqlnd_com_set_option_create_command */
-static struct st_mysqlnd_protocol_command *
-mysqlnd_com_set_option_create_command(va_list args)
+/* {{{ mysqlnd_com_set_option_run_command */
+static enum_func_status
+mysqlnd_com_set_option_run_command(va_list args)
{
- struct st_mysqlnd_protocol_com_set_option_command * command;
- DBG_ENTER("mysqlnd_com_set_option_create_command");
- command = mnd_ecalloc(1, sizeof(struct st_mysqlnd_protocol_com_set_option_command));
- if (command) {
- command->context.conn = va_arg(args, MYSQLND_CONN_DATA *);
- command->context.option = va_arg(args, enum_mysqlnd_server_option);
-
- command->parent.free_command = mysqlnd_com_no_params_free_command;
- command->parent.run = mysqlnd_com_set_option_run;
- }
+ struct st_mysqlnd_protocol_com_set_option_command command;
+ enum_func_status ret;
+
+ DBG_ENTER("mysqlnd_com_set_option_run_command");
+ command.context.conn = va_arg(args, MYSQLND_CONN_DATA *);
+ command.context.option = va_arg(args, enum_mysqlnd_server_option);
- DBG_RETURN((struct st_mysqlnd_protocol_command *) command);
+ ret = mysqlnd_com_set_option_run(&command);
+
+ DBG_RETURN(ret);
}
/* }}} */
@@ -140,21 +126,19 @@ mysqlnd_com_debug_run(void *cmd)
/* }}} */
-/* {{{ mysqlnd_com_debug_create_command */
-static struct st_mysqlnd_protocol_command *
-mysqlnd_com_debug_create_command(va_list args)
+/* {{{ mysqlnd_com_debug_run_command */
+static enum_func_status
+mysqlnd_com_debug_run_command(va_list args)
{
- struct st_mysqlnd_protocol_no_params_command * command;
- DBG_ENTER("mysqlnd_com_debug_create_command");
- command = mnd_ecalloc(1, sizeof(struct st_mysqlnd_protocol_no_params_command));
- if (command) {
- command->context.conn = va_arg(args, MYSQLND_CONN_DATA *);
- command->parent.free_command = mysqlnd_com_no_params_free_command;
-
- command->parent.run = mysqlnd_com_debug_run;
- }
+ struct st_mysqlnd_protocol_no_params_command command;
+ enum_func_status ret;
+
+ DBG_ENTER("mysqlnd_com_debug_run_command");
+ command.context.conn = va_arg(args, MYSQLND_CONN_DATA *);
- DBG_RETURN((struct st_mysqlnd_protocol_command *) command);
+ ret = mysqlnd_com_debug_run(&command);
+
+ DBG_RETURN(ret);
}
/* }}} */
@@ -162,7 +146,6 @@ mysqlnd_com_debug_create_command(va_list args)
/************************** COM_INIT_DB ******************************************/
struct st_mysqlnd_protocol_com_init_db_command
{
- struct st_mysqlnd_protocol_command parent;
struct st_mysqlnd_com_init_db_context
{
MYSQLND_CONN_DATA * conn;
@@ -219,22 +202,20 @@ mysqlnd_com_init_db_run(void *cmd)
/* }}} */
-/* {{{ mysqlnd_com_init_db_create_command */
-static struct st_mysqlnd_protocol_command *
-mysqlnd_com_init_db_create_command(va_list args)
+/* {{{ mysqlnd_com_init_db_run_command */
+static enum_func_status
+mysqlnd_com_init_db_run_command(va_list args)
{
- struct st_mysqlnd_protocol_com_init_db_command * command;
- DBG_ENTER("mysqlnd_com_init_db_create_command");
- command = mnd_ecalloc(1, sizeof(struct st_mysqlnd_protocol_com_init_db_command));
- if (command) {
- command->context.conn = va_arg(args, MYSQLND_CONN_DATA *);
- command->context.db = va_arg(args, MYSQLND_CSTRING);
-
- command->parent.free_command = mysqlnd_com_no_params_free_command;
- command->parent.run = mysqlnd_com_init_db_run;
- }
+ struct st_mysqlnd_protocol_com_init_db_command command;
+ enum_func_status ret;
- DBG_RETURN((struct st_mysqlnd_protocol_command *) command);
+ DBG_ENTER("mysqlnd_com_init_db_run_command");
+ command.context.conn = va_arg(args, MYSQLND_CONN_DATA *);
+ command.context.db = va_arg(args, MYSQLND_CSTRING);
+
+ ret = mysqlnd_com_init_db_run(&command);
+
+ DBG_RETURN(ret);
}
/* }}} */
@@ -274,21 +255,19 @@ mysqlnd_com_ping_run(void *cmd)
/* }}} */
-/* {{{ mysqlnd_com_ping_create_command */
-static struct st_mysqlnd_protocol_command *
-mysqlnd_com_ping_create_command(va_list args)
+/* {{{ mysqlnd_com_ping_run_command */
+static enum_func_status
+mysqlnd_com_ping_run_command(va_list args)
{
- struct st_mysqlnd_protocol_no_params_command * command;
- DBG_ENTER("mysqlnd_com_ping_create_command");
- command = mnd_ecalloc(1, sizeof(struct st_mysqlnd_protocol_no_params_command));
- if (command) {
- command->context.conn = va_arg(args, MYSQLND_CONN_DATA *);
- command->parent.free_command = mysqlnd_com_no_params_free_command;
-
- command->parent.run = mysqlnd_com_ping_run;
- }
+ struct st_mysqlnd_protocol_no_params_command command;
+ enum_func_status ret;
+
+ DBG_ENTER("mysqlnd_com_ping_run_command");
+ command.context.conn = va_arg(args, MYSQLND_CONN_DATA *);
- DBG_RETURN((struct st_mysqlnd_protocol_command *) command);
+ ret = mysqlnd_com_ping_run(&command);
+
+ DBG_RETURN(ret);
}
/* }}} */
@@ -296,7 +275,6 @@ mysqlnd_com_ping_create_command(va_list args)
/************************** COM_STATISTICS ******************************************/
struct st_mysqlnd_protocol_com_statistics_command
{
- struct st_mysqlnd_protocol_command parent;
struct st_mysqlnd_com_statistics_context
{
MYSQLND_CONN_DATA * conn;
@@ -342,29 +320,26 @@ mysqlnd_com_statistics_run(void *cmd)
/* }}} */
-/* {{{ mysqlnd_com_statistics_create_command */
-static struct st_mysqlnd_protocol_command *
-mysqlnd_com_statistics_create_command(va_list args)
+/* {{{ mysqlnd_com_statistics_run_command */
+static enum_func_status
+mysqlnd_com_statistics_run_command(va_list args)
{
- struct st_mysqlnd_protocol_com_statistics_command * command;
- DBG_ENTER("mysqlnd_com_statistics_create_command");
- command = mnd_ecalloc(1, sizeof(struct st_mysqlnd_protocol_com_statistics_command));
- if (command) {
- command->context.conn = va_arg(args, MYSQLND_CONN_DATA *);
- command->context.message = va_arg(args, zend_string **);
-
- command->parent.free_command = mysqlnd_com_no_params_free_command;
- command->parent.run = mysqlnd_com_statistics_run;
- }
+ struct st_mysqlnd_protocol_com_statistics_command command;
+ enum_func_status ret;
+
+ DBG_ENTER("mysqlnd_com_statistics_run_command");
+ command.context.conn = va_arg(args, MYSQLND_CONN_DATA *);
+ command.context.message = va_arg(args, zend_string **);
- DBG_RETURN((struct st_mysqlnd_protocol_command *) command);
+ ret = mysqlnd_com_statistics_run(&command);
+
+ DBG_RETURN(ret);
}
/* }}} */
/************************** COM_PROCESS_KILL ******************************************/
struct st_mysqlnd_protocol_com_process_kill_command
{
- struct st_mysqlnd_protocol_command parent;
struct st_mysqlnd_com_process_kill_context
{
MYSQLND_CONN_DATA * conn;
@@ -417,30 +392,27 @@ mysqlnd_com_process_kill_run(void *cmd)
/* }}} */
-/* {{{ mysqlnd_com_process_kill_create_command */
-static struct st_mysqlnd_protocol_command *
-mysqlnd_com_process_kill_create_command(va_list args)
+/* {{{ mysqlnd_com_process_kill_run_command */
+static enum_func_status
+mysqlnd_com_process_kill_run_command(va_list args)
{
- struct st_mysqlnd_protocol_com_process_kill_command * command;
- DBG_ENTER("mysqlnd_com_process_kill_create_command");
- command = mnd_ecalloc(1, sizeof(struct st_mysqlnd_protocol_com_process_kill_command));
- if (command) {
- command->context.conn = va_arg(args, MYSQLND_CONN_DATA *);
- command->context.process_id = va_arg(args, unsigned int);
- command->context.read_response = va_arg(args, unsigned int)? TRUE:FALSE;
-
- command->parent.free_command = mysqlnd_com_no_params_free_command;
- command->parent.run = mysqlnd_com_process_kill_run;
- }
+ struct st_mysqlnd_protocol_com_process_kill_command command;
+ enum_func_status ret;
+
+ DBG_ENTER("mysqlnd_com_process_kill_run_command");
+ command.context.conn = va_arg(args, MYSQLND_CONN_DATA *);
+ command.context.process_id = va_arg(args, unsigned int);
+ command.context.read_response = va_arg(args, unsigned int)? TRUE:FALSE;
- DBG_RETURN((struct st_mysqlnd_protocol_command *) command);
+ ret = mysqlnd_com_process_kill_run(&command);
+
+ DBG_RETURN(ret);
}
/* }}} */
/************************** COM_REFRESH ******************************************/
struct st_mysqlnd_protocol_com_refresh_command
{
- struct st_mysqlnd_protocol_command parent;
struct st_mysqlnd_com_refresh_context
{
MYSQLND_CONN_DATA * conn;
@@ -480,22 +452,20 @@ mysqlnd_com_refresh_run(void *cmd)
/* }}} */
-/* {{{ mysqlnd_com_refresh_create_command */
-static struct st_mysqlnd_protocol_command *
-mysqlnd_com_refresh_create_command(va_list args)
+/* {{{ mysqlnd_com_refresh_run_command */
+static enum_func_status
+mysqlnd_com_refresh_run_command(va_list args)
{
- struct st_mysqlnd_protocol_com_refresh_command * command;
- DBG_ENTER("mysqlnd_com_refresh_create_command");
- command = mnd_ecalloc(1, sizeof(struct st_mysqlnd_protocol_com_refresh_command));
- if (command) {
- command->context.conn = va_arg(args, MYSQLND_CONN_DATA *);
- command->context.options = va_arg(args, unsigned int);
-
- command->parent.free_command = mysqlnd_com_no_params_free_command;
- command->parent.run = mysqlnd_com_refresh_run;
- }
+ struct st_mysqlnd_protocol_com_refresh_command command;
+ enum_func_status ret;
- DBG_RETURN((struct st_mysqlnd_protocol_command *) command);
+ DBG_ENTER("mysqlnd_com_refresh_run_command");
+ command.context.conn = va_arg(args, MYSQLND_CONN_DATA *);
+ command.context.options = va_arg(args, unsigned int);
+
+ ret = mysqlnd_com_refresh_run(&command);
+
+ DBG_RETURN(ret);
}
/* }}} */
@@ -503,7 +473,6 @@ mysqlnd_com_refresh_create_command(va_list args)
/************************** COM_SHUTDOWN ******************************************/
struct st_mysqlnd_protocol_com_shutdown_command
{
- struct st_mysqlnd_protocol_command parent;
struct st_mysqlnd_com_shutdown_context
{
MYSQLND_CONN_DATA * conn;
@@ -543,22 +512,20 @@ mysqlnd_com_shutdown_run(void *cmd)
/* }}} */
-/* {{{ mysqlnd_com_shutdown_create_command */
-static struct st_mysqlnd_protocol_command *
-mysqlnd_com_shutdown_create_command(va_list args)
+/* {{{ mysqlnd_com_shutdown_run_command */
+static enum_func_status
+mysqlnd_com_shutdown_run_command(va_list args)
{
- struct st_mysqlnd_protocol_com_shutdown_command * command;
- DBG_ENTER("mysqlnd_com_shutdown_create_command");
- command = mnd_ecalloc(1, sizeof(struct st_mysqlnd_protocol_com_shutdown_command));
- if (command) {
- command->context.conn = va_arg(args, MYSQLND_CONN_DATA *);
- command->context.level = va_arg(args, unsigned int);
-
- command->parent.free_command = mysqlnd_com_no_params_free_command;
- command->parent.run = mysqlnd_com_shutdown_run;
- }
+ struct st_mysqlnd_protocol_com_shutdown_command command;
+ enum_func_status ret;
+
+ DBG_ENTER("mysqlnd_com_shutdown_run_command");
+ command.context.conn = va_arg(args, MYSQLND_CONN_DATA *);
+ command.context.level = va_arg(args, unsigned int);
+
+ ret = mysqlnd_com_shutdown_run(&command);
- DBG_RETURN((struct st_mysqlnd_protocol_command *) command);
+ DBG_RETURN(ret);
}
/* }}} */
@@ -566,7 +533,6 @@ mysqlnd_com_shutdown_create_command(va_list args)
/************************** COM_QUIT ******************************************/
struct st_mysqlnd_protocol_com_quit_command
{
- struct st_mysqlnd_protocol_command parent;
struct st_mysqlnd_com_quit_context
{
MYSQLND_CONN_DATA * conn;
@@ -598,28 +564,25 @@ mysqlnd_com_quit_run(void *cmd)
/* }}} */
-/* {{{ mysqlnd_com_quit_create_command */
-static struct st_mysqlnd_protocol_command *
-mysqlnd_com_quit_create_command(va_list args)
+/* {{{ mysqlnd_com_quit_run_command */
+static enum_func_status
+mysqlnd_com_quit_run_command(va_list args)
{
- struct st_mysqlnd_protocol_com_quit_command * command;
- DBG_ENTER("mysqlnd_com_quit_create_command");
- command = mnd_ecalloc(1, sizeof(struct st_mysqlnd_protocol_com_quit_command));
- if (command) {
- command->context.conn = va_arg(args, MYSQLND_CONN_DATA *);
-
- command->parent.free_command = mysqlnd_com_no_params_free_command;
- command->parent.run = mysqlnd_com_quit_run;
- }
+ struct st_mysqlnd_protocol_com_quit_command command;
+ enum_func_status ret;
- DBG_RETURN((struct st_mysqlnd_protocol_command *) command);
+ DBG_ENTER("mysqlnd_com_quit_run_command");
+ command.context.conn = va_arg(args, MYSQLND_CONN_DATA *);
+
+ ret = mysqlnd_com_quit_run(&command);
+
+ DBG_RETURN(ret);
}
/* }}} */
/************************** COM_QUERY ******************************************/
struct st_mysqlnd_protocol_com_query_command
{
- struct st_mysqlnd_protocol_command parent;
struct st_mysqlnd_com_query_context
{
MYSQLND_CONN_DATA * conn;
@@ -656,29 +619,26 @@ mysqlnd_com_query_run(void *cmd)
/* }}} */
-/* {{{ mysqlnd_com_query_create_command */
-static struct st_mysqlnd_protocol_command *
-mysqlnd_com_query_create_command(va_list args)
+/* {{{ mysqlnd_com_query_run_command */
+static enum_func_status
+mysqlnd_com_query_run_command(va_list args)
{
- struct st_mysqlnd_protocol_com_query_command * command;
- DBG_ENTER("mysqlnd_com_query_create_command");
- command = mnd_ecalloc(1, sizeof(struct st_mysqlnd_protocol_com_query_command));
- if (command) {
- command->context.conn = va_arg(args, MYSQLND_CONN_DATA *);
- command->context.query = va_arg(args, MYSQLND_CSTRING);
-
- command->parent.free_command = mysqlnd_com_no_params_free_command;
- command->parent.run = mysqlnd_com_query_run;
- }
+ struct st_mysqlnd_protocol_com_query_command command;
+ enum_func_status ret;
+
+ DBG_ENTER("mysqlnd_com_query_run_command");
+ command.context.conn = va_arg(args, MYSQLND_CONN_DATA *);
+ command.context.query = va_arg(args, MYSQLND_CSTRING);
- DBG_RETURN((struct st_mysqlnd_protocol_command *) command);
+ ret = mysqlnd_com_query_run(&command);
+
+ DBG_RETURN(ret);
}
/* }}} */
/************************** COM_CHANGE_USER ******************************************/
struct st_mysqlnd_protocol_com_change_user_command
{
- struct st_mysqlnd_protocol_command parent;
struct st_mysqlnd_com_change_user_context
{
MYSQLND_CONN_DATA * conn;
@@ -712,23 +672,21 @@ mysqlnd_com_change_user_run(void *cmd)
/* }}} */
-/* {{{ mysqlnd_com_change_user_create_command */
-static struct st_mysqlnd_protocol_command *
-mysqlnd_com_change_user_create_command(va_list args)
+/* {{{ mysqlnd_com_change_user_run_command */
+static enum_func_status
+mysqlnd_com_change_user_run_command(va_list args)
{
- struct st_mysqlnd_protocol_com_change_user_command * command;
- DBG_ENTER("mysqlnd_com_change_user_create_command");
- command = mnd_ecalloc(1, sizeof(struct st_mysqlnd_protocol_com_change_user_command));
- if (command) {
- command->context.conn = va_arg(args, MYSQLND_CONN_DATA *);
- command->context.payload = va_arg(args, MYSQLND_CSTRING);
- command->context.silent = va_arg(args, unsigned int);
-
- command->parent.free_command = mysqlnd_com_no_params_free_command;
- command->parent.run = mysqlnd_com_change_user_run;
- }
+ struct st_mysqlnd_protocol_com_change_user_command command;
+ enum_func_status ret;
- DBG_RETURN((struct st_mysqlnd_protocol_command *) command);
+ DBG_ENTER("mysqlnd_com_change_user_run_command");
+ command.context.conn = va_arg(args, MYSQLND_CONN_DATA *);
+ command.context.payload = va_arg(args, MYSQLND_CSTRING);
+ command.context.silent = va_arg(args, unsigned int);
+
+ ret = mysqlnd_com_change_user_run(&command);
+
+ DBG_RETURN(ret);
}
/* }}} */
@@ -736,7 +694,6 @@ mysqlnd_com_change_user_create_command(va_list args)
/************************** COM_REAP_RESULT ******************************************/
struct st_mysqlnd_protocol_com_reap_result_command
{
- struct st_mysqlnd_protocol_command parent;
struct st_mysqlnd_com_reap_result_context
{
MYSQLND_CONN_DATA * conn;
@@ -766,21 +723,19 @@ mysqlnd_com_reap_result_run(void *cmd)
/* }}} */
-/* {{{ mysqlnd_com_reap_result_create_command */
-static struct st_mysqlnd_protocol_command *
-mysqlnd_com_reap_result_create_command(va_list args)
+/* {{{ mysqlnd_com_reap_result_run_command */
+static enum_func_status
+mysqlnd_com_reap_result_run_command(va_list args)
{
- struct st_mysqlnd_protocol_com_reap_result_command * command;
- DBG_ENTER("mysqlnd_com_reap_result_create_command");
- command = mnd_ecalloc(1, sizeof(struct st_mysqlnd_protocol_com_reap_result_command));
- if (command) {
- command->context.conn = va_arg(args, MYSQLND_CONN_DATA *);
-
- command->parent.free_command = mysqlnd_com_no_params_free_command;
- command->parent.run = mysqlnd_com_reap_result_run;
- }
+ struct st_mysqlnd_protocol_com_reap_result_command command;
+ enum_func_status ret;
+
+ DBG_ENTER("mysqlnd_com_reap_result_run_command");
+ command.context.conn = va_arg(args, MYSQLND_CONN_DATA *);
+
+ ret = mysqlnd_com_reap_result_run(&command);
- DBG_RETURN((struct st_mysqlnd_protocol_command *) command);
+ DBG_RETURN(ret);
}
/* }}} */
@@ -788,7 +743,6 @@ mysqlnd_com_reap_result_create_command(va_list args)
/************************** COM_STMT_PREPARE ******************************************/
struct st_mysqlnd_protocol_com_stmt_prepare_command
{
- struct st_mysqlnd_protocol_command parent;
struct st_mysqlnd_com_stmt_prepare_context
{
MYSQLND_CONN_DATA * conn;
@@ -821,22 +775,20 @@ mysqlnd_com_stmt_prepare_run(void *cmd)
/* }}} */
-/* {{{ mysqlnd_com_stmt_prepare_create_command */
-static struct st_mysqlnd_protocol_command *
-mysqlnd_com_stmt_prepare_create_command(va_list args)
+/* {{{ mysqlnd_com_stmt_prepare_run_command */
+static enum_func_status
+mysqlnd_com_stmt_prepare_run_command(va_list args)
{
- struct st_mysqlnd_protocol_com_stmt_prepare_command * command;
- DBG_ENTER("mysqlnd_com_stmt_prepare_create_command");
- command = mnd_ecalloc(1, sizeof(struct st_mysqlnd_protocol_com_stmt_prepare_command));
- if (command) {
- command->context.conn = va_arg(args, MYSQLND_CONN_DATA *);
- command->context.query = va_arg(args, MYSQLND_CSTRING);
-
- command->parent.free_command = mysqlnd_com_no_params_free_command;
- command->parent.run = mysqlnd_com_stmt_prepare_run;
- }
+ struct st_mysqlnd_protocol_com_stmt_prepare_command command;
+ enum_func_status ret;
- DBG_RETURN((struct st_mysqlnd_protocol_command *) command);
+ DBG_ENTER("mysqlnd_com_stmt_prepare_run_command");
+ command.context.conn = va_arg(args, MYSQLND_CONN_DATA *);
+ command.context.query = va_arg(args, MYSQLND_CSTRING);
+
+ ret = mysqlnd_com_stmt_prepare_run(&command);
+
+ DBG_RETURN(ret);
}
/* }}} */
@@ -844,7 +796,6 @@ mysqlnd_com_stmt_prepare_create_command(va_list args)
/************************** COM_STMT_EXECUTE ******************************************/
struct st_mysqlnd_protocol_com_stmt_execute_command
{
- struct st_mysqlnd_protocol_command parent;
struct st_mysqlnd_com_stmt_execute_context
{
MYSQLND_CONN_DATA * conn;
@@ -877,22 +828,20 @@ mysqlnd_com_stmt_execute_run(void *cmd)
/* }}} */
-/* {{{ mysqlnd_com_stmt_execute_create_command */
-static struct st_mysqlnd_protocol_command *
-mysqlnd_com_stmt_execute_create_command(va_list args)
+/* {{{ mysqlnd_com_stmt_execute_run_command */
+static enum_func_status
+mysqlnd_com_stmt_execute_run_command(va_list args)
{
- struct st_mysqlnd_protocol_com_stmt_execute_command * command;
- DBG_ENTER("mysqlnd_com_stmt_execute_create_command");
- command = mnd_ecalloc(1, sizeof(struct st_mysqlnd_protocol_com_stmt_execute_command));
- if (command) {
- command->context.conn = va_arg(args, MYSQLND_CONN_DATA *);
- command->context.payload = va_arg(args, MYSQLND_CSTRING);
-
- command->parent.free_command = mysqlnd_com_no_params_free_command;
- command->parent.run = mysqlnd_com_stmt_execute_run;
- }
+ struct st_mysqlnd_protocol_com_stmt_execute_command command;
+ enum_func_status ret;
+
+ DBG_ENTER("mysqlnd_com_stmt_execute_run_command");
+ command.context.conn = va_arg(args, MYSQLND_CONN_DATA *);
+ command.context.payload = va_arg(args, MYSQLND_CSTRING);
+
+ ret = mysqlnd_com_stmt_execute_run(&command);
- DBG_RETURN((struct st_mysqlnd_protocol_command *) command);
+ DBG_RETURN(ret);
}
/* }}} */
@@ -900,7 +849,6 @@ mysqlnd_com_stmt_execute_create_command(va_list args)
/************************** COM_STMT_FETCH ******************************************/
struct st_mysqlnd_protocol_com_stmt_fetch_command
{
- struct st_mysqlnd_protocol_command parent;
struct st_mysqlnd_com_stmt_fetch_context
{
MYSQLND_CONN_DATA * conn;
@@ -933,22 +881,20 @@ mysqlnd_com_stmt_fetch_run(void *cmd)
/* }}} */
-/* {{{ mysqlnd_com_stmt_fetch_create_command */
-static struct st_mysqlnd_protocol_command *
-mysqlnd_com_stmt_fetch_create_command(va_list args)
+/* {{{ mysqlnd_com_stmt_fetch_run_command */
+static enum_func_status
+mysqlnd_com_stmt_fetch_run_command(va_list args)
{
- struct st_mysqlnd_protocol_com_stmt_fetch_command * command;
- DBG_ENTER("mysqlnd_com_stmt_fetch_create_command");
- command = mnd_ecalloc(1, sizeof(struct st_mysqlnd_protocol_com_stmt_fetch_command));
- if (command) {
- command->context.conn = va_arg(args, MYSQLND_CONN_DATA *);
- command->context.payload = va_arg(args, MYSQLND_CSTRING);
-
- command->parent.free_command = mysqlnd_com_no_params_free_command;
- command->parent.run = mysqlnd_com_stmt_fetch_run;
- }
+ struct st_mysqlnd_protocol_com_stmt_fetch_command command;
+ enum_func_status ret;
- DBG_RETURN((struct st_mysqlnd_protocol_command *) command);
+ DBG_ENTER("mysqlnd_com_stmt_fetch_run_command");
+ command.context.conn = va_arg(args, MYSQLND_CONN_DATA *);
+ command.context.payload = va_arg(args, MYSQLND_CSTRING);
+
+ ret = mysqlnd_com_stmt_fetch_run(&command);
+
+ DBG_RETURN(ret);
}
/* }}} */
@@ -956,7 +902,6 @@ mysqlnd_com_stmt_fetch_create_command(va_list args)
/************************** COM_STMT_RESET ******************************************/
struct st_mysqlnd_protocol_com_stmt_reset_command
{
- struct st_mysqlnd_protocol_command parent;
struct st_mysqlnd_com_stmt_reset_context
{
MYSQLND_CONN_DATA * conn;
@@ -996,22 +941,20 @@ mysqlnd_com_stmt_reset_run(void *cmd)
/* }}} */
-/* {{{ mysqlnd_com_stmt_reset_create_command */
-static struct st_mysqlnd_protocol_command *
-mysqlnd_com_stmt_reset_create_command(va_list args)
+/* {{{ mysqlnd_com_stmt_reset_run_command */
+static enum_func_status
+mysqlnd_com_stmt_reset_run_command(va_list args)
{
- struct st_mysqlnd_protocol_com_stmt_reset_command * command;
- DBG_ENTER("mysqlnd_com_stmt_reset_create_command");
- command = mnd_ecalloc(1, sizeof(struct st_mysqlnd_protocol_com_stmt_reset_command));
- if (command) {
- command->context.conn = va_arg(args, MYSQLND_CONN_DATA *);
- command->context.stmt_id = va_arg(args, size_t);
-
- command->parent.free_command = mysqlnd_com_no_params_free_command;
- command->parent.run = mysqlnd_com_stmt_reset_run;
- }
+ struct st_mysqlnd_protocol_com_stmt_reset_command command;
+ enum_func_status ret;
+
+ DBG_ENTER("mysqlnd_com_stmt_reset_run_command");
+ command.context.conn = va_arg(args, MYSQLND_CONN_DATA *);
+ command.context.stmt_id = va_arg(args, size_t);
+
+ ret = mysqlnd_com_stmt_reset_run(&command);
- DBG_RETURN((struct st_mysqlnd_protocol_command *) command);
+ DBG_RETURN(ret);
}
/* }}} */
@@ -1019,7 +962,6 @@ mysqlnd_com_stmt_reset_create_command(va_list args)
/************************** COM_STMT_SEND_LONG_DATA ******************************************/
struct st_mysqlnd_protocol_com_stmt_send_long_data_command
{
- struct st_mysqlnd_protocol_command parent;
struct st_mysqlnd_com_stmt_send_long_data_context
{
MYSQLND_CONN_DATA * conn;
@@ -1052,22 +994,20 @@ mysqlnd_com_stmt_send_long_data_run(void *cmd)
/* }}} */
-/* {{{ mysqlnd_com_stmt_send_long_data_create_command */
-static struct st_mysqlnd_protocol_command *
-mysqlnd_com_stmt_send_long_data_create_command(va_list args)
+/* {{{ mysqlnd_com_stmt_send_long_data_run_command */
+static enum_func_status
+mysqlnd_com_stmt_send_long_data_run_command(va_list args)
{
- struct st_mysqlnd_protocol_com_stmt_send_long_data_command * command;
- DBG_ENTER("mysqlnd_com_stmt_send_long_data_create_command");
- command = mnd_ecalloc(1, sizeof(struct st_mysqlnd_protocol_com_stmt_send_long_data_command));
- if (command) {
- command->context.conn = va_arg(args, MYSQLND_CONN_DATA *);
- command->context.payload = va_arg(args, MYSQLND_CSTRING);
-
- command->parent.free_command = mysqlnd_com_no_params_free_command;
- command->parent.run = mysqlnd_com_stmt_send_long_data_run;
- }
+ struct st_mysqlnd_protocol_com_stmt_send_long_data_command command;
+ enum_func_status ret;
- DBG_RETURN((struct st_mysqlnd_protocol_command *) command);
+ DBG_ENTER("mysqlnd_com_stmt_send_long_data_run_command");
+ command.context.conn = va_arg(args, MYSQLND_CONN_DATA *);
+ command.context.payload = va_arg(args, MYSQLND_CSTRING);
+
+ ret = mysqlnd_com_stmt_send_long_data_run(&command);
+
+ DBG_RETURN(ret);
}
/* }}} */
@@ -1075,7 +1015,6 @@ mysqlnd_com_stmt_send_long_data_create_command(va_list args)
/************************** COM_STMT_CLOSE ******************************************/
struct st_mysqlnd_protocol_com_stmt_close_command
{
- struct st_mysqlnd_protocol_command parent;
struct st_mysqlnd_com_stmt_close_context
{
MYSQLND_CONN_DATA * conn;
@@ -1110,22 +1049,20 @@ mysqlnd_com_stmt_close_run(void *cmd)
/* }}} */
-/* {{{ mysqlnd_com_stmt_close_create_command */
-static struct st_mysqlnd_protocol_command *
-mysqlnd_com_stmt_close_create_command(va_list args)
+/* {{{ mysqlnd_com_stmt_close_run_command */
+static enum_func_status
+mysqlnd_com_stmt_close_run_command(va_list args)
{
- struct st_mysqlnd_protocol_com_stmt_close_command * command;
- DBG_ENTER("mysqlnd_com_stmt_close_create_command");
- command = mnd_ecalloc(1, sizeof(struct st_mysqlnd_protocol_com_stmt_close_command));
- if (command) {
- command->context.conn = va_arg(args, MYSQLND_CONN_DATA *);
- command->context.stmt_id = va_arg(args, size_t);
-
- command->parent.free_command = mysqlnd_com_no_params_free_command;
- command->parent.run = mysqlnd_com_stmt_close_run;
- }
+ struct st_mysqlnd_protocol_com_stmt_close_command command;
+ enum_func_status ret;
+
+ DBG_ENTER("mysqlnd_com_stmt_close_run_command");
+ command.context.conn = va_arg(args, MYSQLND_CONN_DATA *);
+ command.context.stmt_id = va_arg(args, size_t);
+
+ ret = mysqlnd_com_stmt_close_run(&command);
- DBG_RETURN((struct st_mysqlnd_protocol_command *) command);
+ DBG_RETURN(ret);
}
/* }}} */
@@ -1134,7 +1071,6 @@ mysqlnd_com_stmt_close_create_command(va_list args)
/************************** COM_ENABLE_SSL ******************************************/
struct st_mysqlnd_protocol_com_enable_ssl_command
{
- struct st_mysqlnd_protocol_command parent;
struct st_mysqlnd_com_enable_ssl_context
{
MYSQLND_CONN_DATA * conn;
@@ -1233,31 +1169,28 @@ close_conn:
/* }}} */
-/* {{{ mysqlnd_com_enable_ssl_create_command */
-static struct st_mysqlnd_protocol_command *
-mysqlnd_com_enable_ssl_create_command(va_list args)
+/* {{{ mysqlnd_com_enable_ssl_run_command */
+static enum_func_status
+mysqlnd_com_enable_ssl_run_command(va_list args)
{
- struct st_mysqlnd_protocol_com_enable_ssl_command * command;
- DBG_ENTER("mysqlnd_com_enable_ssl_create_command");
- command = mnd_ecalloc(1, sizeof(struct st_mysqlnd_protocol_com_enable_ssl_command));
- if (command) {
- command->context.conn = va_arg(args, MYSQLND_CONN_DATA *);
- command->context.client_capabilities = va_arg(args, size_t);
- command->context.server_capabilities = va_arg(args, size_t);
- command->context.charset_no = va_arg(args, unsigned int);
-
- command->parent.free_command = mysqlnd_com_no_params_free_command;
- command->parent.run = mysqlnd_com_enable_ssl_run;
- }
+ struct st_mysqlnd_protocol_com_enable_ssl_command command;
+ enum_func_status ret;
+
+ DBG_ENTER("mysqlnd_com_enable_ssl_run_command");
+ command.context.conn = va_arg(args, MYSQLND_CONN_DATA *);
+ command.context.client_capabilities = va_arg(args, size_t);
+ command.context.server_capabilities = va_arg(args, size_t);
+ command.context.charset_no = va_arg(args, unsigned int);
- DBG_RETURN((struct st_mysqlnd_protocol_command *) command);
+ ret = mysqlnd_com_enable_ssl_run(&command);
+
+ DBG_RETURN(ret);
}
/* }}} */
/************************** COM_READ_HANDSHAKE ******************************************/
struct st_mysqlnd_protocol_com_handshake_command
{
- struct st_mysqlnd_protocol_command parent;
struct st_mysqlnd_com_handshake_context
{
MYSQLND_CONN_DATA * conn;
@@ -1346,99 +1279,97 @@ err:
/* }}} */
-/* {{{ mysqlnd_com_handshake_create_command */
-static struct st_mysqlnd_protocol_command *
-mysqlnd_com_handshake_create_command(va_list args)
+/* {{{ mysqlnd_com_handshake_run_command */
+static enum_func_status
+mysqlnd_com_handshake_run_command(va_list args)
{
- struct st_mysqlnd_protocol_com_handshake_command * command;
- DBG_ENTER("mysqlnd_com_handshake_create_command");
- command = mnd_ecalloc(1, sizeof(struct st_mysqlnd_protocol_com_handshake_command));
- if (command) {
- command->context.conn = va_arg(args, MYSQLND_CONN_DATA *);
- command->context.user = *va_arg(args, const MYSQLND_CSTRING *);
- command->context.passwd = *va_arg(args, const MYSQLND_CSTRING *);
- command->context.database = *va_arg(args, const MYSQLND_CSTRING *);
- command->context.client_flags = va_arg(args, size_t);
-
- command->parent.free_command = mysqlnd_com_no_params_free_command;
- command->parent.run = mysqlnd_com_handshake_run;
- }
+ struct st_mysqlnd_protocol_com_handshake_command command;
+ enum_func_status ret;
+
+ DBG_ENTER("mysqlnd_com_handshake_run_command");
+ command.context.conn = va_arg(args, MYSQLND_CONN_DATA *);
+ command.context.user = *va_arg(args, const MYSQLND_CSTRING *);
+ command.context.passwd = *va_arg(args, const MYSQLND_CSTRING *);
+ command.context.database = *va_arg(args, const MYSQLND_CSTRING *);
+ command.context.client_flags = va_arg(args, size_t);
+
+ ret = mysqlnd_com_handshake_run(&command);
- DBG_RETURN((struct st_mysqlnd_protocol_command *) command);
+ DBG_RETURN(ret);
}
/* }}} */
-/* {{{ mysqlnd_get_command */
-static struct st_mysqlnd_protocol_command *
-mysqlnd_get_command(enum php_mysqlnd_server_command command, ...)
+/* {{{ _mysqlnd_run_command */
+static enum_func_status
+_mysqlnd_run_command(enum php_mysqlnd_server_command command, ...)
{
- struct st_mysqlnd_protocol_command * ret;
+ enum_func_status ret = FAIL;
va_list args;
- DBG_ENTER("mysqlnd_get_command");
+ DBG_ENTER("_mysqlnd_run_command");
va_start(args, command);
switch (command) {
case COM_SET_OPTION:
- ret = mysqlnd_com_set_option_create_command(args);
+ ret = mysqlnd_com_set_option_run_command(args);
break;
case COM_DEBUG:
- ret = mysqlnd_com_debug_create_command(args);
+ ret = mysqlnd_com_debug_run_command(args);
break;
case COM_INIT_DB:
- ret = mysqlnd_com_init_db_create_command(args);
+ ret = mysqlnd_com_init_db_run_command(args);
break;
case COM_PING:
- ret = mysqlnd_com_ping_create_command(args);
+ ret = mysqlnd_com_ping_run_command(args);
break;
case COM_STATISTICS:
- ret = mysqlnd_com_statistics_create_command(args);
+ ret = mysqlnd_com_statistics_run_command(args);
break;
case COM_PROCESS_KILL:
- ret = mysqlnd_com_process_kill_create_command(args);
+ ret = mysqlnd_com_process_kill_run_command(args);
break;
case COM_REFRESH:
- ret = mysqlnd_com_refresh_create_command(args);
+ ret = mysqlnd_com_refresh_run_command(args);
break;
case COM_SHUTDOWN:
- ret = mysqlnd_com_shutdown_create_command(args);
+ ret = mysqlnd_com_shutdown_run_command(args);
break;
case COM_QUIT:
- ret = mysqlnd_com_quit_create_command(args);
+ ret = mysqlnd_com_quit_run_command(args);
break;
case COM_QUERY:
- ret = mysqlnd_com_query_create_command(args);
+ ret = mysqlnd_com_query_run_command(args);
break;
case COM_REAP_RESULT:
- ret = mysqlnd_com_reap_result_create_command(args);
+ ret = mysqlnd_com_reap_result_run_command(args);
break;
case COM_CHANGE_USER:
- ret = mysqlnd_com_change_user_create_command(args);
+ ret = mysqlnd_com_change_user_run_command(args);
break;
case COM_STMT_PREPARE:
- ret = mysqlnd_com_stmt_prepare_create_command(args);
+ ret = mysqlnd_com_stmt_prepare_run_command(args);
break;
case COM_STMT_EXECUTE:
- ret = mysqlnd_com_stmt_execute_create_command(args);
+ ret = mysqlnd_com_stmt_execute_run_command(args);
break;
case COM_STMT_FETCH:
- ret = mysqlnd_com_stmt_fetch_create_command(args);
+ ret = mysqlnd_com_stmt_fetch_run_command(args);
break;
case COM_STMT_RESET:
- ret = mysqlnd_com_stmt_reset_create_command(args);
+ ret = mysqlnd_com_stmt_reset_run_command(args);
break;
case COM_STMT_SEND_LONG_DATA:
- ret = mysqlnd_com_stmt_send_long_data_create_command(args);
+ ret = mysqlnd_com_stmt_send_long_data_run_command(args);
break;
case COM_STMT_CLOSE:
- ret = mysqlnd_com_stmt_close_create_command(args);
+ ret = mysqlnd_com_stmt_close_run_command(args);
break;
case COM_ENABLE_SSL:
- ret = mysqlnd_com_enable_ssl_create_command(args);
+ ret = mysqlnd_com_enable_ssl_run_command(args);
break;
case COM_HANDSHAKE:
- ret = mysqlnd_com_handshake_create_command(args);
+ ret = mysqlnd_com_handshake_run_command(args);
break;
default:
break;
@@ -1448,7 +1379,7 @@ mysqlnd_get_command(enum php_mysqlnd_server_command command, ...)
}
/* }}} */
-func_mysqlnd__command_factory mysqlnd_command_factory = mysqlnd_get_command;
+func_mysqlnd__run_command mysqlnd_run_command = _mysqlnd_run_command;
/*
* Local variables: