Commit e967e810 authored by Alexey Botchkov's avatar Alexey Botchkov Committed by Nayuta Yanagisawa

MDEV-27233 Fixes to make SQL SERVICE working

parent 3905c12b
......@@ -5630,6 +5630,7 @@ class Protocol_local : public Protocol_text
MEM_ROOT *alloc;
THD *new_thd;
Security_context empty_ctx;
ulonglong client_capabilities;
my_bool do_log_bin;
......@@ -6257,6 +6258,7 @@ loc_advanced_command(MYSQL *mysql, enum enum_server_command command,
{
Ed_connection con(p->thd);
Security_context *ctx_orig= p->thd->security_ctx;
ulonglong cap_orig= p->thd->client_capabilities;
MYSQL_LEX_STRING sql_text;
my_bool log_bin_orig;
p->set_binlog_vars(&log_bin_orig);
......@@ -6265,7 +6267,9 @@ loc_advanced_command(MYSQL *mysql, enum enum_server_command command,
sql_text.str= (char *) arg;
sql_text.length= arg_length;
p->thd->security_ctx= &p->empty_ctx;
p->thd->client_capabilities= p->client_capabilities;
result= con.execute_direct(p, sql_text);
p->thd->client_capabilities= cap_orig;
p->thd->security_ctx= ctx_orig;
p->restore_binlog_vars(log_bin_orig);
}
......@@ -6391,6 +6395,7 @@ extern "C" MYSQL *mysql_real_connect_local(MYSQL *mysql)
THD *thd_orig= current_thd;
THD *new_thd;
Protocol_local *p;
ulonglong client_flag;
DBUG_ENTER("mysql_real_connect_local");
/* Test whether we're already connected */
......@@ -6402,6 +6407,9 @@ extern "C" MYSQL *mysql_real_connect_local(MYSQL *mysql)
mysql->methods= &local_methods;
mysql->user= NULL;
client_flag= mysql->options.client_flag;
client_flag|= CLIENT_MULTI_RESULTS;;
client_flag&= ~(CLIENT_COMPRESS | CLIENT_PLUGIN_AUTH);
mysql->info_buffer= (char *) my_malloc(PSI_INSTRUMENT_ME,
MYSQL_ERRMSG_SIZE, MYF(0));
......@@ -6425,6 +6433,7 @@ extern "C" MYSQL *mysql_real_connect_local(MYSQL *mysql)
new_thd->variables.wsrep_on= 0;
new_thd->variables.sql_log_bin= 0;
new_thd->set_binlog_bit();
new_thd->client_capabilities= client_flag;
/*
TOSO: decide if we should turn the auditing off
......@@ -6446,6 +6455,7 @@ extern "C" MYSQL *mysql_real_connect_local(MYSQL *mysql)
{
p->empty_ctx.init();
p->empty_ctx.skip_grants();
p->client_capabilities= client_flag;
}
mysql->thd= p;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment