summaryrefslogtreecommitdiff
path: root/sql/set_var.cc
diff options
context:
space:
mode:
authorMartin Hansson <martin.hansson@oracle.com>2012-08-24 10:17:08 +0200
committerMartin Hansson <martin.hansson@oracle.com>2012-08-24 10:17:08 +0200
commitdf2bdd6063e1a9a05be0048a309288dc4d7a8ce4 (patch)
treef1359d24de152fb5cf9bff589dee79d0124ab9f3 /sql/set_var.cc
parent17695cb4ffcddb9634a9e27c459eab943ceae36e (diff)
downloadmariadb-git-df2bdd6063e1a9a05be0048a309288dc4d7a8ce4.tar.gz
Bug#14498355: DEPRECATION WARNINGS SHOULD NOT CONTAIN MYSQL VERSION
NUMBERS If a system variable was declared as deprecated without mention of an alternative, the message would look funny, e.g. for @@delayed_insert_limit: Warning 1287 '@@delayed_insert_limit' is deprecated and will be removed in MySQL . The message was meant to display the version number, but it's not possible to give one when declaring a system variable. The fix does two things: 1) The definition of the message ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT is changed so that it does not display a version number. I.e. in English the message now reads: Warning 1287 The syntax '@@delayed_insert_limit' is deprecated and will be removed in a future version. 2) The message ER_WARN_DEPRECATED_SYNTAX_WITH_VER is discontinued in favor of ER_WARN_DEPRECATED_SYNTAX for system variables. This change was already done in versions 5.6 and above as part of wl#5265. This part is simply back-ported from the worklog.
Diffstat (limited to 'sql/set_var.cc')
-rw-r--r--sql/set_var.cc37
1 files changed, 17 insertions, 20 deletions
diff --git a/sql/set_var.cc b/sql/set_var.cc
index 4cdee8e1258..231fbb47d35 100644
--- a/sql/set_var.cc
+++ b/sql/set_var.cc
@@ -134,9 +134,9 @@ void sys_var_end()
put your additional checks here
@param on_update_func a function to be called at the end of sys_var::update,
any post-update activity should happen here
- @param deprecated_version if not 0 - when this variable will go away
- @param substitute if not 0 - what one should use instead when this
- deprecated variable
+ @param substitute If non-NULL, this variable is deprecated and the
+ string describes what one should use instead. If an empty string,
+ the variable is deprecated but no replacement is offered.
@param parse_flag either PARSE_EARLY or PARSE_NORMAL
*/
sys_var::sys_var(sys_var_chain *chain, const char *name_arg,
@@ -146,12 +146,12 @@ sys_var::sys_var(sys_var_chain *chain, const char *name_arg,
PolyLock *lock, enum binlog_status_enum binlog_status_arg,
on_check_function on_check_func,
on_update_function on_update_func,
- uint deprecated_version, const char *substitute,
- int parse_flag) :
+ const char *substitute, int parse_flag) :
next(0),
binlog_status(binlog_status_arg),
flags(flags_arg), m_parse_flag(parse_flag), 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)
{
/*
@@ -177,12 +177,6 @@ sys_var::sys_var(sys_var_chain *chain, const char *name_arg,
option.value= (uchar **)global_var_ptr();
option.def_value= def_val;
- deprecated.version= deprecated_version;
- deprecated.substitute= substitute;
- DBUG_ASSERT((deprecated_version != 0) || (substitute == 0));
- DBUG_ASSERT(deprecated_version % 100 == 0);
- DBUG_ASSERT(!deprecated_version || MYSQL_VERSION_ID < deprecated_version);
-
if (chain->last)
chain->last->next= this;
else
@@ -277,21 +271,24 @@ bool sys_var::set_default(THD *thd, enum_var_type type)
void sys_var::do_deprecated_warning(THD *thd)
{
- if (deprecated.version)
+ if (deprecation_substitute != NULL)
{
- char buf1[NAME_CHAR_LEN + 3], buf2[10];
+ char buf1[NAME_CHAR_LEN + 3];
strxnmov(buf1, sizeof(buf1)-1, "@@", name.str, 0);
- my_snprintf(buf2, sizeof(buf2), "%d.%d", deprecated.version/100/100,
- deprecated.version/100%100);
- uint errmsg= deprecated.substitute
- ? ER_WARN_DEPRECATED_SYNTAX_WITH_VER
- : ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT;
+
+ /*
+ if deprecation_substitute is an empty string,
+ there is no replacement for the syntax
+ */
+ uint errmsg= deprecation_substitute[0] == '\0'
+ ? ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT
+ : ER_WARN_DEPRECATED_SYNTAX;
if (thd)
push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
ER_WARN_DEPRECATED_SYNTAX, ER(errmsg),
- buf1, buf2, deprecated.substitute);
+ buf1, deprecation_substitute);
else
- sql_print_warning(ER_DEFAULT(errmsg), buf1, buf2, deprecated.substitute);
+ sql_print_warning(ER_DEFAULT(errmsg), buf1, deprecation_substitute);
}
}