Commit 660355c1 authored by Sergei Golubchik's avatar Sergei Golubchik

bugfix: Item_func_get_system_var::print()

parent 96bb5f44
......@@ -1801,3 +1801,23 @@ select * from information_schema.session_variables where variable_name='sql_mode
VARIABLE_NAME VARIABLE_VALUE
SQL_MODE ANSI_QUOTES
End of 5.5 tests
explain extended select @@VERsion from dual where rand() > @@verSION;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
Note 1003 select @@VERsion AS "@@VERsion" from DUAL where (rand() > @@version)
explain extended select @@SESsion.SQL_mode from dual where rand() > @@sesSION.sql_MODE;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
Note 1003 select @@SESsion.SQL_mode AS "@@SESsion.SQL_mode" from DUAL where (rand() > @@sql_mode)
explain extended select @@GLObal.COLLATION_connection from dual where rand() > @@gloBAL.collation_CONNECTION;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
Note 1003 select @@GLObal.COLLATION_connection AS "@@GLObal.COLLATION_connection" from DUAL where (rand() > @@global.collation_connection)
explain extended select @@FOObar.KEY_BUFfer_size from dual where rand() > @@fooBAR.key_bufFER_SIZE;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
Note 1003 select @@FOObar.KEY_BUFfer_size AS "@@FOObar.KEY_BUFfer_size" from DUAL where (rand() > @@fooBAR.key_buffer_size)
......@@ -1532,3 +1532,11 @@ show global status like 'foobar';
select * from information_schema.session_variables where variable_name='sql_mode';
--echo End of 5.5 tests
#
# test Item_func_get_system_var::print()
#
explain extended select @@VERsion from dual where rand() > @@verSION;
explain extended select @@SESsion.SQL_mode from dual where rand() > @@sesSION.sql_MODE;
explain extended select @@GLObal.COLLATION_connection from dual where rand() > @@gloBAL.collation_CONNECTION;
explain extended select @@FOObar.KEY_BUFfer_size from dual where rand() > @@fooBAR.key_bufFER_SIZE;
......@@ -5841,7 +5841,22 @@ void Item_func_get_system_var::fix_length_and_dec()
void Item_func_get_system_var::print(String *str, enum_query_type query_type)
{
str->append(name, name_length);
if (name_length)
str->append(name, name_length);
else
{
str->append(STRING_WITH_LEN("@@"));
if (component.length)
{
str->append(&component);
str->append('.');
}
else if (var_type == SHOW_OPT_GLOBAL && var->scope() != sys_var::GLOBAL)
{
str->append(STRING_WITH_LEN("global."));
}
str->append(&var->name);
}
}
bool Item_func_get_system_var::check_vcol_func_processor(void *arg)
......
......@@ -466,10 +466,8 @@ class String
}
bool append(const String &s);
bool append(const char *s);
bool append(const LEX_STRING *ls)
{
return append(ls->str, ls->length);
}
bool append(const LEX_STRING *ls) { return append(ls->str, ls->length); }
bool append(const LEX_CSTRING *ls) { return append(ls->str, ls->length); }
bool append(const char *s, uint32 arg_length);
bool append(const char *s, uint32 arg_length, CHARSET_INFO *cs);
bool append_ulonglong(ulonglong val);
......
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