Skip to content

Commit

Permalink
MDEV-21956 Add class Sys_var_charptr_fscs
Browse files Browse the repository at this point in the history
Simplifying definitions on Sys_var_charptr*:

- Removing sys_var::is_os_charset
- Adding a new class Sys_var_charptr_fscs, to handle system
  variables with character_set_filesystem.
  • Loading branch information
abarkov committed Mar 17, 2020
1 parent 9cc7edb commit bd6afd8
Show file tree
Hide file tree
Showing 4 changed files with 130 additions and 141 deletions.
9 changes: 1 addition & 8 deletions sql/set_var.cc
Expand Up @@ -154,8 +154,7 @@ sys_var::sys_var(sys_var_chain *chain, const char *name_arg,
next(0), binlog_status(binlog_status_arg), value_origin(COMPILE_TIME),
flags(flags_arg), show_val_type(show_val_type_arg),
guard(lock), offset(off), on_check(on_check_func), on_update(on_update_func),
deprecation_substitute(substitute),
is_os_charset(FALSE)
deprecation_substitute(substitute)
{
/*
There is a limitation in handle_options() related to short options:
Expand Down Expand Up @@ -509,12 +508,6 @@ bool throw_bounds_warning(THD *thd, const char *name, bool fixed, double v)
return false;
}

CHARSET_INFO *sys_var::charset(THD *thd)
{
return is_os_charset ? thd->variables.character_set_filesystem :
system_charset_info;
}


typedef struct old_names_map_st
{
Expand Down
6 changes: 4 additions & 2 deletions sql/set_var.h
Expand Up @@ -90,7 +90,6 @@ class sys_var: protected Value_source // for double_from_string_with_check
on_check_function on_check;
on_update_function on_update;
const char *const deprecation_substitute;
bool is_os_charset; ///< true if the value is in character_set_filesystem

public:
sys_var(sys_var_chain *chain, const char *name_arg, const char *comment,
Expand Down Expand Up @@ -130,7 +129,10 @@ class sys_var: protected Value_source // for double_from_string_with_check

SHOW_TYPE show_type() { return show_val_type; }
int scope() const { return flags & SCOPE_MASK; }
CHARSET_INFO *charset(THD *thd);
virtual CHARSET_INFO *charset(THD *thd) const
{
return system_charset_info;
}
bool is_readonly() const { return flags & READONLY; }
/**
the following is only true for keycache variables,
Expand Down

0 comments on commit bd6afd8

Please sign in to comment.