summaryrefslogtreecommitdiff
path: root/sql/mysqld.cc
diff options
context:
space:
mode:
authorSergey Glukhov <Sergey.Glukhov@sun.com>2008-12-23 18:08:04 +0400
committerSergey Glukhov <Sergey.Glukhov@sun.com>2008-12-23 18:08:04 +0400
commitc06df92af647e67731cb3a76bd91d57219407f01 (patch)
tree6e4d53e89ddfb94f9a4c162bc2a2cffb3cede106 /sql/mysqld.cc
parent7658444b9716497fcbad8de74478f52ba3f37ca9 (diff)
downloadmariadb-git-c06df92af647e67731cb3a76bd91d57219407f01.tar.gz
Bug#37575 UCASE fails on monthname
The MONTHNAME/DAYNAME functions returns binary string, so the LOWER/UPPER functions are not effective on the result of MONTHNAME/DAYNAME call. Character set of the MONTHNAME/DAYNAME function result has been changed to connection character set. include/m_ctype.h: added my_charset_repertoire function mysql-test/r/ctype_ucs.result: test result mysql-test/r/func_time.result: test result mysql-test/t/ctype_ucs.test: test case mysql-test/t/func_time.test: test case sql/item_timefunc.cc: Item_func_monthname::fix_length_and_dec and Item_func_dayname::fix_length_and_dec methods have been modified to use connection character set sql/item_timefunc.h: Item_func_monthname::fix_length_and_dec and Item_func_dayname::fix_length_and_dec methods have been modified to use connection character set sql/mysql_priv.h: added max_month_name_length, max_day_name_length fields into MY_LOCALE struct sql/mysqld.cc: The test_lc_time_sz function controls modifications of the locale database in debugging mode. sql/sql_locale.cc: initialization of max_month_name_length, max_day_name_length fields strings/ctype.c: added my_charset_repertoire function
Diffstat (limited to 'sql/mysqld.cc')
-rw-r--r--sql/mysqld.cc42
1 files changed, 42 insertions, 0 deletions
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index 8232cefc880..f5e5b881a37 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -3616,6 +3616,44 @@ void decrement_handler_count()
#endif /* defined(__NT__) || defined(HAVE_SMEM) */
+#ifndef DBUG_OFF
+/*
+ Debugging helper function to keep the locale database
+ (see sql_locale.cc) and max_month_name_length and
+ max_day_name_length variable values in consistent state.
+*/
+static void test_lc_time_sz()
+{
+ DBUG_ENTER("test_lc_time_sz");
+ for (MY_LOCALE **loc= my_locales; *loc; loc++)
+ {
+ uint max_month_len= 0;
+ uint max_day_len = 0;
+ for (const char **month= (*loc)->month_names->type_names; *month; month++)
+ {
+ set_if_bigger(max_month_len,
+ my_numchars_mb(&my_charset_utf8_general_ci,
+ *month, *month + strlen(*month)));
+ }
+ for (const char **day= (*loc)->day_names->type_names; *day; day++)
+ {
+ set_if_bigger(max_day_len,
+ my_numchars_mb(&my_charset_utf8_general_ci,
+ *day, *day + strlen(*day)));
+ }
+ if ((*loc)->max_month_name_length != max_month_len ||
+ (*loc)->max_day_name_length != max_day_len)
+ {
+ DBUG_PRINT("Wrong max day name(or month name) length for locale:",
+ ("%s", (*loc)->name));
+ DBUG_ASSERT(0);
+ }
+ }
+ DBUG_VOID_RETURN;
+}
+#endif//DBUG_OFF
+
+
#ifndef EMBEDDED_LIBRARY
#ifdef __WIN__
int win_main(int argc, char **argv)
@@ -3712,6 +3750,10 @@ int main(int argc, char **argv)
openlog(libwrapName, LOG_PID, LOG_AUTH);
#endif
+#ifndef DBUG_OFF
+ test_lc_time_sz();
+#endif
+
/*
We have enough space for fiddling with the argv, continue
*/