1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

WL#7076: Backporting wl6715 to support both formats

in 5.5, 5.6, 5.7.
This commit is contained in:
Ashish Agarwal
2013-08-23 09:07:09 +05:30
17 changed files with 295 additions and 123 deletions

View File

@ -3088,6 +3088,44 @@ SHOW_VAR com_status_vars[]= {
{NullS, NullS, SHOW_LONG}
};
LEX_CSTRING sql_statement_names[(uint) SQLCOM_END + 1];
void init_sql_statement_names()
{
static LEX_CSTRING empty= { C_STRING_WITH_LEN("") };
char *first_com= (char*) offsetof(STATUS_VAR, com_stat[0]);
char *last_com= (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_END]);
int record_size= (char*) offsetof(STATUS_VAR, com_stat[1])
- (char*) offsetof(STATUS_VAR, com_stat[0]);
char *ptr;
uint i;
uint com_index;
for (i= 0; i < ((uint) SQLCOM_END + 1); i++)
sql_statement_names[i]= empty;
SHOW_VAR *var= &com_status_vars[0];
while (var->name != NULL)
{
ptr= var->value;
if ((first_com <= ptr) && (ptr <= last_com))
{
com_index= ((int)(ptr - first_com))/record_size;
DBUG_ASSERT(com_index < (uint) SQLCOM_END);
sql_statement_names[com_index].str= var->name;
/* TODO: Change SHOW_VAR::name to a LEX_STRING, to avoid strlen() */
sql_statement_names[com_index].length= strlen(var->name);
}
var++;
}
DBUG_ASSERT(strcmp(sql_statement_names[(uint) SQLCOM_SELECT].str, "select") == 0);
DBUG_ASSERT(strcmp(sql_statement_names[(uint) SQLCOM_SIGNAL].str, "signal") == 0);
sql_statement_names[(uint) SQLCOM_END].str= "error";
}
/**
Create the name of the default general log file
@ -4284,6 +4322,7 @@ int mysqld_main(int argc, char **argv)
/* Must be initialized early for comparison of options name */
system_charset_info= &my_charset_utf8_general_ci;
init_sql_statement_names();
sys_var_init();
#ifdef WITH_PERFSCHEMA_STORAGE_ENGINE
@ -5366,7 +5405,7 @@ void handle_connections_sockets()
continue;
}
if (sock == unix_sock)
thd->security_ctx->host=(char*) my_localhost;
thd->security_ctx->set_host((char*) my_localhost);
create_new_thread(thd);
}
@ -5470,7 +5509,7 @@ pthread_handler_t handle_connections_namedpipes(void *arg)
continue;
}
/* Host is unknown */
thd->security_ctx->host= my_strdup(my_localhost, MYF(0));
thd->security_ctx->set_host(my_strdup(my_localhost, MYF(0)));
create_new_thread(thd);
}
CloseHandle(connectOverlapped.hEvent);
@ -5664,7 +5703,7 @@ pthread_handler_t handle_connections_shared_memory(void *arg)
errmsg= 0;
goto errorconn;
}
thd->security_ctx->host= my_strdup(my_localhost, MYF(0)); /* Host is unknown */
thd->security_ctx->set_host(my_strdup(my_localhost, MYF(0))); /* Host is unknown */
create_new_thread(thd);
connect_number++;
continue;