summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Barkov <bar@mysql.com>2009-10-06 11:02:51 +0500
committerAlexander Barkov <bar@mysql.com>2009-10-06 11:02:51 +0500
commit27936529e06368557e1b662d020a87690af200f4 (patch)
treefaf8af7c0ac5bf9f8ea83f0a0562915ed8818ed5
parent636ea6a1c464b247a3665bebac7bf28495ac087a (diff)
downloadmariadb-git-27936529e06368557e1b662d020a87690af200f4.tar.gz
Backporting WL#4642 Greek locale for DAYNAME, MONTHNAME, DATE_FORMAT
added: mysql-test/r/locale.result mysql-test/t/locale.test modified: mysql-test/r/variables.result mysql-test/t/variables.test sql/sql_locale.cc
-rw-r--r--mysql-test/r/locale.result49
-rw-r--r--mysql-test/r/variables.result10
-rw-r--r--mysql-test/t/locale.test34
-rw-r--r--mysql-test/t/variables.test4
-rw-r--r--sql/sql_locale.cc72
5 files changed, 162 insertions, 7 deletions
diff --git a/mysql-test/r/locale.result b/mysql-test/r/locale.result
new file mode 100644
index 00000000000..467eb97b639
--- /dev/null
+++ b/mysql-test/r/locale.result
@@ -0,0 +1,49 @@
+DROP TABLE IF EXISTS t1;
+Start of 5.4 tests
+#
+# WL#4642 Greek locale for DAYNAME, MONTHNAME, DATE_FORMAT
+#
+SET NAMES utf8;
+SET @@lc_time_names=109;
+SELECT @@lc_time_names;
+@@lc_time_names
+el_GR
+CREATE TABLE t1 (a DATE);
+INSERT INTO t1 VALUES
+('2006-01-01'),('2006-01-02'),('2006-01-03'),
+('2006-01-04'),('2006-01-05'),('2006-01-06'),('2006-01-07');
+SELECT a, date_format(a,'%a') as abday, dayname(a) as day FROM t1 ORDER BY a;
+a abday day
+2006-01-01 Κυρ Κυριακή
+2006-01-02 Δευ Δευτέρα
+2006-01-03 Τρί Τρίτη
+2006-01-04 Τετ Τετάρτη
+2006-01-05 Πέμ Πέμπτη
+2006-01-06 Παρ Παρασκευή
+2006-01-07 Σάβ Σάββατο
+DROP TABLE t1;
+CREATE TABLE t1 (a DATE);
+INSERT INTO t1 VALUES
+('2006-01-01'),('2006-02-01'),('2006-03-01'),
+('2006-04-01'),('2006-05-01'),('2006-06-01'),
+('2006-07-01'),('2006-08-01'),('2006-09-01'),
+('2006-10-01'),('2006-11-01'),('2006-12-01');
+SELECT a, date_format(a,'%b') as abmon, monthname(a) as mon FROM t1 ORDER BY a;
+a abmon mon
+2006-01-01 Ιαν Ιανουάριος
+2006-02-01 Φεβ Φεβρουάριος
+2006-03-01 Μάρ Μάρτιος
+2006-04-01 Απρ Απρίλιος
+2006-05-01 Μάι Μάιος
+2006-06-01 Ιούν Ιούνιος
+2006-07-01 Ιούλ Ιούλιος
+2006-08-01 Αύγ Αύγουστος
+2006-09-01 Σεπ Σεπτέμβριος
+2006-10-01 Οκτ Οκτώβριος
+2006-11-01 Νοέ Νοέμβριος
+2006-12-01 Δεκ Δεκέμβριος
+SELECT format(123456.789, 3, 'el_GR');
+format(123456.789, 3, 'el_GR')
+123456.789
+DROP TABLE t1;
+End of 5.4 tests
diff --git a/mysql-test/r/variables.result b/mysql-test/r/variables.result
index c1cd1840df8..da833c79bb7 100644
--- a/mysql-test/r/variables.result
+++ b/mysql-test/r/variables.result
@@ -812,16 +812,16 @@ select @@lc_time_names;
@@lc_time_names
en_US
LC_TIME_NAMES: testing locale with the last ID:
-set lc_time_names=108;
+set lc_time_names=109;
select @@lc_time_names;
@@lc_time_names
-zh_HK
+el_GR
LC_TIME_NAMES: testing a number beyond the valid ID range:
-set lc_time_names=109;
-ERROR HY000: Unknown locale: '109'
+set lc_time_names=110;
+ERROR HY000: Unknown locale: '110'
select @@lc_time_names;
@@lc_time_names
-zh_HK
+el_GR
LC_TIME_NAMES: testing that 0 is en_US:
set lc_time_names=0;
select @@lc_time_names;
diff --git a/mysql-test/t/locale.test b/mysql-test/t/locale.test
new file mode 100644
index 00000000000..a6291d9048d
--- /dev/null
+++ b/mysql-test/t/locale.test
@@ -0,0 +1,34 @@
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+--echo Start of 5.4 tests
+
+--echo #
+--echo # WL#4642 Greek locale for DAYNAME, MONTHNAME, DATE_FORMAT
+--echo #
+
+SET NAMES utf8;
+
+SET @@lc_time_names=109;
+SELECT @@lc_time_names;
+
+CREATE TABLE t1 (a DATE);
+INSERT INTO t1 VALUES
+('2006-01-01'),('2006-01-02'),('2006-01-03'),
+('2006-01-04'),('2006-01-05'),('2006-01-06'),('2006-01-07');
+SELECT a, date_format(a,'%a') as abday, dayname(a) as day FROM t1 ORDER BY a;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a DATE);
+INSERT INTO t1 VALUES
+('2006-01-01'),('2006-02-01'),('2006-03-01'),
+('2006-04-01'),('2006-05-01'),('2006-06-01'),
+('2006-07-01'),('2006-08-01'),('2006-09-01'),
+('2006-10-01'),('2006-11-01'),('2006-12-01');
+SELECT a, date_format(a,'%b') as abmon, monthname(a) as mon FROM t1 ORDER BY a;
+
+SELECT format(123456.789, 3, 'el_GR');
+DROP TABLE t1;
+
+--echo End of 5.4 tests
diff --git a/mysql-test/t/variables.test b/mysql-test/t/variables.test
index a98163e026c..e7d7d5ca16b 100644
--- a/mysql-test/t/variables.test
+++ b/mysql-test/t/variables.test
@@ -576,11 +576,11 @@ set lc_time_names=NULL;
set lc_time_names=-1;
select @@lc_time_names;
--echo LC_TIME_NAMES: testing locale with the last ID:
-set lc_time_names=108;
+set lc_time_names=109;
select @@lc_time_names;
--echo LC_TIME_NAMES: testing a number beyond the valid ID range:
--error ER_UNKNOWN_LOCALE
-set lc_time_names=109;
+set lc_time_names=110;
select @@lc_time_names;
--echo LC_TIME_NAMES: testing that 0 is en_US:
set lc_time_names=0;
diff --git a/sql/sql_locale.cc b/sql/sql_locale.cc
index b59c3f16735..fcfd60e72e6 100644
--- a/sql/sql_locale.cc
+++ b/sql/sql_locale.cc
@@ -3009,6 +3009,77 @@ MY_LOCALE my_locale_zh_HK
/***** LOCALE END zh_HK *****/
+/***** LOCALE BEGIN el_GR: Greek - Greece *****/
+static const char *my_locale_month_names_el_GR[13]=
+{
+ "Ιανουάριος", "Φεβρουάριος", "Μάρτιος",
+ "Απρίλιος", "Μάιος", "Ιούνιος",
+ "Ιούλιος", "Αύγουστος", "Σεπτέμβριος",
+ "Οκτώβριος", "Νοέμβριος", "Δεκέμβριος", NullS
+};
+
+static const char *my_locale_ab_month_names_el_GR[13]=
+{
+ "Ιαν", "Φεβ", "Μάρ",
+ "Απρ", "Μάι", "Ιούν",
+ "Ιούλ","Αύγ", "Σεπ",
+ "Οκτ", "Νοέ", "Δεκ", NullS
+};
+
+static const char *my_locale_day_names_el_GR[8] =
+{
+ "Δευτέρα", "Τρίτη", "Τετάρτη", "Πέμπτη",
+ "Παρασκευή", "Σάββατο", "Κυριακή", NullS
+};
+
+static const char *my_locale_ab_day_names_el_GR[8]=
+{
+ "Δευ", "Τρί", "Τετ", "Πέμ",
+ "Παρ", "Σάβ", "Κυρ", NullS
+};
+
+static TYPELIB my_locale_typelib_month_names_el_GR=
+{
+ array_elements(my_locale_month_names_el_GR) - 1,
+ "", my_locale_month_names_el_GR, NULL
+};
+
+static TYPELIB my_locale_typelib_ab_month_names_el_GR=
+{
+ array_elements(my_locale_ab_month_names_el_GR)-1,
+ "", my_locale_ab_month_names_el_GR, NULL
+};
+
+static TYPELIB my_locale_typelib_day_names_el_GR=
+{
+ array_elements(my_locale_day_names_el_GR)-1,
+ "", my_locale_day_names_el_GR, NULL
+};
+
+static TYPELIB my_locale_typelib_ab_day_names_el_GR=
+{
+ array_elements(my_locale_ab_day_names_el_GR) - 1,
+ "", my_locale_ab_day_names_el_GR, NULL
+};
+
+MY_LOCALE my_locale_el_GR
+(
+ 109,
+ "el_GR",
+ "Greek - Greece",
+ FALSE,
+ &my_locale_typelib_month_names_el_GR,
+ &my_locale_typelib_ab_month_names_el_GR,
+ &my_locale_typelib_day_names_el_GR,
+ &my_locale_typelib_ab_day_names_el_GR,
+ 11, /* max mon name length */
+ 9, /* max day name length */
+ ',', /* decimal point el_GR */
+ '.', /* thousands_sep el_GR */
+ "\x80" /* grouping el_GR */
+);
+/***** LOCALE END el_GR *****/
+
/*
The list of all locales.
Note, locales must be ordered according to their
@@ -3126,6 +3197,7 @@ MY_LOCALE *my_locales[]=
&my_locale_no_NO,
&my_locale_sv_FI,
&my_locale_zh_HK,
+ &my_locale_el_GR,
NULL
};