mirror of
https://github.com/MariaDB/server.git
synced 2025-12-24 11:21:21 +03:00
Don't force column header to @@session.var_name if @@local.var_name
was used. (Bug #10724) mysql-test/r/key_cache.result: Updated results mysql-test/r/ps_1general.result: Updated results mysql-test/r/user_var.result: Add new results mysql-test/r/variables.result: Update results mysql-test/t/user_var.test: Add new regression test sql/item_func.cc: Don't set name explicitly in get_system_var(), let it get set by the select_item: rule in sql_parse.yy or other callers of get_system_var(). sql/sql_parse.cc: Set the name on the Item returned by get_system_var().
This commit is contained in:
@@ -4197,6 +4197,8 @@ void create_select_for_variable(const char *var_name)
|
||||
THD *thd;
|
||||
LEX *lex;
|
||||
LEX_STRING tmp, null_lex_string;
|
||||
Item *var;
|
||||
char buff[MAX_SYS_VAR_LENGTH*2+4+8], *end;
|
||||
DBUG_ENTER("create_select_for_variable");
|
||||
|
||||
thd= current_thd;
|
||||
@@ -4206,8 +4208,14 @@ void create_select_for_variable(const char *var_name)
|
||||
tmp.str= (char*) var_name;
|
||||
tmp.length=strlen(var_name);
|
||||
bzero((char*) &null_lex_string.str, sizeof(null_lex_string));
|
||||
add_item_to_list(thd, get_system_var(thd, OPT_SESSION, tmp,
|
||||
null_lex_string));
|
||||
/*
|
||||
We set the name of Item to @@session.var_name because that then is used
|
||||
as the column name in the output.
|
||||
*/
|
||||
var= get_system_var(thd, OPT_SESSION, tmp, null_lex_string);
|
||||
end= strxmov(buff, "@@session.", var_name, NullS);
|
||||
var->set_name(buff, end-buff, system_charset_info);
|
||||
add_item_to_list(thd, var);
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user