From 8ec6cf2cd5ed54f1336784ffe548a813cbbde172 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 6 Dec 2004 20:45:32 +0400 Subject: UCS2 support in ENUM and SET, which also fixes: Bug #5174 SHOW CREATE TABLE hangs up if the table contains half-with katakana enum values UCS2 values are stored in HEX encoding in FRM file --- sql/table.cc | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'sql/table.cc') diff --git a/sql/table.cc b/sql/table.cc index cb565097c0b..370ad5eff1d 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -485,6 +485,23 @@ int openfrm(const char *name, const char *alias, uint db_stat, uint prgflag, charset= outparam->table_charset; bzero((char*) &comment, sizeof(comment)); } + + if (interval_nr && charset->mbminlen > 1) + { + /* Unescape UCS2 intervals from HEX notation */ + TYPELIB *interval= outparam->intervals + interval_nr - 1; + for (uint pos= 0; pos < interval->count; pos++) + { + char *from, *to; + for (from= to= (char*) interval->type_names[pos]; *from; ) + { + *to++= (char) (hexchar_to_int(*from++) << 4) + + hexchar_to_int(*from++); + } + interval->type_lengths[pos] /= 2; + } + } + *field_ptr=reg_field= make_field(record+recpos, (uint32) field_length, -- cgit v1.2.1 From c68dfe29fb6f31bc48f2ab189032eb7414de7356 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 7 Dec 2004 17:01:46 +0400 Subject: #7066 [Ver]: "ctype_ucs" fails on SGI IRIX --- sql/table.cc | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'sql/table.cc') diff --git a/sql/table.cc b/sql/table.cc index 370ad5eff1d..992f6df0401 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -495,8 +495,17 @@ int openfrm(const char *name, const char *alias, uint db_stat, uint prgflag, char *from, *to; for (from= to= (char*) interval->type_names[pos]; *from; ) { - *to++= (char) (hexchar_to_int(*from++) << 4) + - hexchar_to_int(*from++); + /* + Note, hexchar_to_int(*from++) doesn't work + one some compilers, e.g. IRIX. Looks like a compiler + bug in inline functions in combination with arguments + that have a side effect. So, let's use from[0] and from[1] + and increment 'from' by two later. + */ + + *to++= (char) (hexchar_to_int(from[0]) << 4) + + hexchar_to_int(from[1]); + from+= 2; } interval->type_lengths[pos] /= 2; } -- cgit v1.2.1