summaryrefslogtreecommitdiff
path: root/sql/sql_locale.cc
diff options
context:
space:
mode:
authorAlexander Barkov <bar@mysql.com>2009-10-29 15:10:36 +0400
committerAlexander Barkov <bar@mysql.com>2009-10-29 15:10:36 +0400
commit18f63cbcb91dd10c1144f6bff165e5ab57fa0bf1 (patch)
treec4a9dece357a6f4fbdb3893eeb89dc8d4e49895f /sql/sql_locale.cc
parenteff49de23e87dabb17b07b74f04b104748df8517 (diff)
downloadmariadb-git-18f63cbcb91dd10c1144f6bff165e5ab57fa0bf1.tar.gz
A postfix for Bug#46633 Obsolete Serbian locale name
Re-Allowing sr_YU with a "deprecated" warning.
Diffstat (limited to 'sql/sql_locale.cc')
-rw-r--r--sql/sql_locale.cc71
1 files changed, 65 insertions, 6 deletions
diff --git a/sql/sql_locale.cc b/sql/sql_locale.cc
index e6b12d0e38b..6b027c62b81 100644
--- a/sql/sql_locale.cc
+++ b/sql/sql_locale.cc
@@ -1733,6 +1733,24 @@ static TYPELIB my_locale_typelib_day_names_sr_RS =
{ array_elements(my_locale_day_names_sr_RS)-1, "", my_locale_day_names_sr_RS, NULL };
static TYPELIB my_locale_typelib_ab_day_names_sr_RS =
{ array_elements(my_locale_ab_day_names_sr_RS)-1, "", my_locale_ab_day_names_sr_RS, NULL };
+MY_LOCALE my_locale_sr_YU /* Deprecated, use sr_RS instead */
+(
+ 48,
+ "sr_YU",
+ "Serbian - Yugoslavia",
+ FALSE,
+ &my_locale_typelib_month_names_sr_RS,
+ &my_locale_typelib_ab_month_names_sr_RS,
+ &my_locale_typelib_day_names_sr_RS,
+ &my_locale_typelib_ab_day_names_sr_RS,
+ 9,
+ 10,
+ '.', /* decimal point sr_RS */
+ '\0', /* thousands_sep sr_RS */
+ "\x80", /* grouping sr_RS */
+ &global_errmsgs[sr_RS]
+);
+
MY_LOCALE my_locale_sr_RS
(
48,
@@ -3347,6 +3365,13 @@ MY_LOCALE *my_locales[]=
};
+MY_LOCALE *my_locales_deprecated[]=
+{
+ &my_locale_sr_YU,
+ NULL
+};
+
+
MY_LOCALE *my_locale_by_number(uint number)
{
MY_LOCALE *locale;
@@ -3359,22 +3384,56 @@ MY_LOCALE *my_locale_by_number(uint number)
}
-MY_LOCALE *my_locale_by_name(const char *name)
+static MY_LOCALE*
+my_locale_by_name(MY_LOCALE** locales, const char *name)
{
MY_LOCALE **locale;
- for (locale= my_locales; *locale != NULL; locale++)
+ for (locale= locales; *locale != NULL; locale++)
{
if (!my_strcasecmp(&my_charset_latin1, (*locale)->name, name))
- {
- // Check that locale is on its correct position in the array
- DBUG_ASSERT((*locale) == my_locales[(*locale)->number]);
return *locale;
- }
}
return NULL;
}
+MY_LOCALE *my_locale_by_name(const char *name)
+{
+ MY_LOCALE *locale;
+
+ if ((locale= my_locale_by_name(my_locales, name)))
+ {
+ // Check that locale is on its correct position in the array
+ DBUG_ASSERT(locale == my_locales[locale->number]);
+ return locale;
+ }
+ else if ((locale= my_locale_by_name(my_locales_deprecated, name)))
+ {
+ THD *thd= current_thd;
+ /*
+ Replace the deprecated locale to the corresponding
+ 'fresh' locale with the same ID.
+ */
+ locale= my_locales[locale->number];
+ if (thd)
+ {
+ // Send a warning to the client
+ push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
+ ER_WARN_DEPRECATED_SYNTAX, ER(ER_WARN_DEPRECATED_SYNTAX),
+ name, locale->name);
+ }
+ else
+ {
+ // Send a warning to mysqld error log
+ sql_print_warning("The syntax '%s' is deprecated and will be removed. "
+ "Please use %s instead.",
+ name, locale->name);
+ }
+ }
+ return locale;
+}
+
+
void cleanup_errmsgs()
{
for (MY_LOCALE_ERRMSGS *msgs= global_errmsgs; msgs->language; msgs++)