Commit cf80041e authored by serg@serg.mylan's avatar serg@serg.mylan

field length convertion (bytes->chars) should be done with rounding UP.

parent ca8929a1
drop table if exists t1;
set names utf8;
select left(_utf8 0xD0B0D0B1D0B2,1);
left(_utf8 0xD0B0D0B1D0B2,1)
......@@ -68,3 +69,13 @@ this is a test
select insert("aa",100,1,"b"),insert("aa",1,3,"b");
insert("aa",100,1,"b") insert("aa",1,3,"b")
aa b
create table t1 select date_format("2004-01-19 10:10:10", "%Y-%m-%d");
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`date_format("2004-01-19 10:10:10", "%Y-%m-%d")` char(4) character set utf8 default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
select * from t1;
date_format("2004-01-19 10:10:10", "%Y-%m-%d")
2004-01-19
drop table t1;
......@@ -2,6 +2,9 @@
# Tests with the utf8 character set
#
--disable_warnings
drop table if exists t1;
--enable_warnings
set names utf8;
select left(_utf8 0xD0B0D0B1D0B2,1);
......@@ -41,3 +44,12 @@ select _utf8 0xD0B0D0B1D0B2 like concat(_utf8'%',_utf8 0xD0B1,_utf8 '%');
#
select insert('txs',2,1,'hi'),insert('is ',4,0,'a'),insert('txxxxt',2,4,'es');
select insert("aa",100,1,"b"),insert("aa",1,3,"b");
#
# CREATE ... SELECT
#
create table t1 select date_format("2004-01-19 10:10:10", "%Y-%m-%d");
show create table t1;
select * from t1;
drop table t1;
......@@ -5611,16 +5611,16 @@ create_field::create_field(Field *old_field,Field *orig_field)
case 3: sql_type= FIELD_TYPE_MEDIUM_BLOB; break;
default: sql_type= FIELD_TYPE_LONG_BLOB; break;
}
length /= charset->mbmaxlen; // QQ: Probably not needed
length=(length+charset->mbmaxlen-1)/charset->mbmaxlen; // QQ: Probably not needed
break;
case FIELD_TYPE_STRING:
case FIELD_TYPE_VAR_STRING:
length /= charset->mbmaxlen;
length=(length+charset->mbmaxlen-1)/charset->mbmaxlen;
break;
default:
break;
}
decimals= old_field->decimals();
if (sql_type == FIELD_TYPE_STRING)
{
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment