MCPcopy Create free account
hub / github.com/MariaDB/server / execute_init_command

Function execute_init_command

sql/sql_parse.cc:940–976  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

938}
939
940void execute_init_command(THD *thd, LEX_STRING *init_command,
941 mysql_rwlock_t *var_lock)
942{
943 Vio* save_vio;
944 ulonglong save_client_capabilities;
945
946 mysql_rwlock_rdlock(var_lock);
947 if (!init_command->length)
948 {
949 mysql_rwlock_unlock(var_lock);
950 return;
951 }
952
953 /*
954 copy the value under a lock, and release the lock.
955 init_command has to be executed without a lock held,
956 as it may try to change itself
957 */
958 size_t len= init_command->length;
959 char *buf= thd->strmake(init_command->str, len);
960 mysql_rwlock_unlock(var_lock);
961
962 THD_STAGE_INFO(thd, stage_execution_of_init_command);
963 save_client_capabilities= thd->client_capabilities;
964 thd->client_capabilities|= CLIENT_MULTI_QUERIES;
965 /*
966 We don't need return result of execution to client side.
967 To forbid this we should set thd->net.vio to 0.
968 */
969 save_vio= thd->net.vio;
970 thd->net.vio= 0;
971 thd->clear_error(1);
972 dispatch_command(COM_QUERY, thd, buf, (uint)len);
973 thd->client_capabilities= save_client_capabilities;
974 thd->net.vio= save_vio;
975
976}
977
978
979static char *fgets_fn(char *buffer, size_t size, fgets_input_t input, int *error)

Callers 2

handle_slave_sqlFunction · 0.85

Calls 2

strmakeMethod · 0.80
clear_errorMethod · 0.45

Tested by

no test coverage detected