mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
cast.result, cast.test:
Added test case for bug #11283. field.h, field.cc: Fixed bug #11283: wrong conversion from varchar to decimal. Added methods Field_string::val_decimal, Field_varstring::val_decimal, Field_blob::val_decimal. They are not inherited from the base class Field_longstr anymore. sql/field.cc: Fixed bug #11283: wrong conversion from varchar to decimal. Added methods Field_string::val_decimal, Field_varstring::val_decimal, Field_blob::val_decimal. They are not inherited from the base class Field_longstr anymore. sql/field.h: Fixed bug #11283: wrong conversion from varchar to decimal. Added methods Field_string::val_decimal, Field_varstring::val_decimal, Field_blob::val_decimal. They are not inherited from the base class Field_longstr anymore. mysql-test/t/cast.test: Added test case for bug #11283. mysql-test/r/cast.result: Added test case for bug #11283.
This commit is contained in:
@ -344,3 +344,11 @@ select cast(s1 as decimal(7,2)) from t1;
|
||||
cast(s1 as decimal(7,2))
|
||||
111111.00
|
||||
drop table t1;
|
||||
CREATE TABLE t1 (v varchar(10), tt tinytext, t text,
|
||||
mt mediumtext, lt longtext);
|
||||
INSERT INTO t1 VALUES ('1.01', '2.02', '3.03', '4.04', '5.05');
|
||||
SELECT CAST(v AS DECIMAL), CAST(tt AS DECIMAL), CAST(t AS DECIMAL),
|
||||
CAST(mt AS DECIMAL), CAST(lt AS DECIMAL) from t1;
|
||||
CAST(v AS DECIMAL) CAST(tt AS DECIMAL) CAST(t AS DECIMAL) CAST(mt AS DECIMAL) CAST(lt AS DECIMAL)
|
||||
1.01 2.02 3.03 4.04 5.05
|
||||
DROP TABLE t1;
|
||||
|
@ -168,3 +168,16 @@ create table t1(s1 time);
|
||||
insert into t1 values ('11:11:11');
|
||||
select cast(s1 as decimal(7,2)) from t1;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Test for bug #11283: field conversion from varchar, and text types to decimal
|
||||
#
|
||||
|
||||
CREATE TABLE t1 (v varchar(10), tt tinytext, t text,
|
||||
mt mediumtext, lt longtext);
|
||||
INSERT INTO t1 VALUES ('1.01', '2.02', '3.03', '4.04', '5.05');
|
||||
|
||||
SELECT CAST(v AS DECIMAL), CAST(tt AS DECIMAL), CAST(t AS DECIMAL),
|
||||
CAST(mt AS DECIMAL), CAST(lt AS DECIMAL) from t1;
|
||||
|
||||
DROP TABLE t1;
|
||||
|
Reference in New Issue
Block a user