mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
Merge branch '10.4' into 10.5
This commit is contained in:
@ -3530,6 +3530,30 @@ ulonglong get_status_vars_version(void)
|
||||
return status_var_array_version;
|
||||
}
|
||||
|
||||
/**
|
||||
A union holding a pointer to a type that can be referred by a status variable.
|
||||
*/
|
||||
union Any_pointer {
|
||||
const void *as_void;
|
||||
const uchar *as_uchar;
|
||||
const char *as_char;
|
||||
const char ** as_charptr;
|
||||
const double *as_double;
|
||||
const int * as_int;
|
||||
const uint * as_uint;
|
||||
const long *as_long;
|
||||
const longlong *as_longlong;
|
||||
const bool *as_bool;
|
||||
const my_bool *as_my_bool;
|
||||
const sys_var *as_sys_var;
|
||||
const system_status_var *as_system_status_var;
|
||||
const ha_rows *as_ha_rows;
|
||||
const LEX_STRING *as_lex_cstring;
|
||||
const SHOW_COMP_OPTION *as_show_comp_options;
|
||||
intptr as_intptr;
|
||||
Atomic_counter<uint32_t>* as_atomic_counter;
|
||||
};
|
||||
|
||||
/**
|
||||
@brief Returns the value of a system or a status variable.
|
||||
|
||||
@ -3553,16 +3577,18 @@ const char* get_one_variable(THD *thd,
|
||||
const CHARSET_INFO **charset, char *buff,
|
||||
size_t *length)
|
||||
{
|
||||
void *value= variable->value;
|
||||
Any_pointer value, status_var_value;
|
||||
value.as_void= variable->value;
|
||||
status_var_value.as_system_status_var= status_var;
|
||||
const char *pos= buff;
|
||||
const char *end= buff;
|
||||
|
||||
|
||||
if (show_type == SHOW_SYS)
|
||||
{
|
||||
sys_var *var= (sys_var *) value;
|
||||
const sys_var *var= value.as_sys_var;
|
||||
show_type= var->show_type();
|
||||
value= var->value_ptr(thd, value_type, &null_clex_str);
|
||||
value.as_uchar= var->value_ptr(thd, value_type, &null_clex_str);
|
||||
*charset= var->charset(thd);
|
||||
}
|
||||
|
||||
@ -3572,72 +3598,71 @@ const char* get_one_variable(THD *thd,
|
||||
*/
|
||||
switch (show_type) {
|
||||
case SHOW_DOUBLE_STATUS:
|
||||
value= ((char *) status_var + (intptr) value);
|
||||
value.as_char= status_var_value.as_char + value.as_intptr;
|
||||
/* fall through */
|
||||
case SHOW_DOUBLE:
|
||||
/* 6 is the default precision for '%f' in sprintf() */
|
||||
end= buff + my_fcvt(*(double *) value, 6, buff, NULL);
|
||||
end= buff + my_fcvt(*value.as_double, 6, buff, NULL);
|
||||
break;
|
||||
case SHOW_LONG_STATUS:
|
||||
value= ((char *) status_var + (intptr) value);
|
||||
value.as_char= status_var_value.as_char + value.as_intptr;
|
||||
/* fall through */
|
||||
case SHOW_ULONG:
|
||||
case SHOW_LONG_NOFLUSH: // the difference lies in refresh_status()
|
||||
#ifndef _WIN64
|
||||
case SHOW_SIZE_T:
|
||||
#endif
|
||||
end= int10_to_str(*(long*) value, buff, 10);
|
||||
end= int10_to_str(*value.as_long, buff, 10);
|
||||
break;
|
||||
case SHOW_LONGLONG_STATUS:
|
||||
value= ((char *) status_var + (intptr) value);
|
||||
value.as_char= status_var_value.as_char + value.as_intptr;
|
||||
/* fall through */
|
||||
case SHOW_ULONGLONG:
|
||||
#ifdef _WIN64
|
||||
case SHOW_SIZE_T:
|
||||
#endif
|
||||
end= longlong10_to_str(*(longlong*) value, buff, 10);
|
||||
end= longlong10_to_str(*value.as_longlong, buff, 10);
|
||||
break;
|
||||
case SHOW_HA_ROWS:
|
||||
end= longlong10_to_str((longlong) *(ha_rows*) value, buff, 10);
|
||||
end= longlong10_to_str((longlong) *value.as_ha_rows, buff, 10);
|
||||
break;
|
||||
case SHOW_BOOL:
|
||||
end= strmov(buff, *(bool*) value ? "ON" : "OFF");
|
||||
end= strmov(buff, *value.as_bool ? "ON" : "OFF");
|
||||
break;
|
||||
case SHOW_MY_BOOL:
|
||||
end= strmov(buff, *(my_bool*) value ? "ON" : "OFF");
|
||||
end= strmov(buff, *value.as_my_bool ? "ON" : "OFF");
|
||||
break;
|
||||
case SHOW_UINT32_STATUS:
|
||||
value= ((char *) status_var + (intptr) value);
|
||||
value.as_char= status_var_value.as_char + value.as_intptr;
|
||||
/* fall through */
|
||||
case SHOW_UINT:
|
||||
end= int10_to_str((long) *(uint*) value, buff, 10);
|
||||
end= int10_to_str((long) *value.as_uint, buff, 10);
|
||||
break;
|
||||
case SHOW_SINT:
|
||||
end= int10_to_str((long) *(int*) value, buff, -10);
|
||||
end= int10_to_str((long) *value.as_int, buff, -10);
|
||||
break;
|
||||
case SHOW_SLONG:
|
||||
end= int10_to_str(*(long*) value, buff, -10);
|
||||
end= int10_to_str(*value.as_long, buff, -10);
|
||||
break;
|
||||
case SHOW_SLONGLONG:
|
||||
end= longlong10_to_str(*(longlong*) value, buff, -10);
|
||||
end= longlong10_to_str(*value.as_longlong, buff, -10);
|
||||
break;
|
||||
case SHOW_HAVE:
|
||||
{
|
||||
SHOW_COMP_OPTION tmp= *(SHOW_COMP_OPTION*) value;
|
||||
pos= show_comp_option_name[(int) tmp];
|
||||
pos= show_comp_option_name[(int) *value.as_show_comp_options];
|
||||
end= strend(pos);
|
||||
break;
|
||||
}
|
||||
case SHOW_CHAR:
|
||||
{
|
||||
if (!(pos= (char*)value))
|
||||
if (!(pos= value.as_char))
|
||||
pos= "";
|
||||
end= strend(pos);
|
||||
break;
|
||||
}
|
||||
case SHOW_CHAR_PTR:
|
||||
{
|
||||
if (!(pos= *(char**) value))
|
||||
if (!(pos= *value.as_charptr))
|
||||
pos= "";
|
||||
|
||||
end= strend(pos);
|
||||
@ -3645,17 +3670,14 @@ const char* get_one_variable(THD *thd,
|
||||
}
|
||||
case SHOW_LEX_STRING:
|
||||
{
|
||||
LEX_STRING *ls=(LEX_STRING*)value;
|
||||
if (!(pos= ls->str))
|
||||
if (!(pos= value.as_lex_cstring->str))
|
||||
end= pos= "";
|
||||
else
|
||||
end= pos + ls->length;
|
||||
end= pos + value.as_lex_cstring->length;
|
||||
break;
|
||||
}
|
||||
case SHOW_ATOMIC_COUNTER_UINT32_T:
|
||||
end= int10_to_str(
|
||||
static_cast<long>(*static_cast<Atomic_counter<uint32_t>*>(value)),
|
||||
buff, 10);
|
||||
end= int10_to_str(static_cast<long>(*value.as_atomic_counter), buff, 10);
|
||||
break;
|
||||
case SHOW_UNDEF:
|
||||
break; // Return empty string
|
||||
@ -6665,6 +6687,16 @@ static int get_schema_stat_record(THD *thd, TABLE_LIST *tables,
|
||||
LEX_CSTRING unknown= {STRING_WITH_LEN("?unknown field?") };
|
||||
for (uint j=0 ; j < key_info->user_defined_key_parts ; j++,key_part++)
|
||||
{
|
||||
if (key_part->field->invisible >= INVISIBLE_SYSTEM &&
|
||||
DBUG_EVALUATE_IF("test_completely_invisible", 0, 1))
|
||||
{
|
||||
/*
|
||||
NOTE: we will get SEQ_IN_INDEX gap inside the result if this key_part
|
||||
is not last (currently not possible). Though nothing is wrong with
|
||||
that probably.
|
||||
*/
|
||||
continue;
|
||||
}
|
||||
restore_record(table, s->default_values);
|
||||
table->field[0]->store(STRING_WITH_LEN("def"), cs);
|
||||
table->field[1]->store(db_name->str, db_name->length, cs);
|
||||
|
Reference in New Issue
Block a user