mirror of
https://github.com/MariaDB/server.git
synced 2025-07-27 18:02:13 +03:00
be less annoying about sysvar-based table attributes
do not *always* add them to the create table definition, but only when a sysvar value is different from a default. also, when adding them - don't quote numbers
This commit is contained in:
@ -307,6 +307,7 @@ public:
|
||||
virtual void global_save_default(THD *thd, set_var *var) {}
|
||||
bool session_update(THD *thd, set_var *var);
|
||||
bool global_update(THD *thd, set_var *var);
|
||||
bool session_is_default(THD *thd);
|
||||
};
|
||||
|
||||
|
||||
@ -3340,6 +3341,39 @@ uchar* sys_var_pluginvar::real_value_ptr(THD *thd, enum_var_type type)
|
||||
}
|
||||
|
||||
|
||||
bool sys_var_pluginvar::session_is_default(THD *thd)
|
||||
{
|
||||
uchar *value= plugin_var->flags & PLUGIN_VAR_THDLOCAL
|
||||
? intern_sys_var_ptr(thd, *(int*) (plugin_var+1), true)
|
||||
: *(uchar**) (plugin_var+1);
|
||||
|
||||
real_value_ptr(thd, OPT_SESSION);
|
||||
|
||||
switch (plugin_var->flags & PLUGIN_VAR_TYPEMASK) {
|
||||
case PLUGIN_VAR_BOOL:
|
||||
return option.def_value == *(my_bool*)value;
|
||||
case PLUGIN_VAR_INT:
|
||||
return option.def_value == *(int*)value;
|
||||
case PLUGIN_VAR_LONG:
|
||||
case PLUGIN_VAR_ENUM:
|
||||
return option.def_value == *(long*)value;
|
||||
case PLUGIN_VAR_LONGLONG:
|
||||
case PLUGIN_VAR_SET:
|
||||
return option.def_value == *(longlong*)value;
|
||||
case PLUGIN_VAR_STR:
|
||||
{
|
||||
const char *a=(char*)option.def_value;
|
||||
const char *b=(char*)value;
|
||||
return (!a && !b) || (a && b && strcmp(a,b));
|
||||
}
|
||||
case PLUGIN_VAR_DOUBLE:
|
||||
return getopt_ulonglong2double(option.def_value) == *(double*)value;
|
||||
default:
|
||||
DBUG_ASSERT(0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
TYPELIB* sys_var_pluginvar::plugin_var_typelib(void)
|
||||
{
|
||||
switch (plugin_var->flags & (PLUGIN_VAR_TYPEMASK | PLUGIN_VAR_THDLOCAL)) {
|
||||
|
Reference in New Issue
Block a user