summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mysql-test/r/func_str.result53
-rw-r--r--mysql-test/suite/plugins/r/locales.result36
-rw-r--r--mysql-test/t/func_str.test36
-rw-r--r--sql/sql_locale.cc74
4 files changed, 144 insertions, 55 deletions
diff --git a/mysql-test/r/func_str.result b/mysql-test/r/func_str.result
index f9346a25151..207f9650abb 100644
--- a/mysql-test/r/func_str.result
+++ b/mysql-test/r/func_str.result
@@ -4845,5 +4845,58 @@ SELECT NULL IN (RIGHT(AES_ENCRYPT('foo','bar'), LAST_INSERT_ID()), 'qux');
NULL IN (RIGHT(AES_ENCRYPT('foo','bar'), LAST_INSERT_ID()), 'qux')
NULL
#
+# Bug#31374305 - FORMAT() NOT DISPLAYING WHOLE NUMBER SIDE CORRECTLY
+# FOR ES_MX AND ES_ES LOCALES
+#
+CREATE PROCEDURE load_locale_format_table()
+BEGIN
+DECLARE locale_list VARCHAR(1000) DEFAULT '
+ es_AR,es_BO,es_CL,es_CO,es_CR,es_DO,es_EC,es_ES,es_GT,es_HN,
+ es_MX,es_NI,es_PA,es_PE,es_PR,es_PY,es_SV,es_US,es_UY,es_VE';
+SET @fmt_stmt = 'INSERT INTO locale_format VALUES
+ (?, FORMAT(12131254123412541,2,?));';
+PREPARE stmt FROM @fmt_stmt;
+WHILE locale_list != '' DO
+/* get the first locale from the list */
+SET @locale =
+TRIM(REPLACE((SUBSTRING_INDEX(locale_list, ',', 1)), '\n',''));
+EXECUTE stmt USING @locale, @locale;
+/* remove the first locale from the list */
+IF LOCATE(',', locale_list) > 0 THEN
+SET locale_list =
+SUBSTRING(locale_list, LOCATE(',', locale_list) + 1);
+ELSE
+SET locale_list = '';
+END IF;
+END WHILE;
+DEALLOCATE PREPARE stmt;
+END|
+CREATE TABLE locale_format(locale VARCHAR(10), formatted_string VARCHAR(100));
+CALL load_locale_format_table();
+SELECT * FROM locale_format;
+locale formatted_string
+es_AR 12.131.254.123.412.541,00
+es_BO 12.131.254.123.412.541,00
+es_CL 12.131.254.123.412.541,00
+es_CO 12.131.254.123.412.541,00
+es_CR 12 131 254 123 412 541,00
+es_DO 12,131,254,123,412,541.00
+es_EC 12.131.254.123.412.541,00
+es_ES 12.131.254.123.412.541,00
+es_GT 12,131,254,123,412,541.00
+es_HN 12,131,254,123,412,541.00
+es_MX 12,131,254,123,412,541.00
+es_NI 12,131,254,123,412,541.00
+es_PA 12,131,254,123,412,541.00
+es_PE 12,131,254,123,412,541.00
+es_PR 12,131,254,123,412,541.00
+es_PY 12.131.254.123.412.541,00
+es_SV 12,131,254,123,412,541.00
+es_US 12,131,254,123,412,541.00
+es_UY 12.131.254.123.412.541,00
+es_VE 12.131.254.123.412.541,00
+DROP PROCEDURE load_locale_format_table;
+DROP TABLE locale_format;
+#
# End of 10.2 tests
#
diff --git a/mysql-test/suite/plugins/r/locales.result b/mysql-test/suite/plugins/r/locales.result
index 106bf22923c..2ea88493705 100644
--- a/mysql-test/suite/plugins/r/locales.result
+++ b/mysql-test/suite/plugins/r/locales.result
@@ -17,7 +17,7 @@ ID NAME DESCRIPTION MAX_MONTH_NAME_LENGTH MAX_DAY_NAME_LENGTH DECIMAL_POINT THOU
14 cs_CZ Czech - Czech Republic 8 7 , czech
15 da_DK Danish - Denmark 9 7 , . danish
16 de_AT German - Austria 9 10 , german
-17 es_ES Spanish - Spain 10 9 , spanish
+17 es_ES Spanish - Spain 10 9 , . spanish
18 et_EE Estonian - Estonia 9 9 , estonian
19 eu_ES Basque - Basque 9 10 , english
20 fi_FI Finnish - Finland 9 11 , english
@@ -82,24 +82,24 @@ ID NAME DESCRIPTION MAX_MONTH_NAME_LENGTH MAX_DAY_NAME_LENGTH DECIMAL_POINT THOU
79 en_ZA English - South Africa 9 9 . , english
80 en_ZW English - Zimbabwe 9 9 . , english
81 es_AR Spanish - Argentina 10 9 , . spanish
-82 es_BO Spanish - Bolivia 10 9 , spanish
-83 es_CL Spanish - Chile 10 9 , spanish
-84 es_CO Spanish - Columbia 10 9 , spanish
-85 es_CR Spanish - Costa Rica 10 9 . spanish
-86 es_DO Spanish - Dominican Republic 10 9 . spanish
-87 es_EC Spanish - Ecuador 10 9 , spanish
-88 es_GT Spanish - Guatemala 10 9 . spanish
-89 es_HN Spanish - Honduras 10 9 . spanish
-90 es_MX Spanish - Mexico 10 9 . spanish
-91 es_NI Spanish - Nicaragua 10 9 . spanish
-92 es_PA Spanish - Panama 10 9 . spanish
-93 es_PE Spanish - Peru 10 9 . spanish
-94 es_PR Spanish - Puerto Rico 10 9 . spanish
-95 es_PY Spanish - Paraguay 10 9 , spanish
-96 es_SV Spanish - El Salvador 10 9 . spanish
+82 es_BO Spanish - Bolivia 10 9 , . spanish
+83 es_CL Spanish - Chile 10 9 , . spanish
+84 es_CO Spanish - Columbia 10 9 , . spanish
+85 es_CR Spanish - Costa Rica 10 9 , spanish
+86 es_DO Spanish - Dominican Republic 10 9 . , spanish
+87 es_EC Spanish - Ecuador 10 9 , . spanish
+88 es_GT Spanish - Guatemala 10 9 . , spanish
+89 es_HN Spanish - Honduras 10 9 . , spanish
+90 es_MX Spanish - Mexico 10 9 . , spanish
+91 es_NI Spanish - Nicaragua 10 9 . , spanish
+92 es_PA Spanish - Panama 10 9 . , spanish
+93 es_PE Spanish - Peru 10 9 . , spanish
+94 es_PR Spanish - Puerto Rico 10 9 . , spanish
+95 es_PY Spanish - Paraguay 10 9 , . spanish
+96 es_SV Spanish - El Salvador 10 9 . , spanish
97 es_US Spanish - United States 10 9 . , spanish
-98 es_UY Spanish - Uruguay 10 9 , spanish
-99 es_VE Spanish - Venezuela 10 9 , spanish
+98 es_UY Spanish - Uruguay 10 9 , . spanish
+99 es_VE Spanish - Venezuela 10 9 , . spanish
100 fr_BE French - Belgium 9 8 , . french
101 fr_CA French - Canada 9 8 , french
102 fr_CH French - Switzerland 9 8 , french
diff --git a/mysql-test/t/func_str.test b/mysql-test/t/func_str.test
index 366aacb1945..06c62d1b902 100644
--- a/mysql-test/t/func_str.test
+++ b/mysql-test/t/func_str.test
@@ -1944,6 +1944,42 @@ DROP TABLE t1;
SELECT NULL IN (RIGHT(AES_ENCRYPT('foo','bar'), LAST_INSERT_ID()), 'qux');
+--echo #
+--echo # Bug#31374305 - FORMAT() NOT DISPLAYING WHOLE NUMBER SIDE CORRECTLY
+--echo # FOR ES_MX AND ES_ES LOCALES
+--echo #
+
+DELIMITER |;
+CREATE PROCEDURE load_locale_format_table()
+BEGIN
+ DECLARE locale_list VARCHAR(1000) DEFAULT '
+ es_AR,es_BO,es_CL,es_CO,es_CR,es_DO,es_EC,es_ES,es_GT,es_HN,
+ es_MX,es_NI,es_PA,es_PE,es_PR,es_PY,es_SV,es_US,es_UY,es_VE';
+ SET @fmt_stmt = 'INSERT INTO locale_format VALUES
+ (?, FORMAT(12131254123412541,2,?));';
+ PREPARE stmt FROM @fmt_stmt;
+ WHILE locale_list != '' DO
+ /* get the first locale from the list */
+ SET @locale =
+ TRIM(REPLACE((SUBSTRING_INDEX(locale_list, ',', 1)), '\n',''));
+ EXECUTE stmt USING @locale, @locale;
+ /* remove the first locale from the list */
+ IF LOCATE(',', locale_list) > 0 THEN
+ SET locale_list =
+ SUBSTRING(locale_list, LOCATE(',', locale_list) + 1);
+ ELSE
+ SET locale_list = '';
+ END IF;
+ END WHILE;
+ DEALLOCATE PREPARE stmt;
+END|
+DELIMITER ;|
+
+CREATE TABLE locale_format(locale VARCHAR(10), formatted_string VARCHAR(100));
+CALL load_locale_format_table();
+SELECT * FROM locale_format;
+DROP PROCEDURE load_locale_format_table;
+DROP TABLE locale_format;
--echo #
--echo # End of 10.2 tests
diff --git a/sql/sql_locale.cc b/sql/sql_locale.cc
index cc4bc0c175d..39ef6b22d13 100644
--- a/sql/sql_locale.cc
+++ b/sql/sql_locale.cc
@@ -564,8 +564,8 @@ MY_LOCALE my_locale_es_ES
10,
9,
',', /* decimal point es_ES */
- '\0', /* thousands_sep es_ES */
- "\x80\x80", /* grouping es_ES */
+ '.', /* thousands_sep es_ES */
+ "\x03\x03", /* grouping es_ES */
&global_errmsgs[es_ES]
);
/***** LOCALE END es_ES *****/
@@ -2650,8 +2650,8 @@ MY_LOCALE my_locale_es_BO
10,
9,
',', /* decimal point es_BO */
- '\0', /* thousands_sep es_BO */
- "\x80\x80", /* grouping es_BO */
+ '.', /* thousands_sep es_BO */
+ "\x03\x03", /* grouping es_BO */
&global_errmsgs[es_ES]
);
/***** LOCALE END es_BO *****/
@@ -2670,8 +2670,8 @@ MY_LOCALE my_locale_es_CL
10,
9,
',', /* decimal point es_CL */
- '\0', /* thousands_sep es_CL */
- "\x80\x80", /* grouping es_CL */
+ '.', /* thousands_sep es_CL */
+ "\x03\x03", /* grouping es_CL */
&global_errmsgs[es_ES]
);
/***** LOCALE END es_CL *****/
@@ -2690,8 +2690,8 @@ MY_LOCALE my_locale_es_CO
10,
9,
',', /* decimal point es_CO */
- '\0', /* thousands_sep es_CO */
- "\x80\x80", /* grouping es_CO */
+ '.', /* thousands_sep es_CO */
+ "\x03\x03", /* grouping es_CO */
&global_errmsgs[es_ES]
);
/***** LOCALE END es_CO *****/
@@ -2709,9 +2709,9 @@ MY_LOCALE my_locale_es_CR
&my_locale_typelib_ab_day_names_es_ES,
10,
9,
- '.', /* decimal point es_CR */
- '\0', /* thousands_sep es_CR */
- "\x80\x80", /* grouping es_CR */
+ ',', /* decimal point es_CR */
+ ' ', /* thousands_sep es_CR */
+ "\x03\x03", /* grouping es_CR */
&global_errmsgs[es_ES]
);
/***** LOCALE END es_CR *****/
@@ -2730,8 +2730,8 @@ MY_LOCALE my_locale_es_DO
10,
9,
'.', /* decimal point es_DO */
- '\0', /* thousands_sep es_DO */
- "\x80\x80", /* grouping es_DO */
+ ',', /* thousands_sep es_DO */
+ "\x03\x03", /* grouping es_DO */
&global_errmsgs[es_ES]
);
/***** LOCALE END es_DO *****/
@@ -2750,8 +2750,8 @@ MY_LOCALE my_locale_es_EC
10,
9,
',', /* decimal point es_EC */
- '\0', /* thousands_sep es_EC */
- "\x80\x80", /* grouping es_EC */
+ '.', /* thousands_sep es_EC */
+ "\x03\x03", /* grouping es_EC */
&global_errmsgs[es_ES]
);
/***** LOCALE END es_EC *****/
@@ -2770,8 +2770,8 @@ MY_LOCALE my_locale_es_GT
10,
9,
'.', /* decimal point es_GT */
- '\0', /* thousands_sep es_GT */
- "\x80\x80", /* grouping es_GT */
+ ',', /* thousands_sep es_GT */
+ "\x03\x03", /* grouping es_GT */
&global_errmsgs[es_ES]
);
/***** LOCALE END es_GT *****/
@@ -2790,8 +2790,8 @@ MY_LOCALE my_locale_es_HN
10,
9,
'.', /* decimal point es_HN */
- '\0', /* thousands_sep es_HN */
- "\x80\x80", /* grouping es_HN */
+ ',', /* thousands_sep es_HN */
+ "\x03\x03", /* grouping es_HN */
&global_errmsgs[es_ES]
);
/***** LOCALE END es_HN *****/
@@ -2810,8 +2810,8 @@ MY_LOCALE my_locale_es_MX
10,
9,
'.', /* decimal point es_MX */
- '\0', /* thousands_sep es_MX */
- "\x80\x80", /* grouping es_MX */
+ ',', /* thousands_sep es_MX */
+ "\x03\x03", /* grouping es_MX */
&global_errmsgs[es_ES]
);
/***** LOCALE END es_MX *****/
@@ -2830,8 +2830,8 @@ MY_LOCALE my_locale_es_NI
10,
9,
'.', /* decimal point es_NI */
- '\0', /* thousands_sep es_NI */
- "\x80\x80", /* grouping es_NI */
+ ',', /* thousands_sep es_NI */
+ "\x03\x03", /* grouping es_NI */
&global_errmsgs[es_ES]
);
/***** LOCALE END es_NI *****/
@@ -2850,8 +2850,8 @@ MY_LOCALE my_locale_es_PA
10,
9,
'.', /* decimal point es_PA */
- '\0', /* thousands_sep es_PA */
- "\x80\x80", /* grouping es_PA */
+ ',', /* thousands_sep es_PA */
+ "\x03\x03", /* grouping es_PA */
&global_errmsgs[es_ES]
);
/***** LOCALE END es_PA *****/
@@ -2870,8 +2870,8 @@ MY_LOCALE my_locale_es_PE
10,
9,
'.', /* decimal point es_PE */
- '\0', /* thousands_sep es_PE */
- "\x80\x80", /* grouping es_PE */
+ ',', /* thousands_sep es_PE */
+ "\x03\x03", /* grouping es_PE */
&global_errmsgs[es_ES]
);
/***** LOCALE END es_PE *****/
@@ -2890,8 +2890,8 @@ MY_LOCALE my_locale_es_PR
10,
9,
'.', /* decimal point es_PR */
- '\0', /* thousands_sep es_PR */
- "\x80\x80", /* grouping es_PR */
+ ',', /* thousands_sep es_PR */
+ "\x03\x03", /* grouping es_PR */
&global_errmsgs[es_ES]
);
/***** LOCALE END es_PR *****/
@@ -2910,8 +2910,8 @@ MY_LOCALE my_locale_es_PY
10,
9,
',', /* decimal point es_PY */
- '\0', /* thousands_sep es_PY */
- "\x80\x80", /* grouping es_PY */
+ '.', /* thousands_sep es_PY */
+ "\x03\x03", /* grouping es_PY */
&global_errmsgs[es_ES]
);
/***** LOCALE END es_PY *****/
@@ -2930,8 +2930,8 @@ MY_LOCALE my_locale_es_SV
10,
9,
'.', /* decimal point es_SV */
- '\0', /* thousands_sep es_SV */
- "\x80\x80", /* grouping es_SV */
+ ',', /* thousands_sep es_SV */
+ "\x03\x03", /* grouping es_SV */
&global_errmsgs[es_ES]
);
/***** LOCALE END es_SV *****/
@@ -2970,8 +2970,8 @@ MY_LOCALE my_locale_es_UY
10,
9,
',', /* decimal point es_UY */
- '\0', /* thousands_sep es_UY */
- "\x80\x80", /* grouping es_UY */
+ '.', /* thousands_sep es_UY */
+ "\x03\x03", /* grouping es_UY */
&global_errmsgs[es_ES]
);
/***** LOCALE END es_UY *****/
@@ -2990,8 +2990,8 @@ MY_LOCALE my_locale_es_VE
10,
9,
',', /* decimal point es_VE */
- '\0', /* thousands_sep es_VE */
- "\x80\x80", /* grouping es_VE */
+ '.', /* thousands_sep es_VE */
+ "\x03\x03", /* grouping es_VE */
&global_errmsgs[es_ES]
);
/***** LOCALE END es_VE *****/