Skip to content

Commit ccee087

Browse files
author
Maheedhar PV
committed
Bug#31374305 - FORMAT() NOT DISPLAYING WHOLE NUMBER SIDE CORRECTLY FOR
ES_MX AND ES_ES LOCALES Changed the grouping and decimal separator for spanish locales as per ICU. Change-Id: I5d80fa59d3e66372d904e17c22c532d4dd2c565b
1 parent 5d19c81 commit ccee087

File tree

3 files changed

+127
-37
lines changed

3 files changed

+127
-37
lines changed

mysql-test/r/func_str.result

+53
Original file line numberDiff line numberDiff line change
@@ -4828,3 +4828,56 @@ SELECT 1 FROM t WHERE WEIGHT_STRING(CONCAT('',''));
48284828
1
48294829
SET NAMES DEFAULT;
48304830
DROP TABLE t;
4831+
#
4832+
# Bug#31374305 - FORMAT() NOT DISPLAYING WHOLE NUMBER SIDE CORRECTLY
4833+
# FOR ES_MX AND ES_ES LOCALES
4834+
#
4835+
CREATE PROCEDURE load_locale_format_table()
4836+
BEGIN
4837+
DECLARE locale_list VARCHAR(1000) DEFAULT '
4838+
es_AR,es_BO,es_CL,es_CO,es_CR,es_DO,es_EC,es_ES,es_GT,es_HN,
4839+
es_MX,es_NI,es_PA,es_PE,es_PR,es_PY,es_SV,es_US,es_UY,es_VE';
4840+
SET @fmt_stmt = 'INSERT INTO locale_format VALUES
4841+
(?, FORMAT(12131254123412541,2,?));';
4842+
PREPARE stmt FROM @fmt_stmt;
4843+
WHILE locale_list != '' DO
4844+
/* get the first locale from the list */
4845+
SET @locale =
4846+
TRIM(REPLACE((SUBSTRING_INDEX(locale_list, ',', 1)), '\n',''));
4847+
EXECUTE stmt USING @locale, @locale;
4848+
/* remove the first locale from the list */
4849+
IF LOCATE(',', locale_list) > 0 THEN
4850+
SET locale_list =
4851+
SUBSTRING(locale_list, LOCATE(',', locale_list) + 1);
4852+
ELSE
4853+
SET locale_list = '';
4854+
END IF;
4855+
END WHILE;
4856+
DEALLOCATE PREPARE stmt;
4857+
END|
4858+
CREATE TABLE locale_format(locale VARCHAR(10), formatted_string VARCHAR(100));
4859+
CALL load_locale_format_table();
4860+
SELECT * FROM locale_format;
4861+
locale formatted_string
4862+
es_AR 12.131.254.123.412.541,00
4863+
es_BO 12.131.254.123.412.541,00
4864+
es_CL 12.131.254.123.412.541,00
4865+
es_CO 12.131.254.123.412.541,00
4866+
es_CR 12 131 254 123 412 541,00
4867+
es_DO 12,131,254,123,412,541.00
4868+
es_EC 12.131.254.123.412.541,00
4869+
es_ES 12.131.254.123.412.541,00
4870+
es_GT 12,131,254,123,412,541.00
4871+
es_HN 12,131,254,123,412,541.00
4872+
es_MX 12,131,254,123,412,541.00
4873+
es_NI 12,131,254,123,412,541.00
4874+
es_PA 12,131,254,123,412,541.00
4875+
es_PE 12,131,254,123,412,541.00
4876+
es_PR 12,131,254,123,412,541.00
4877+
es_PY 12.131.254.123.412.541,00
4878+
es_SV 12,131,254,123,412,541.00
4879+
es_US 12,131,254,123,412,541.00
4880+
es_UY 12.131.254.123.412.541,00
4881+
es_VE 12.131.254.123.412.541,00
4882+
DROP PROCEDURE load_locale_format_table;
4883+
DROP TABLE locale_format;

mysql-test/t/func_str.test

+37
Original file line numberDiff line numberDiff line change
@@ -1884,3 +1884,40 @@ SELECT 1 FROM t WHERE WEIGHT_STRING(CONCAT_WS('1',''));
18841884
SELECT 1 FROM t WHERE WEIGHT_STRING(CONCAT('',''));
18851885
SET NAMES DEFAULT;
18861886
DROP TABLE t;
1887+
1888+
--echo #
1889+
--echo # Bug#31374305 - FORMAT() NOT DISPLAYING WHOLE NUMBER SIDE CORRECTLY
1890+
--echo # FOR ES_MX AND ES_ES LOCALES
1891+
--echo #
1892+
1893+
DELIMITER |;
1894+
CREATE PROCEDURE load_locale_format_table()
1895+
BEGIN
1896+
DECLARE locale_list VARCHAR(1000) DEFAULT '
1897+
es_AR,es_BO,es_CL,es_CO,es_CR,es_DO,es_EC,es_ES,es_GT,es_HN,
1898+
es_MX,es_NI,es_PA,es_PE,es_PR,es_PY,es_SV,es_US,es_UY,es_VE';
1899+
SET @fmt_stmt = 'INSERT INTO locale_format VALUES
1900+
(?, FORMAT(12131254123412541,2,?));';
1901+
PREPARE stmt FROM @fmt_stmt;
1902+
WHILE locale_list != '' DO
1903+
/* get the first locale from the list */
1904+
SET @locale =
1905+
TRIM(REPLACE((SUBSTRING_INDEX(locale_list, ',', 1)), '\n',''));
1906+
EXECUTE stmt USING @locale, @locale;
1907+
/* remove the first locale from the list */
1908+
IF LOCATE(',', locale_list) > 0 THEN
1909+
SET locale_list =
1910+
SUBSTRING(locale_list, LOCATE(',', locale_list) + 1);
1911+
ELSE
1912+
SET locale_list = '';
1913+
END IF;
1914+
END WHILE;
1915+
DEALLOCATE PREPARE stmt;
1916+
END|
1917+
DELIMITER ;|
1918+
1919+
CREATE TABLE locale_format(locale VARCHAR(10), formatted_string VARCHAR(100));
1920+
CALL load_locale_format_table();
1921+
SELECT * FROM locale_format;
1922+
DROP PROCEDURE load_locale_format_table;
1923+
DROP TABLE locale_format;

sql/sql_locale.cc

+37-37
Original file line numberDiff line numberDiff line change
@@ -568,8 +568,8 @@ MY_LOCALE my_locale_es_ES
568568
10,
569569
9,
570570
',', /* decimal point es_ES */
571-
'\0', /* thousands_sep es_ES */
572-
"\x80\x80", /* grouping es_ES */
571+
'.', /* thousands_sep es_ES */
572+
"\x03\x03", /* grouping es_ES */
573573
&global_errmsgs[es_ES]
574574
);
575575
/***** LOCALE END es_ES *****/
@@ -2654,8 +2654,8 @@ MY_LOCALE my_locale_es_BO
26542654
10,
26552655
9,
26562656
',', /* decimal point es_BO */
2657-
'\0', /* thousands_sep es_BO */
2658-
"\x80\x80", /* grouping es_BO */
2657+
'.', /* thousands_sep es_BO */
2658+
"\x03\x03", /* grouping es_BO */
26592659
&global_errmsgs[es_ES]
26602660
);
26612661
/***** LOCALE END es_BO *****/
@@ -2674,8 +2674,8 @@ MY_LOCALE my_locale_es_CL
26742674
10,
26752675
9,
26762676
',', /* decimal point es_CL */
2677-
'\0', /* thousands_sep es_CL */
2678-
"\x80\x80", /* grouping es_CL */
2677+
'.', /* thousands_sep es_CL */
2678+
"\x03\x03", /* grouping es_CL */
26792679
&global_errmsgs[es_ES]
26802680
);
26812681
/***** LOCALE END es_CL *****/
@@ -2694,8 +2694,8 @@ MY_LOCALE my_locale_es_CO
26942694
10,
26952695
9,
26962696
',', /* decimal point es_CO */
2697-
'\0', /* thousands_sep es_CO */
2698-
"\x80\x80", /* grouping es_CO */
2697+
'.', /* thousands_sep es_CO */
2698+
"\x03\x03", /* grouping es_CO */
26992699
&global_errmsgs[es_ES]
27002700
);
27012701
/***** LOCALE END es_CO *****/
@@ -2713,9 +2713,9 @@ MY_LOCALE my_locale_es_CR
27132713
&my_locale_typelib_ab_day_names_es_ES,
27142714
10,
27152715
9,
2716-
'.', /* decimal point es_CR */
2717-
'\0', /* thousands_sep es_CR */
2718-
"\x80\x80", /* grouping es_CR */
2716+
',', /* decimal point es_CR */
2717+
' ', /* thousands_sep es_CR */
2718+
"\x03\x03", /* grouping es_CR */
27192719
&global_errmsgs[es_ES]
27202720
);
27212721
/***** LOCALE END es_CR *****/
@@ -2734,8 +2734,8 @@ MY_LOCALE my_locale_es_DO
27342734
10,
27352735
9,
27362736
'.', /* decimal point es_DO */
2737-
'\0', /* thousands_sep es_DO */
2738-
"\x80\x80", /* grouping es_DO */
2737+
',', /* thousands_sep es_DO */
2738+
"\x03\x03", /* grouping es_DO */
27392739
&global_errmsgs[es_ES]
27402740
);
27412741
/***** LOCALE END es_DO *****/
@@ -2754,8 +2754,8 @@ MY_LOCALE my_locale_es_EC
27542754
10,
27552755
9,
27562756
',', /* decimal point es_EC */
2757-
'\0', /* thousands_sep es_EC */
2758-
"\x80\x80", /* grouping es_EC */
2757+
'.', /* thousands_sep es_EC */
2758+
"\x03\x03", /* grouping es_EC */
27592759
&global_errmsgs[es_ES]
27602760
);
27612761
/***** LOCALE END es_EC *****/
@@ -2774,8 +2774,8 @@ MY_LOCALE my_locale_es_GT
27742774
10,
27752775
9,
27762776
'.', /* decimal point es_GT */
2777-
'\0', /* thousands_sep es_GT */
2778-
"\x80\x80", /* grouping es_GT */
2777+
',', /* thousands_sep es_GT */
2778+
"\x03\x03", /* grouping es_GT */
27792779
&global_errmsgs[es_ES]
27802780
);
27812781
/***** LOCALE END es_GT *****/
@@ -2794,8 +2794,8 @@ MY_LOCALE my_locale_es_HN
27942794
10,
27952795
9,
27962796
'.', /* decimal point es_HN */
2797-
'\0', /* thousands_sep es_HN */
2798-
"\x80\x80", /* grouping es_HN */
2797+
',', /* thousands_sep es_HN */
2798+
"\x03\x03", /* grouping es_HN */
27992799
&global_errmsgs[es_ES]
28002800
);
28012801
/***** LOCALE END es_HN *****/
@@ -2814,8 +2814,8 @@ MY_LOCALE my_locale_es_MX
28142814
10,
28152815
9,
28162816
'.', /* decimal point es_MX */
2817-
'\0', /* thousands_sep es_MX */
2818-
"\x80\x80", /* grouping es_MX */
2817+
',', /* thousands_sep es_MX */
2818+
"\x03\x03", /* grouping es_MX */
28192819
&global_errmsgs[es_ES]
28202820
);
28212821
/***** LOCALE END es_MX *****/
@@ -2834,8 +2834,8 @@ MY_LOCALE my_locale_es_NI
28342834
10,
28352835
9,
28362836
'.', /* decimal point es_NI */
2837-
'\0', /* thousands_sep es_NI */
2838-
"\x80\x80", /* grouping es_NI */
2837+
',', /* thousands_sep es_NI */
2838+
"\x03\x03", /* grouping es_NI */
28392839
&global_errmsgs[es_ES]
28402840
);
28412841
/***** LOCALE END es_NI *****/
@@ -2854,8 +2854,8 @@ MY_LOCALE my_locale_es_PA
28542854
10,
28552855
9,
28562856
'.', /* decimal point es_PA */
2857-
'\0', /* thousands_sep es_PA */
2858-
"\x80\x80", /* grouping es_PA */
2857+
',', /* thousands_sep es_PA */
2858+
"\x03\x03", /* grouping es_PA */
28592859
&global_errmsgs[es_ES]
28602860
);
28612861
/***** LOCALE END es_PA *****/
@@ -2874,8 +2874,8 @@ MY_LOCALE my_locale_es_PE
28742874
10,
28752875
9,
28762876
'.', /* decimal point es_PE */
2877-
'\0', /* thousands_sep es_PE */
2878-
"\x80\x80", /* grouping es_PE */
2877+
',', /* thousands_sep es_PE */
2878+
"\x03\x03", /* grouping es_PE */
28792879
&global_errmsgs[es_ES]
28802880
);
28812881
/***** LOCALE END es_PE *****/
@@ -2894,8 +2894,8 @@ MY_LOCALE my_locale_es_PR
28942894
10,
28952895
9,
28962896
'.', /* decimal point es_PR */
2897-
'\0', /* thousands_sep es_PR */
2898-
"\x80\x80", /* grouping es_PR */
2897+
',', /* thousands_sep es_PR */
2898+
"\x03\x03", /* grouping es_PR */
28992899
&global_errmsgs[es_ES]
29002900
);
29012901
/***** LOCALE END es_PR *****/
@@ -2914,8 +2914,8 @@ MY_LOCALE my_locale_es_PY
29142914
10,
29152915
9,
29162916
',', /* decimal point es_PY */
2917-
'\0', /* thousands_sep es_PY */
2918-
"\x80\x80", /* grouping es_PY */
2917+
'.', /* thousands_sep es_PY */
2918+
"\x03\x03", /* grouping es_PY */
29192919
&global_errmsgs[es_ES]
29202920
);
29212921
/***** LOCALE END es_PY *****/
@@ -2934,8 +2934,8 @@ MY_LOCALE my_locale_es_SV
29342934
10,
29352935
9,
29362936
'.', /* decimal point es_SV */
2937-
'\0', /* thousands_sep es_SV */
2938-
"\x80\x80", /* grouping es_SV */
2937+
',', /* thousands_sep es_SV */
2938+
"\x03\x03", /* grouping es_SV */
29392939
&global_errmsgs[es_ES]
29402940
);
29412941
/***** LOCALE END es_SV *****/
@@ -2974,8 +2974,8 @@ MY_LOCALE my_locale_es_UY
29742974
10,
29752975
9,
29762976
',', /* decimal point es_UY */
2977-
'\0', /* thousands_sep es_UY */
2978-
"\x80\x80", /* grouping es_UY */
2977+
'.', /* thousands_sep es_UY */
2978+
"\x03\x03", /* grouping es_UY */
29792979
&global_errmsgs[es_ES]
29802980
);
29812981
/***** LOCALE END es_UY *****/
@@ -2994,8 +2994,8 @@ MY_LOCALE my_locale_es_VE
29942994
10,
29952995
9,
29962996
',', /* decimal point es_VE */
2997-
'\0', /* thousands_sep es_VE */
2998-
"\x80\x80", /* grouping es_VE */
2997+
'.', /* thousands_sep es_VE */
2998+
"\x03\x03", /* grouping es_VE */
29992999
&global_errmsgs[es_ES]
30003000
);
30013001
/***** LOCALE END es_VE *****/

0 commit comments

Comments
 (0)