mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Bug#18691: Converting number to UNICODE string returns invalid result.
Conversion from int and real numbers to UCS2 didn't work fine: CONVERT(100, CHAR(50) UNICODE) CONVERT(103.9, CHAR(50) UNICODE) The problem appeared because numbers have binary charset, so, simple charset recast binary->ucs2 was performed instead of real conversion. Fixed to make numbers pretend to be non-binary. mysql-test/r/ctype_ucs.result: Adding test case mysql-test/t/ctype_ucs.test: Adding test case sql/item_timefunc.cc: Adding new member from_cs, to replace my_charset_bin to a non-binary charset when converting from numbers to UCS2 sql/item_timefunc.h: Adding new member from_cs, to replace my_charset_bin to a non-binary charset when converting from numbers to UCS2
This commit is contained in:
@ -666,6 +666,18 @@ Warnings:
|
||||
Warning 1265 Data truncated for column 'Field1' at row 1
|
||||
DROP TABLE t1;
|
||||
SET NAMES latin1;
|
||||
SELECT CONVERT(103, CHAR(50) UNICODE);
|
||||
CONVERT(103, CHAR(50) UNICODE)
|
||||
103
|
||||
SELECT CONVERT(103.0, CHAR(50) UNICODE);
|
||||
CONVERT(103.0, CHAR(50) UNICODE)
|
||||
103.0
|
||||
SELECT CONVERT(-103, CHAR(50) UNICODE);
|
||||
CONVERT(-103, CHAR(50) UNICODE)
|
||||
-103
|
||||
SELECT CONVERT(-103.0, CHAR(50) UNICODE);
|
||||
CONVERT(-103.0, CHAR(50) UNICODE)
|
||||
-103.0
|
||||
CREATE TABLE t1 (
|
||||
a varchar(255) NOT NULL default '',
|
||||
KEY a (a)
|
||||
|
@ -407,6 +407,14 @@ INSERT INTO t1 VALUES ('-1');
|
||||
DROP TABLE t1;
|
||||
SET NAMES latin1;
|
||||
|
||||
#
|
||||
# Bug#18691 Converting number to UNICODE string returns invalid result
|
||||
#
|
||||
SELECT CONVERT(103, CHAR(50) UNICODE);
|
||||
SELECT CONVERT(103.0, CHAR(50) UNICODE);
|
||||
SELECT CONVERT(-103, CHAR(50) UNICODE);
|
||||
SELECT CONVERT(-103.0, CHAR(50) UNICODE);
|
||||
|
||||
#
|
||||
# Bug#9557 MyISAM utf8 table crash
|
||||
#
|
||||
|
Reference in New Issue
Block a user