mirror of
https://github.com/MariaDB/server.git
synced 2025-12-24 11:21:21 +03:00
WL#4584 Internationalized number format
@ mysql-test/r/func_str.result Adding tests @ mysql-test/t/func_str.test Adding tests @ mysql-test/t/variables.test Fixing error number @ sql/item_create.cc Allowing 2 and 3 arguments to format() @ sql/item_strfunc.cc Adding new formatting code. @ sql/item_strfunc.h Adding new contructors and "locale" member @ sql/mysql_priv.h Adding number formatting members into MY_LOCALE @ sql/sql_locale.cc Adding number formatting data into locale constants @ sql/set_var.cc Using new error message @ sql/share/errmgs.txt Adding new error message
This commit is contained in:
@@ -2558,3 +2558,133 @@ id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 2 Using join buffer
|
||||
2 DERIVED t1 ALL NULL NULL NULL NULL 2
|
||||
drop table t1;
|
||||
Start of 5.4 tests
|
||||
SELECT format(12345678901234567890.123, 3);
|
||||
format(12345678901234567890.123, 3)
|
||||
12,345,678,901,234,567,890.123
|
||||
SELECT format(12345678901234567890.123, 3, NULL);
|
||||
format(12345678901234567890.123, 3, NULL)
|
||||
12,345,678,901,234,567,890.123
|
||||
Warnings:
|
||||
Warning 1647 Unknown locale: 'NULL'
|
||||
SELECT format(12345678901234567890.123, 3, 'ar_AE');
|
||||
format(12345678901234567890.123, 3, 'ar_AE')
|
||||
12,345,678,901,234,567,890.123
|
||||
SELECT format(12345678901234567890.123, 3, 'ar_SA');
|
||||
format(12345678901234567890.123, 3, 'ar_SA')
|
||||
12345678901234567890.123
|
||||
SELECT format(12345678901234567890.123, 3, 'be_BY');
|
||||
format(12345678901234567890.123, 3, 'be_BY')
|
||||
12.345.678.901.234.567.890,123
|
||||
SELECT format(12345678901234567890.123, 3, 'de_DE');
|
||||
format(12345678901234567890.123, 3, 'de_DE')
|
||||
12.345.678.901.234.567.890,123
|
||||
SELECT format(12345678901234567890.123, 3, 'en_IN');
|
||||
format(12345678901234567890.123, 3, 'en_IN')
|
||||
1,23,45,67,89,01,23,45,67,890.123
|
||||
SELECT format(12345678901234567890.123, 3, 'en_US');
|
||||
format(12345678901234567890.123, 3, 'en_US')
|
||||
12,345,678,901,234,567,890.123
|
||||
SELECT format(12345678901234567890.123, 3, 'it_CH');
|
||||
format(12345678901234567890.123, 3, 'it_CH')
|
||||
12'345'678'901'234'567'890,123
|
||||
SELECT format(12345678901234567890.123, 3, 'ru_RU');
|
||||
format(12345678901234567890.123, 3, 'ru_RU')
|
||||
12 345 678 901 234 567 890,123
|
||||
SELECT format(12345678901234567890.123, 3, 'ta_IN');
|
||||
format(12345678901234567890.123, 3, 'ta_IN')
|
||||
1,23,45,67,89,01,23,45,67,890.123
|
||||
CREATE TABLE t1 (fmt CHAR(5) NOT NULL);
|
||||
INSERT INTO t1 VALUES ('ar_AE');
|
||||
INSERT INTO t1 VALUES ('ar_SA');
|
||||
INSERT INTO t1 VALUES ('be_BY');
|
||||
INSERT INTO t1 VALUES ('de_DE');
|
||||
INSERT INTO t1 VALUES ('en_IN');
|
||||
INSERT INTO t1 VALUES ('en_US');
|
||||
INSERT INTO t1 VALUES ('it_CH');
|
||||
INSERT INTO t1 VALUES ('ru_RU');
|
||||
INSERT INTO t1 VALUES ('ta_IN');
|
||||
SELECT fmt, format(12345678901234567890.123, 3, fmt) FROM t1 ORDER BY fmt;
|
||||
fmt format(12345678901234567890.123, 3, fmt)
|
||||
ar_AE 12,345,678,901,234,567,890.123
|
||||
ar_SA 12345678901234567890.123
|
||||
be_BY 12.345.678.901.234.567.890,123
|
||||
de_DE 12.345.678.901.234.567.890,123
|
||||
en_IN 1,23,45,67,89,01,23,45,67,890.123
|
||||
en_US 12,345,678,901,234,567,890.123
|
||||
it_CH 12'345'678'901'234'567'890,123
|
||||
ru_RU 12 345 678 901 234 567 890,123
|
||||
ta_IN 1,23,45,67,89,01,23,45,67,890.123
|
||||
SELECT fmt, format(12345678901234567890.123, 0, fmt) FROM t1 ORDER BY fmt;
|
||||
fmt format(12345678901234567890.123, 0, fmt)
|
||||
ar_AE 12,345,678,901,234,567,890
|
||||
ar_SA 12345678901234567890
|
||||
be_BY 12.345.678.901.234.567.890
|
||||
de_DE 12.345.678.901.234.567.890
|
||||
en_IN 1,23,45,67,89,01,23,45,67,890
|
||||
en_US 12,345,678,901,234,567,890
|
||||
it_CH 12'345'678'901'234'567'890
|
||||
ru_RU 12 345 678 901 234 567 890
|
||||
ta_IN 1,23,45,67,89,01,23,45,67,890
|
||||
SELECT fmt, format(12345678901234567890, 3, fmt) FROM t1 ORDER BY fmt;
|
||||
fmt format(12345678901234567890, 3, fmt)
|
||||
ar_AE 12,345,678,901,234,567,890.000
|
||||
ar_SA 12345678901234567890.000
|
||||
be_BY 12.345.678.901.234.567.890,000
|
||||
de_DE 12.345.678.901.234.567.890,000
|
||||
en_IN 1,23,45,67,89,01,23,45,67,890.000
|
||||
en_US 12,345,678,901,234,567,890.000
|
||||
it_CH 12'345'678'901'234'567'890,000
|
||||
ru_RU 12 345 678 901 234 567 890,000
|
||||
ta_IN 1,23,45,67,89,01,23,45,67,890.000
|
||||
SELECT fmt, format(-12345678901234567890, 3, fmt) FROM t1 ORDER BY fmt;
|
||||
fmt format(-12345678901234567890, 3, fmt)
|
||||
ar_AE -12,345,678,901,234,567,890.000
|
||||
ar_SA -12345678901234567890.000
|
||||
be_BY -12.345.678.901.234.567.890,000
|
||||
de_DE -12.345.678.901.234.567.890,000
|
||||
en_IN -1,23,45,67,89,01,23,45,67,890.000
|
||||
en_US -12,345,678,901,234,567,890.000
|
||||
it_CH -12'345'678'901'234'567'890,000
|
||||
ru_RU -12 345 678 901 234 567 890,000
|
||||
ta_IN -1,23,45,67,89,01,23,45,67,890.000
|
||||
SELECT fmt, format(-02345678901234567890, 3, fmt) FROM t1 ORDER BY fmt;
|
||||
fmt format(-02345678901234567890, 3, fmt)
|
||||
ar_AE -2,345,678,901,234,567,890.000
|
||||
ar_SA -2345678901234567890.000
|
||||
be_BY -2.345.678.901.234.567.890,000
|
||||
de_DE -2.345.678.901.234.567.890,000
|
||||
en_IN -23,45,67,89,01,23,45,67,890.000
|
||||
en_US -2,345,678,901,234,567,890.000
|
||||
it_CH -2'345'678'901'234'567'890,000
|
||||
ru_RU -2 345 678 901 234 567 890,000
|
||||
ta_IN -23,45,67,89,01,23,45,67,890.000
|
||||
SELECT fmt, format(-00345678901234567890, 3, fmt) FROM t1 ORDER BY fmt;
|
||||
fmt format(-00345678901234567890, 3, fmt)
|
||||
ar_AE -345,678,901,234,567,890.000
|
||||
ar_SA -345678901234567890.000
|
||||
be_BY -345.678.901.234.567.890,000
|
||||
de_DE -345.678.901.234.567.890,000
|
||||
en_IN -3,45,67,89,01,23,45,67,890.000
|
||||
en_US -345,678,901,234,567,890.000
|
||||
it_CH -345'678'901'234'567'890,000
|
||||
ru_RU -345 678 901 234 567 890,000
|
||||
ta_IN -3,45,67,89,01,23,45,67,890.000
|
||||
SELECT fmt, format(-00045678901234567890, 3, fmt) FROM t1 ORDER BY fmt;
|
||||
fmt format(-00045678901234567890, 3, fmt)
|
||||
ar_AE -45,678,901,234,567,890.000
|
||||
ar_SA -45678901234567890.000
|
||||
be_BY -45.678.901.234.567.890,000
|
||||
de_DE -45.678.901.234.567.890,000
|
||||
en_IN -45,67,89,01,23,45,67,890.000
|
||||
en_US -45,678,901,234,567,890.000
|
||||
it_CH -45'678'901'234'567'890,000
|
||||
ru_RU -45 678 901 234 567 890,000
|
||||
ta_IN -45,67,89,01,23,45,67,890.000
|
||||
DROP TABLE t1;
|
||||
SELECT format(123, 1, 'Non-existent-locale');
|
||||
format(123, 1, 'Non-existent-locale')
|
||||
123.0
|
||||
Warnings:
|
||||
Warning 1647 Unknown locale: 'Non-existent-locale'
|
||||
End of 5.4 tests
|
||||
|
||||
Reference in New Issue
Block a user