Commit 4c56dfe9 authored by Alexander Barkov's avatar Alexander Barkov

MDEV-5851 MySQL WL#5303 Romansh locale for DAYNAME, MONTHNAME, DATE_FORMAT

parent 010971a7
...@@ -90,3 +90,99 @@ SELECT DATE_FORMAT('2001-01-07', '%w %a %W'); ...@@ -90,3 +90,99 @@ SELECT DATE_FORMAT('2001-01-07', '%w %a %W');
DATE_FORMAT('2001-01-07', '%w %a %W') DATE_FORMAT('2001-01-07', '%w %a %W')
0 Du Duminică 0 Du Duminică
End of 5.4 tests End of 5.4 tests
#
# Start of 5.6 tests
#
#
# WL#5303 Romansh locale for DAYNAME, MONTHNAME, DATE_FORMAT
#
SET NAMES utf8;
SET @old_50915_lc_time_names := @@lc_time_names;
SET lc_time_names=en_US;
SELECT DATE_FORMAT('2001-01-01', '%w %a %W');
DATE_FORMAT('2001-01-01', '%w %a %W')
1 Mon Monday
SELECT DATE_FORMAT('2001-03-01', '%c %b %M');
DATE_FORMAT('2001-03-01', '%c %b %M')
3 Mar March
SET lc_time_names=rm_CH;
SELECT DATE_FORMAT('2001-01-01', '%w %a %W');
DATE_FORMAT('2001-01-01', '%w %a %W')
1 gli glindesdi
SELECT DATE_FORMAT('2001-01-02', '%w %a %W');
DATE_FORMAT('2001-01-02', '%w %a %W')
2 ma mardi
SELECT DATE_FORMAT('2001-01-03', '%w %a %W');
DATE_FORMAT('2001-01-03', '%w %a %W')
3 me mesemna
SELECT DATE_FORMAT('2001-01-04', '%w %a %W');
DATE_FORMAT('2001-01-04', '%w %a %W')
4 gie gievgia
SELECT DATE_FORMAT('2001-01-05', '%w %a %W');
DATE_FORMAT('2001-01-05', '%w %a %W')
5 ve venderdi
SELECT DATE_FORMAT('2001-01-06', '%w %a %W');
DATE_FORMAT('2001-01-06', '%w %a %W')
6 so sonda
SELECT DATE_FORMAT('2001-01-07', '%w %a %W');
DATE_FORMAT('2001-01-07', '%w %a %W')
0 du dumengia
SELECT DATE_FORMAT('2001-01-01', '%c %b %M');
DATE_FORMAT('2001-01-01', '%c %b %M')
1 schan schaner
SELECT DATE_FORMAT('2001-02-01', '%c %b %M');
DATE_FORMAT('2001-02-01', '%c %b %M')
2 favr favrer
SELECT DATE_FORMAT('2001-03-01', '%c %b %M');
DATE_FORMAT('2001-03-01', '%c %b %M')
3 mars mars
SELECT DATE_FORMAT('2001-04-01', '%c %b %M');
DATE_FORMAT('2001-04-01', '%c %b %M')
4 avr avrigl
SELECT DATE_FORMAT('2001-05-01', '%c %b %M');
DATE_FORMAT('2001-05-01', '%c %b %M')
5 matg matg
SELECT DATE_FORMAT('2001-06-01', '%c %b %M');
DATE_FORMAT('2001-06-01', '%c %b %M')
6 zercl zercladur
SELECT DATE_FORMAT('2001-07-01', '%c %b %M');
DATE_FORMAT('2001-07-01', '%c %b %M')
7 fan fanadur
SELECT DATE_FORMAT('2001-08-01', '%c %b %M');
DATE_FORMAT('2001-08-01', '%c %b %M')
8 avust avust
SELECT DATE_FORMAT('2001-09-01', '%c %b %M');
DATE_FORMAT('2001-09-01', '%c %b %M')
9 sett settember
SELECT DATE_FORMAT('2001-10-01', '%c %b %M');
DATE_FORMAT('2001-10-01', '%c %b %M')
10 oct october
SELECT DATE_FORMAT('2001-11-01', '%c %b %M');
DATE_FORMAT('2001-11-01', '%c %b %M')
11 nov november
SELECT DATE_FORMAT('2001-12-01', '%c %b %M');
DATE_FORMAT('2001-12-01', '%c %b %M')
12 dec december
SET lc_time_names=de_CH;
SELECT DATE_FORMAT('2001-01-06', '%w %a %W');
DATE_FORMAT('2001-01-06', '%w %a %W')
6 Sa Samstag
SELECT DATE_FORMAT('2001-09-01', '%c %b %M');
DATE_FORMAT('2001-09-01', '%c %b %M')
9 Sep September
SELECT DATE_FORMAT('2010-03-23 11:00:00','%h %p');
DATE_FORMAT('2010-03-23 11:00:00','%h %p')
11 AM
SELECT DATE_FORMAT('2010-03-23 13:00:00','%h %p');
DATE_FORMAT('2010-03-23 13:00:00','%h %p')
01 PM
SELECT format(123456789,2,'rm_CH');
format(123456789,2,'rm_CH')
123'456'789,00
SET lc_messages=rm_CH;
SELECT * FROM non_existent;
ERROR 42S02: Table 'test.non_existent' doesn't exist
SET lc_time_names=@old_50915_lc_time_names;
#
# End of 5.6 tests
#
...@@ -801,16 +801,16 @@ select @@lc_time_names; ...@@ -801,16 +801,16 @@ select @@lc_time_names;
@@lc_time_names @@lc_time_names
en_US en_US
LC_TIME_NAMES: testing locale with the last ID: LC_TIME_NAMES: testing locale with the last ID:
set lc_time_names=109; set lc_time_names=110;
select @@lc_time_names; select @@lc_time_names;
@@lc_time_names @@lc_time_names
el_GR rm_CH
LC_TIME_NAMES: testing a number beyond the valid ID range: LC_TIME_NAMES: testing a number beyond the valid ID range:
set lc_time_names=110; set lc_time_names=111;
ERROR HY000: Unknown locale: '110' ERROR HY000: Unknown locale: '111'
select @@lc_time_names; select @@lc_time_names;
@@lc_time_names @@lc_time_names
el_GR rm_CH
LC_TIME_NAMES: testing that 0 is en_US: LC_TIME_NAMES: testing that 0 is en_US:
set lc_time_names=0; set lc_time_names=0;
select @@lc_time_names; select @@lc_time_names;
......
...@@ -110,3 +110,4 @@ ID NAME DESCRIPTION MAX_MONTH_NAME_LENGTH MAX_DAY_NAME_LENGTH DECIMAL_POINT THOU ...@@ -110,3 +110,4 @@ ID NAME DESCRIPTION MAX_MONTH_NAME_LENGTH MAX_DAY_NAME_LENGTH DECIMAL_POINT THOU
107 sv_FI Swedish - Finland 9 7 , swedish 107 sv_FI Swedish - Finland 9 7 , swedish
108 zh_HK Chinese - Hong Kong SAR 3 3 . , english 108 zh_HK Chinese - Hong Kong SAR 3 3 . , english
109 el_GR Greek - Greece 11 9 , . greek 109 el_GR Greek - Greece 11 9 , . greek
110 rm_CH Romansh - Switzerland 9 9 , ' english
...@@ -1022,7 +1022,11 @@ SELECT @@lc_time_names; ...@@ -1022,7 +1022,11 @@ SELECT @@lc_time_names;
@@lc_time_names @@lc_time_names
el_GR el_GR
SET @@lc_time_names = 110; SET @@lc_time_names = 110;
ERROR HY000: Unknown locale: '110' SELECT @@lc_time_names;
@@lc_time_names
rm_CH
SET @@lc_time_names = 111;
ERROR HY000: Unknown locale: '111'
'#--------------------FN_DYNVARS_060_10-------------------------#' '#--------------------FN_DYNVARS_060_10-------------------------#'
SET @@lc_time_names = en_EN; SET @@lc_time_names = en_EN;
ERROR HY000: Unknown locale: 'en_EN' ERROR HY000: Unknown locale: 'en_EN'
......
...@@ -622,8 +622,10 @@ SET @@lc_time_names = 108; ...@@ -622,8 +622,10 @@ SET @@lc_time_names = 108;
SELECT @@lc_time_names; SELECT @@lc_time_names;
SET @@lc_time_names = 109; SET @@lc_time_names = 109;
SELECT @@lc_time_names; SELECT @@lc_time_names;
--Error ER_UNKNOWN_LOCALE
SET @@lc_time_names = 110; SET @@lc_time_names = 110;
SELECT @@lc_time_names;
--Error ER_UNKNOWN_LOCALE
SET @@lc_time_names = 111;
--echo '#--------------------FN_DYNVARS_060_10-------------------------#' --echo '#--------------------FN_DYNVARS_060_10-------------------------#'
############################################################################# #############################################################################
......
...@@ -54,3 +54,60 @@ SELECT DATE_FORMAT('2001-01-05', '%w %a %W'); ...@@ -54,3 +54,60 @@ SELECT DATE_FORMAT('2001-01-05', '%w %a %W');
SELECT DATE_FORMAT('2001-01-06', '%w %a %W'); SELECT DATE_FORMAT('2001-01-06', '%w %a %W');
SELECT DATE_FORMAT('2001-01-07', '%w %a %W'); SELECT DATE_FORMAT('2001-01-07', '%w %a %W');
--echo End of 5.4 tests --echo End of 5.4 tests
--echo #
--echo # Start of 5.6 tests
--echo #
--echo #
--echo # WL#5303 Romansh locale for DAYNAME, MONTHNAME, DATE_FORMAT
--echo #
SET NAMES utf8;
SET @old_50915_lc_time_names := @@lc_time_names;
SET lc_time_names=en_US;
SELECT DATE_FORMAT('2001-01-01', '%w %a %W');
SELECT DATE_FORMAT('2001-03-01', '%c %b %M');
SET lc_time_names=rm_CH;
SELECT DATE_FORMAT('2001-01-01', '%w %a %W');
SELECT DATE_FORMAT('2001-01-02', '%w %a %W');
SELECT DATE_FORMAT('2001-01-03', '%w %a %W');
SELECT DATE_FORMAT('2001-01-04', '%w %a %W');
SELECT DATE_FORMAT('2001-01-05', '%w %a %W');
SELECT DATE_FORMAT('2001-01-06', '%w %a %W');
SELECT DATE_FORMAT('2001-01-07', '%w %a %W');
SELECT DATE_FORMAT('2001-01-01', '%c %b %M');
SELECT DATE_FORMAT('2001-02-01', '%c %b %M');
SELECT DATE_FORMAT('2001-03-01', '%c %b %M');
SELECT DATE_FORMAT('2001-04-01', '%c %b %M');
SELECT DATE_FORMAT('2001-05-01', '%c %b %M');
SELECT DATE_FORMAT('2001-06-01', '%c %b %M');
SELECT DATE_FORMAT('2001-07-01', '%c %b %M');
SELECT DATE_FORMAT('2001-08-01', '%c %b %M');
SELECT DATE_FORMAT('2001-09-01', '%c %b %M');
SELECT DATE_FORMAT('2001-10-01', '%c %b %M');
SELECT DATE_FORMAT('2001-11-01', '%c %b %M');
SELECT DATE_FORMAT('2001-12-01', '%c %b %M');
SET lc_time_names=de_CH;
SELECT DATE_FORMAT('2001-01-06', '%w %a %W');
SELECT DATE_FORMAT('2001-09-01', '%c %b %M');
# Checking AM/PM
SELECT DATE_FORMAT('2010-03-23 11:00:00','%h %p');
SELECT DATE_FORMAT('2010-03-23 13:00:00','%h %p');
# Checking numeric format
SELECT format(123456789,2,'rm_CH');
# Checking that error messages point to en_US.
SET lc_messages=rm_CH;
--error ER_NO_SUCH_TABLE
SELECT * FROM non_existent;
SET lc_time_names=@old_50915_lc_time_names;
--echo #
--echo # End of 5.6 tests
--echo #
...@@ -549,11 +549,11 @@ set lc_time_names=NULL; ...@@ -549,11 +549,11 @@ set lc_time_names=NULL;
set lc_time_names=-1; set lc_time_names=-1;
select @@lc_time_names; select @@lc_time_names;
--echo LC_TIME_NAMES: testing locale with the last ID: --echo LC_TIME_NAMES: testing locale with the last ID:
set lc_time_names=109; set lc_time_names=110;
select @@lc_time_names; select @@lc_time_names;
--echo LC_TIME_NAMES: testing a number beyond the valid ID range: --echo LC_TIME_NAMES: testing a number beyond the valid ID range:
--error ER_UNKNOWN_LOCALE --error ER_UNKNOWN_LOCALE
set lc_time_names=110; set lc_time_names=111;
select @@lc_time_names; select @@lc_time_names;
--echo LC_TIME_NAMES: testing that 0 is en_US: --echo LC_TIME_NAMES: testing that 0 is en_US:
set lc_time_names=0; set lc_time_names=0;
......
...@@ -3247,6 +3247,75 @@ MY_LOCALE my_locale_el_GR ...@@ -3247,6 +3247,75 @@ MY_LOCALE my_locale_el_GR
); );
/***** LOCALE END el_GR *****/ /***** LOCALE END el_GR *****/
/***** LOCALE BEGIN rm_CH: Romansh - Switzerland *****/
static const char *my_locale_month_names_rm_CH[13]=
{
"schaner", "favrer", "mars", "avrigl", "matg", "zercladur",
"fanadur", "avust", "settember", "october", "november", "december", NullS
};
static const char *my_locale_ab_month_names_rm_CH[13]=
{
"schan", "favr", "mars", "avr", "matg", "zercl",
"fan", "avust", "sett", "oct", "nov", "dec", NullS
};
static const char *my_locale_day_names_rm_CH[8]=
{
"glindesdi", "mardi", "mesemna", "gievgia",
"venderdi", "sonda", "dumengia", NullS
};
static const char *my_locale_ab_day_names_rm_CH[8]=
{
"gli", "ma", "me", "gie", "ve", "so", "du", NullS
};
static TYPELIB my_locale_typelib_month_names_rm_CH=
{
array_elements(my_locale_month_names_rm_CH) - 1,
"", my_locale_month_names_rm_CH, NULL
};
static TYPELIB my_locale_typelib_ab_month_names_rm_CH=
{
array_elements(my_locale_ab_month_names_rm_CH) - 1,
"", my_locale_ab_month_names_rm_CH, NULL
};
static TYPELIB my_locale_typelib_day_names_rm_CH=
{
array_elements(my_locale_day_names_rm_CH) - 1,
"", my_locale_day_names_rm_CH, NULL
};
static TYPELIB my_locale_typelib_ab_day_names_rm_CH=
{
array_elements(my_locale_ab_day_names_rm_CH) - 1,
"", my_locale_ab_day_names_rm_CH, NULL
};
MY_LOCALE my_locale_rm_CH
(
110,
"rm_CH",
"Romansh - Switzerland",
FALSE,
&my_locale_typelib_month_names_rm_CH,
&my_locale_typelib_ab_month_names_rm_CH,
&my_locale_typelib_day_names_rm_CH,
&my_locale_typelib_ab_day_names_rm_CH,
9, /* max mon name length */
9, /* max day name length */
',', /* decimal point rm_CH */
'\'', /* thousands_sep rm_CH */
"\x03\x03", /* grouping rm_CH */
&global_errmsgs[en_US]
);
/***** LOCALE END rm_CH *****/
/* /*
The list of all locales. The list of all locales.
Note, locales must be ordered according to their Note, locales must be ordered according to their
...@@ -3365,6 +3434,7 @@ MY_LOCALE *my_locales[]= ...@@ -3365,6 +3434,7 @@ MY_LOCALE *my_locales[]=
&my_locale_sv_FI, &my_locale_sv_FI,
&my_locale_zh_HK, &my_locale_zh_HK,
&my_locale_el_GR, &my_locale_el_GR,
&my_locale_rm_CH,
NULL NULL
}; };
......
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