Commit 9ecec1f7 authored by Sergei Golubchik's avatar Sergei Golubchik

cleanup: old_mode_deprecated

make it easier to add more old-mode values
parent fd3b7f5e
......@@ -4183,7 +4183,7 @@ static int init_common_variables()
myf utf8_flag= global_system_variables.old_behavior &
OLD_MODE_UTF8_IS_UTF8MB3 ? MY_UTF8_IS_UTF8MB3 : 0;
old_mode_deprecated_warnings(0, global_system_variables.old_behavior);
old_mode_deprecated_warnings(global_system_variables.old_behavior);
if (character_set_collations_str[0])
{
......
......@@ -210,7 +210,7 @@ enum enum_binlog_row_image {
#define OLD_MODE_DEFAULT_VALUE OLD_MODE_UTF8_IS_UTF8MB3
void old_mode_deprecated_warnings(THD *thd, ulonglong v);
void old_mode_deprecated_warnings(ulonglong v);
extern char internal_table_name[2];
extern char empty_c_string[1];
......
......@@ -3947,34 +3947,33 @@ static Sys_var_set Sys_sql_mode(
static const char *old_mode_names[]=
{
"NO_DUP_KEY_WARNINGS_WITH_IGNORE", // deprecated since 11.3
"NO_PROGRESS_INFO", // deprecated since 11.3
"ZERO_DATE_TIME_CAST", // deprecated since 11.3
"UTF8_IS_UTF8MB3",
"IGNORE_INDEX_ONLY_FOR_JOIN", // deprecated since 11.3
"COMPAT_5_1_CHECKSUM", // deprecated since 11.3
"NO_NULL_COLLATION_IDS", // deprecated since 11.3
"LOCK_ALTER_TABLE_COPY", // deprecated since 11.3
"NO_DUP_KEY_WARNINGS_WITH_IGNORE", // 0: deprecated since 11.3
"NO_PROGRESS_INFO", // 1: deprecated since 11.3
"ZERO_DATE_TIME_CAST", // 2: deprecated since 11.3
"UTF8_IS_UTF8MB3", // 3: on by default
"IGNORE_INDEX_ONLY_FOR_JOIN", // 4: deprecated since 11.3
"COMPAT_5_1_CHECKSUM", // 5: deprecated since 11.3
"NO_NULL_COLLATION_IDS", // 6: deprecated since 11.3
"LOCK_ALTER_TABLE_COPY", // 7: deprecated since 11.3
0
};
void old_mode_deprecated_warnings(THD *thd, ulonglong v)
void old_mode_deprecated_warnings(ulonglong v)
{
v &= ~OLD_MODE_DEFAULT_VALUE;
for (uint i=0; old_mode_names[i]; i++)
if ((1ULL<<i) & v)
{
if (thd)
warn_deprecated<1103>(thd, old_mode_names[i]);
else
sql_print_warning("--old-mode='%s' is deprecated and will be "
"removed in a future release", old_mode_names[i]);
}
sql_print_warning("--old-mode='%s' is deprecated and will be "
"removed in a future release", old_mode_names[i]);
}
static bool old_mode_deprecated(sys_var *self, THD *thd, set_var *var)
{
old_mode_deprecated_warnings(thd, var->save_result.ulonglong_value);
ulonglong v= var->save_result.ulonglong_value & ~OLD_MODE_DEFAULT_VALUE;
uint i= 0;
for (; i <= 7; i++)
if ((1ULL<<i) & v)
warn_deprecated<1103>(thd, old_mode_names[i]);
return false;
}
......
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