diff --git a/mysql-test/r/ctype_ucs.result b/mysql-test/r/ctype_ucs.result index 811696ef052..1d3deb0b09a 100644 --- a/mysql-test/r/ctype_ucs.result +++ b/mysql-test/r/ctype_ucs.result @@ -470,3 +470,13 @@ select s1 from t1 where s1 > 'a' order by s1; s1 b c +drop table t1; +create table t1(a char(1)) default charset = ucs2; +insert into t1 values ('a'),('b'),('c'); +alter table t1 modify a char(5); +select a, hex(a) from t1; +a hex(a) +a 0061 +b 0062 +c 0063 +drop table t1; diff --git a/mysql-test/t/ctype_ucs.test b/mysql-test/t/ctype_ucs.test index 188ef571f7e..d9ef91496e9 100644 --- a/mysql-test/t/ctype_ucs.test +++ b/mysql-test/t/ctype_ucs.test @@ -303,4 +303,15 @@ DROP TABLE t1; create table t1 (s1 char character set `ucs2` collate `ucs2_czech_ci`); insert into t1 values ('0'),('1'),('2'),('a'),('b'),('c'); select s1 from t1 where s1 > 'a' order by s1; +drop table t1; + +# +# Bug #5081 : UCS2 fields are filled with '0x2020' +# after extending field length +# +create table t1(a char(1)) default charset = ucs2; +insert into t1 values ('a'),('b'),('c'); +alter table t1 modify a char(5); +select a, hex(a) from t1; +drop table t1; diff --git a/ndb/include/kernel/Interpreter.hpp b/ndb/include/kernel/Interpreter.hpp index 2c282be361c..74399f5732e 100644 --- a/ndb/include/kernel/Interpreter.hpp +++ b/ndb/include/kernel/Interpreter.hpp @@ -83,7 +83,7 @@ public: static Uint32 LoadConst64(Uint32 Register); // Value in next 2 words static Uint32 Add(Uint32 DstReg, Uint32 SrcReg1, Uint32 SrcReg2); static Uint32 Sub(Uint32 DstReg, Uint32 SrcReg1, Uint32 SrcReg2); - static Uint32 Branch(Uint32 Inst, Uint32 R1, Uint32 R2); + static Uint32 Branch(Uint32 Inst, Uint32 Reg1, Uint32 Reg2); static Uint32 ExitOK(); /** @@ -184,8 +184,8 @@ Interpreter::Sub(Uint32 Dcoleg, Uint32 SrcReg1, Uint32 SrcReg2){ inline Uint32 -Interpreter::Branch(Uint32 Inst, Uint32 R1, Uint32 R2){ - return (R1 << 9) + (R2 << 6) + Inst; +Interpreter::Branch(Uint32 Inst, Uint32 Reg1, Uint32 Reg2){ + return (Reg1 << 9) + (Reg2 << 6) + Inst; } inline diff --git a/ndb/include/util/BaseString.hpp b/ndb/include/util/BaseString.hpp index 8755c13e9bb..a1bb91ea9c5 100644 --- a/ndb/include/util/BaseString.hpp +++ b/ndb/include/util/BaseString.hpp @@ -176,7 +176,7 @@ public: /** * Trim string from delim */ - static char* trim(char * src, const char * delim = " \t"); + static char* trim(char * src, const char * delim); private: char* m_chr; unsigned m_len; diff --git a/sql/field_conv.cc b/sql/field_conv.cc index e98068ef974..d7993939092 100644 --- a/sql/field_conv.cc +++ b/sql/field_conv.cc @@ -340,8 +340,10 @@ static void do_cut_string(Copy_field *copy) static void do_expand_string(Copy_field *copy) { + CHARSET_INFO *cs= copy->from_field->charset(); memcpy(copy->to_ptr,copy->from_ptr,copy->from_length); - bfill(copy->to_ptr+copy->from_length,copy->to_length-copy->from_length,' '); + cs->cset->fill(cs, copy->to_ptr+copy->from_length, + copy->to_length-copy->from_length, ' '); } static void do_varstring(Copy_field *copy)