From f1346cf8f6f8d6f557168572c59de7cf58b4ef4f Mon Sep 17 00:00:00 2001 From: "evgen@moonbone.local" <> Date: Sun, 16 Jul 2006 00:45:38 +0400 Subject: Fixed bug#10977: No warning issued if a column name is truncated When an alias is set to a column leading spaces are removed from the alias. But when this is done on aliases set by user this can lead to confusion. Now Item::set_name() method issues the warning if leading spaces were removed from an alias set by user. New warning message is added. --- sql/item.cc | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'sql/item.cc') diff --git a/sql/item.cc b/sql/item.cc index 511ea1ffb44..ad8b79182d4 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -573,6 +573,7 @@ void Item::set_name(const char *str, uint length, CHARSET_INFO *cs) } if (cs->ctype) { + uint orig_len= length; /* This will probably need a better implementation in the future: a function in CHARSET_INFO structure. @@ -582,6 +583,11 @@ void Item::set_name(const char *str, uint length, CHARSET_INFO *cs) length--; str++; } + if (orig_len != length && !is_autogenerated_name) + push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN, + ER_REMOVED_SPACES, ER(ER_REMOVED_SPACES), + str + length - orig_len); + } if (!my_charset_same(cs, system_charset_info)) { -- cgit v1.2.1