Bug#8610: The ucs2_turkish_ci collation fails with upper('i')

UPPER/LOWER now can return a string with different length.

mi_test1.c:
  Adding new arguments.
Many files:
  Changeing caseup/casedn to return a result with different
  length than argument.
sql_string.h:
  Removing unused method,
mysql_priv.h:
  Removing unused method
This commit is contained in:
bar@mysql.com 2005-06-06 16:54:15 +05:00
parent dcae1d174f
commit 2df945d87b
28 changed files with 601 additions and 106 deletions

View File

@ -260,8 +260,6 @@ public:
}
bool fill(uint32 max_length,char fill);
void strip_sp();
inline void caseup() { my_caseup(str_charset,Ptr,str_length); }
inline void casedn() { my_casedn(str_charset,Ptr,str_length); }
friend int sortcmp(const String *a,const String *b, CHARSET_INFO *cs);
friend int stringcmp(const String *a,const String *b);
friend String *copy_if_not_alloced(String *a,String *b,uint32 arg_length);

View File

@ -44,6 +44,9 @@ typedef struct unicase_info_st
uint16 sort;
} MY_UNICASE_INFO;
extern MY_UNICASE_INFO *my_unicase_default[256];
extern MY_UNICASE_INFO *my_unicase_turkish[256];
#define MY_CS_ILSEQ 0
#define MY_CS_ILUNI 0
#define MY_CS_TOOSMALL -1
@ -164,8 +167,10 @@ typedef struct my_charset_handler_st
/* Functions for case and sort convertion */
void (*caseup_str)(struct charset_info_st *, char *);
void (*casedn_str)(struct charset_info_st *, char *);
void (*caseup)(struct charset_info_st *, char *, uint);
void (*casedn)(struct charset_info_st *, char *, uint);
uint (*caseup)(struct charset_info_st *, char *src, uint srclen,
char *dst, uint dstlen);
uint (*casedn)(struct charset_info_st *, char *src, uint srclen,
char *dst, uint dstlen);
/* Charset dependant snprintf() */
int (*snprintf)(struct charset_info_st *, char *to, uint n, const char *fmt,
@ -216,9 +221,12 @@ typedef struct charset_info_st
uint16 **sort_order_big;
uint16 *tab_to_uni;
MY_UNI_IDX *tab_from_uni;
MY_UNICASE_INFO **caseinfo;
uchar *state_map;
uchar *ident_map;
uint strxfrm_multiply;
uchar caseup_multiply;
uchar casedn_multiply;
uint mbminlen;
uint mbmaxlen;
uint16 min_sort_char;
@ -286,8 +294,10 @@ extern uint my_instr_simple(struct charset_info_st *,
/* Functions for 8bit */
extern void my_caseup_str_8bit(CHARSET_INFO *, char *);
extern void my_casedn_str_8bit(CHARSET_INFO *, char *);
extern void my_caseup_8bit(CHARSET_INFO *, char *, uint);
extern void my_casedn_8bit(CHARSET_INFO *, char *, uint);
extern uint my_caseup_8bit(CHARSET_INFO *, char *src, uint srclen,
char *dst, uint dstlen);
extern uint my_casedn_8bit(CHARSET_INFO *, char *src, uint srclen,
char *dst, uint dstlen);
extern int my_strcasecmp_8bit(CHARSET_INFO * cs, const char *, const char *);
@ -359,8 +369,10 @@ int my_mbcharlen_8bit(CHARSET_INFO *, uint c);
/* Functions for multibyte charsets */
extern void my_caseup_str_mb(CHARSET_INFO *, char *);
extern void my_casedn_str_mb(CHARSET_INFO *, char *);
extern void my_caseup_mb(CHARSET_INFO *, char *, uint);
extern void my_casedn_mb(CHARSET_INFO *, char *, uint);
extern uint my_caseup_mb(CHARSET_INFO *, char *src, uint srclen,
char *dst, uint dstlen);
extern uint my_casedn_mb(CHARSET_INFO *, char *src, uint srclen,
char *dst, uint dstlen);
extern int my_strcasecmp_mb(CHARSET_INFO * cs,const char *, const char *);
int my_wildcmp_mb(CHARSET_INFO *,
@ -441,8 +453,6 @@ my_bool my_propagate_complex(CHARSET_INFO *cs, const uchar *str, uint len);
#define my_mbcharlen(s, a) 1
#endif
#define my_caseup(s, a, l) ((s)->cset->caseup((s), (a), (l)))
#define my_casedn(s, a, l) ((s)->cset->casedn((s), (a), (l)))
#define my_caseup_str(s, a) ((s)->cset->caseup_str((s), (a)))
#define my_casedn_str(s, a) ((s)->cset->casedn_str((s), (a)))
#define my_strntol(s, a, b, c, d, e) ((s)->cset->strntol((s),(a),(b),(c),(d),(e)))

View File

@ -471,20 +471,25 @@ static void update_record(char *record)
ptr=blob_key;
memcpy_fixed(pos+4,&ptr,sizeof(char*)); /* Store pointer to new key */
if (keyinfo[0].seg[0].type != HA_KEYTYPE_NUM)
my_casedn(default_charset_info,blob_key,length);
default_charset_info->cset->casedn(default_charset_info,
blob_key, length, blob_key, length);
pos+=recinfo[1].length;
}
else if (recinfo[1].type == FIELD_VARCHAR)
{
uint pack_length= HA_VARCHAR_PACKLENGTH(recinfo[1].length-1);
uint length= pack_length == 1 ? (uint) *(uchar*) pos : uint2korr(pos);
my_casedn(default_charset_info,pos+pack_length,length);
default_charset_info->cset->casedn(default_charset_info,
pos + pack_length, length,
pos + pack_length, length);
pos+=recinfo[1].length;
}
else
{
if (keyinfo[0].seg[0].type != HA_KEYTYPE_NUM)
my_casedn(default_charset_info,pos,keyinfo[0].seg[0].length);
default_charset_info->cset->casedn(default_charset_info,
pos, keyinfo[0].seg[0].length,
pos, keyinfo[0].seg[0].length);
pos+=recinfo[1].length;
}

View File

@ -2396,3 +2396,27 @@ utf8_unicode_ci 6109
utf8_unicode_ci 61
utf8_unicode_ci 6120
drop table t1;
CREATE TABLE t1 (id int, a varchar(30) character set utf8);
INSERT INTO t1 VALUES (1, _ucs2 0x01310069), (2, _ucs2 0x01310131);
INSERT INTO t1 VALUES (3, _ucs2 0x00690069), (4, _ucs2 0x01300049);
INSERT INTO t1 VALUES (5, _ucs2 0x01300130), (6, _ucs2 0x00490049);
SELECT a, length(a) la, @l:=lower(a) l, length(@l) ll, @u:=upper(a) u, length(@u) lu
FROM t1 ORDER BY id;
a la l ll u lu
ıi 3 ıi 3 II 2
ıı 4 ıı 4 II 2
ii 2 ii 2 II 2
İI 3 ii 2 İI 3
İİ 4 ii 2 İİ 4
II 2 ii 2 II 2
ALTER TABLE t1 MODIFY a VARCHAR(30) character set utf8 collate utf8_turkish_ci;
SELECT a, length(a) la, @l:=lower(a) l, length(@l) ll, @u:=upper(a) u, length(@u) lu
FROM t1 ORDER BY id;
a la l ll u lu
ıi 3 ıi 3 Iİ 3
ıı 4 ıı 4 II 2
ii 2 ii 2 İİ 4
İI 3 iı 3 İI 3
İİ 4 ii 2 İİ 4
II 2 ıı 4 II 2
DROP TABLE t1;

View File

@ -455,3 +455,18 @@ drop table t1;
SET collation_connection='utf8_unicode_ci';
-- source include/ctype_filesort.inc
#
# Check UPPER/LOWER changeing length
#
# Result shorter than argument
CREATE TABLE t1 (id int, a varchar(30) character set utf8);
INSERT INTO t1 VALUES (1, _ucs2 0x01310069), (2, _ucs2 0x01310131);
INSERT INTO t1 VALUES (3, _ucs2 0x00690069), (4, _ucs2 0x01300049);
INSERT INTO t1 VALUES (5, _ucs2 0x01300130), (6, _ucs2 0x00490049);
SELECT a, length(a) la, @l:=lower(a) l, length(@l) ll, @u:=upper(a) u, length(@u) lu
FROM t1 ORDER BY id;
ALTER TABLE t1 MODIFY a VARCHAR(30) character set utf8 collate utf8_turkish_ci;
SELECT a, length(a) la, @l:=lower(a) l, length(@l) ll, @u:=upper(a) u, length(@u) lu
FROM t1 ORDER BY id;
DROP TABLE t1;

View File

@ -902,7 +902,7 @@ void Item_func_insert::fix_length_and_dec()
}
String *Item_func_lcase::val_str(String *str)
String *Item_str_conv::val_str(String *str)
{
DBUG_ASSERT(fixed == 1);
String *res;
@ -912,24 +912,25 @@ String *Item_func_lcase::val_str(String *str)
return 0; /* purecov: inspected */
}
null_value=0;
res=copy_if_not_alloced(str,res,res->length());
res->casedn();
return res;
}
String *Item_func_ucase::val_str(String *str)
{
DBUG_ASSERT(fixed == 1);
String *res;
if (!(res=args[0]->val_str(str)))
if (multiply == 1)
{
null_value=1; /* purecov: inspected */
return 0; /* purecov: inspected */
uint len;
res= copy_if_not_alloced(str,res,res->length());
len= converter(collation.collation, (char*) res->ptr(), res->length(),
(char*) res->ptr(), res->length());
DBUG_ASSERT(len <= res->length());
res->length(len);
}
else
{
uint len= res->length() * multiply;
tmp_value.alloc(len);
tmp_value.set_charset(collation.collation);
len= converter(collation.collation, (char*) res->ptr(), res->length(),
(char*) tmp_value.ptr(), len);
tmp_value.length(len);
res= &tmp_value;
}
null_value=0;
res=copy_if_not_alloced(str,res,res->length());
res->caseup();
return res;
}

View File

@ -133,13 +133,14 @@ public:
class Item_str_conv :public Item_str_func
{
protected:
uint multiply;
uint (*converter)(CHARSET_INFO *cs, char *src, uint srclen,
char *dst, uint dstlen);
String tmp_value;
public:
Item_str_conv(Item *item) :Item_str_func(item) {}
void fix_length_and_dec()
{
collation.set(args[0]->collation);
max_length = args[0]->max_length;
}
String *val_str(String *);
};
@ -147,16 +148,28 @@ class Item_func_lcase :public Item_str_conv
{
public:
Item_func_lcase(Item *item) :Item_str_conv(item) {}
String *val_str(String *);
const char *func_name() const { return "lcase"; }
void fix_length_and_dec()
{
collation.set(args[0]->collation);
multiply= collation.collation->casedn_multiply;
converter= collation.collation->cset->casedn;
max_length= args[0]->max_length * multiply;
}
};
class Item_func_ucase :public Item_str_conv
{
public:
Item_func_ucase(Item *item) :Item_str_conv(item) {}
String *val_str(String *);
const char *func_name() const { return "ucase"; }
void fix_length_and_dec()
{
collation.set(args[0]->collation);
multiply= collation.collation->caseup_multiply;
converter= collation.collation->cset->caseup;
max_length= args[0]->max_length * multiply;
}
};

View File

@ -1354,7 +1354,8 @@ inline void mark_as_null_row(TABLE *table)
inline void table_case_convert(char * name, uint length)
{
if (lower_case_table_names)
my_casedn(files_charset_info, name, length);
files_charset_info->cset->casedn(files_charset_info,
name, length, name, length);
}
inline const char *table_case_name(HA_CREATE_INFO *info, const char *name)

View File

@ -261,8 +261,6 @@ public:
}
bool fill(uint32 max_length,char fill);
void strip_sp();
inline void caseup() { my_caseup(str_charset,Ptr,str_length); }
inline void casedn() { my_casedn(str_charset,Ptr,str_length); }
friend int sortcmp(const String *a,const String *b, CHARSET_INFO *cs);
friend int stringcmp(const String *a,const String *b);
friend String *copy_if_not_alloced(String *a,String *b,uint32 arg_length);

View File

@ -6384,9 +6384,12 @@ CHARSET_INFO my_charset_big5_chinese_ci=
NULL, /* sort_order_big*/
NULL, /* tab_to_uni */
NULL, /* tab_from_uni */
my_unicase_default, /* caseinfo */
NULL, /* state_map */
NULL, /* ident_map */
1, /* strxfrm_multiply */
1, /* caseup_multiply */
1, /* casedn_multiply */
1, /* mbminlen */
2, /* mbmaxlen */
0, /* min_sort_char */
@ -6412,9 +6415,12 @@ CHARSET_INFO my_charset_big5_bin=
NULL, /* sort_order_big*/
NULL, /* tab_to_uni */
NULL, /* tab_from_uni */
my_unicase_default, /* caseinfo */
NULL, /* state_map */
NULL, /* ident_map */
1, /* strxfrm_multiply */
1, /* caseup_multiply */
1, /* casedn_multiply */
1, /* mbminlen */
2, /* mbmaxlen */
0, /* min_sort_char */

View File

@ -208,10 +208,13 @@ static void my_case_str_bin(CHARSET_INFO *cs __attribute__((unused)),
{
}
static void my_case_bin(CHARSET_INFO *cs __attribute__((unused)),
char *str __attribute__((unused)),
uint length __attribute__((unused)))
static uint my_case_bin(CHARSET_INFO *cs __attribute__((unused)),
char *src __attribute__((unused)),
uint srclen,
char *dst __attribute__((unused)),
uint dstlen __attribute__((unused)))
{
return srclen;
}
@ -526,9 +529,12 @@ CHARSET_INFO my_charset_bin =
NULL, /* sort_order_big*/
NULL, /* tab_to_uni */
NULL, /* tab_from_uni */
my_unicase_default, /* caseinfo */
NULL, /* state_map */
NULL, /* ident_map */
1, /* strxfrm_multiply */
1, /* caseup_multiply */
1, /* casedn_multiply */
1, /* mbminlen */
1, /* mbmaxlen */
0, /* min_sort_char */

View File

@ -5512,9 +5512,12 @@ CHARSET_INFO my_charset_cp932_japanese_ci=
NULL, /* sort_order_big*/
NULL, /* tab_to_uni */
NULL, /* tab_from_uni */
my_unicase_default, /* caseinfo */
NULL, /* state_map */
NULL, /* ident_map */
1, /* strxfrm_multiply */
1, /* caseup_multiply */
1, /* casedn_multiply */
1, /* mbminlen */
2, /* mbmaxlen */
0, /* min_sort_char */
@ -5539,9 +5542,12 @@ CHARSET_INFO my_charset_cp932_bin=
NULL, /* sort_order_big*/
NULL, /* tab_to_uni */
NULL, /* tab_from_uni */
my_unicase_default, /* caseinfo */
NULL, /* state_map */
NULL, /* ident_map */
1, /* strxfrm_multiply */
1, /* caseup_multiply */
1, /* casedn_multiply */
1, /* mbminlen */
2, /* mbmaxlen */
0, /* min_sort_char */

View File

@ -618,9 +618,12 @@ CHARSET_INFO my_charset_latin2_czech_ci =
NULL, /* sort_order_big*/
tab_8859_2_uni, /* tab_to_uni */
idx_uni_8859_2, /* tab_from_uni */
my_unicase_default, /* caseinfo */
NULL, /* state_map */
NULL, /* ident_map */
4, /* strxfrm_multiply */
1, /* caseup_multiply */
1, /* casedn_multiply */
1, /* mbminlen */
1, /* mbmaxlen */
0, /* min_sort_char */

View File

@ -8696,9 +8696,12 @@ CHARSET_INFO my_charset_euckr_korean_ci=
NULL, /* sort_order_big*/
NULL, /* tab_to_uni */
NULL, /* tab_from_uni */
my_unicase_default, /* caseinfo */
NULL, /* state_map */
NULL, /* ident_map */
1, /* strxfrm_multiply */
1, /* caseup_multiply */
1, /* casedn_multiply */
1, /* mbminlen */
2, /* mbmaxlen */
0, /* min_sort_char */
@ -8724,9 +8727,12 @@ CHARSET_INFO my_charset_euckr_bin=
NULL, /* sort_order_big*/
NULL, /* tab_to_uni */
NULL, /* tab_from_uni */
my_unicase_default, /* caseinfo */
NULL, /* state_map */
NULL, /* ident_map */
1, /* strxfrm_multiply */
1, /* caseup_multiply */
1, /* casedn_multiply */
1, /* mbminlen */
2, /* mbmaxlen */
0, /* min_sort_char */

View File

@ -8698,9 +8698,12 @@ CHARSET_INFO my_charset_eucjpms_japanese_ci=
NULL, /* contractions */
NULL, /* tab_to_uni */
NULL, /* tab_from_uni */
my_unicase_default, /* caseinfo */
NULL, /* state_map */
NULL, /* ident_map */
1, /* strxfrm_multiply */
1, /* caseup_multiply */
1, /* casedn_multiply */
1, /* mbminlen */
3, /* mbmaxlen */
0, /* min_sort_char */
@ -8726,9 +8729,12 @@ CHARSET_INFO my_charset_eucjpms_bin=
NULL, /* sort_order_big*/
NULL, /* tab_to_uni */
NULL, /* tab_from_uni */
my_unicase_default, /* caseinfo */
NULL, /* state_map */
NULL, /* ident_map */
1, /* strxfrm_multiply */
1, /* caseup_multiply */
1, /* casedn_multiply */
1, /* mbminlen */
3, /* mbmaxlen */
0, /* min_sort_char */

View File

@ -33,9 +33,12 @@ CHARSET_INFO compiled_charsets[] = {
NULL, /* sort_order_big*/
NULL, /* tab_to_uni */
NULL, /* tab_from_uni */
my_unicase_default, /* caseinfo */
NULL, /* state_map */
NULL, /* ident_map */
0, /* strxfrm_mul */
0, /* caseup_mul */
0, /* casedn_mul */
0, /* mbminlen */
0, /* mbmaxlen */
0, /* min_sort_ord */

View File

@ -5747,9 +5747,12 @@ CHARSET_INFO my_charset_gb2312_chinese_ci=
NULL, /* sort_order_big*/
NULL, /* tab_to_uni */
NULL, /* tab_from_uni */
my_unicase_default, /* caseinfo */
NULL, /* state_map */
NULL, /* ident_map */
1, /* strxfrm_multiply */
1, /* caseup_multiply */
1, /* casedn_multiply */
1, /* mbminlen */
2, /* mbmaxlen */
0, /* min_sort_char */
@ -5774,9 +5777,12 @@ CHARSET_INFO my_charset_gb2312_bin=
NULL, /* sort_order_big*/
NULL, /* tab_to_uni */
NULL, /* tab_from_uni */
my_unicase_default, /* caseinfo */
NULL, /* state_map */
NULL, /* ident_map */
1, /* strxfrm_multiply */
1, /* caseup_multiply */
1, /* casedn_multiply */
1, /* mbminlen */
2, /* mbmaxlen */
0, /* min_sort_char */

View File

@ -9994,9 +9994,12 @@ CHARSET_INFO my_charset_gbk_chinese_ci=
NULL, /* sort_order_big*/
NULL, /* tab_to_uni */
NULL, /* tab_from_uni */
my_unicase_default, /* caseinfo */
NULL, /* state_map */
NULL, /* ident_map */
1, /* strxfrm_multiply */
1, /* caseup_multiply */
1, /* casedn_multiply */
1, /* mbminlen */
2, /* mbmaxlen */
0, /* min_sort_char */
@ -10021,9 +10024,12 @@ CHARSET_INFO my_charset_gbk_bin=
NULL, /* sort_order_big*/
NULL, /* tab_to_uni */
NULL, /* tab_from_uni */
my_unicase_default, /* caseinfo */
NULL, /* state_map */
NULL, /* ident_map */
1, /* strxfrm_multiply */
1, /* caseup_multiply */
1, /* casedn_multiply */
1, /* mbminlen */
2, /* mbmaxlen */
0, /* min_sort_char */

View File

@ -424,9 +424,12 @@ CHARSET_INFO my_charset_latin1=
NULL, /* sort_order_big*/
cs_to_uni, /* tab_to_uni */
NULL, /* tab_from_uni */
my_unicase_default, /* caseinfo */
NULL, /* state_map */
NULL, /* ident_map */
1, /* strxfrm_multiply */
1, /* caseup_multiply */
1, /* casedn_multiply */
1, /* mbminlen */
1, /* mbmaxlen */
0, /* min_sort_char */
@ -719,9 +722,12 @@ CHARSET_INFO my_charset_latin1_german2_ci=
NULL, /* sort_order_big*/
cs_to_uni, /* tab_to_uni */
NULL, /* tab_from_uni */
my_unicase_default, /* caseinfo */
NULL, /* state_map */
NULL, /* ident_map */
2, /* strxfrm_multiply */
1, /* caseup_multiply */
1, /* casedn_multiply */
1, /* mbminlen */
1, /* mbmaxlen */
0, /* min_sort_char */
@ -747,9 +753,12 @@ CHARSET_INFO my_charset_latin1_bin=
NULL, /* sort_order_big*/
cs_to_uni, /* tab_to_uni */
NULL, /* tab_from_uni */
my_unicase_default, /* caseinfo */
NULL, /* state_map */
NULL, /* ident_map */
1, /* strxfrm_multiply */
1, /* caseup_multiply */
1, /* casedn_multiply */
1, /* mbminlen */
1, /* mbmaxlen */
0, /* min_sort_char */

View File

@ -57,40 +57,48 @@ void my_casedn_str_mb(CHARSET_INFO * cs, char *str)
}
}
void my_caseup_mb(CHARSET_INFO * cs, char *str, uint length)
uint my_caseup_mb(CHARSET_INFO * cs, char *src, uint srclen,
char *dst __attribute__((unused)),
uint dstlen __attribute__((unused)))
{
register uint32 l;
register char *end=str+length;
register uchar *map=cs->to_upper;
while (str<end)
register char *srcend= src + srclen;
register uchar *map= cs->to_upper;
DBUG_ASSERT(src == dst && srclen == dstlen);
while (src < srcend)
{
if ((l=my_ismbchar(cs, str,end)))
str+=l;
if ((l=my_ismbchar(cs, src, srcend)))
src+= l;
else
{
*str=(char) map[(uchar)*str];
str++;
*src=(char) map[(uchar) *src];
src++;
}
}
return srclen;
}
void my_casedn_mb(CHARSET_INFO * cs, char *str, uint length)
uint my_casedn_mb(CHARSET_INFO * cs, char *src, uint srclen,
char *dst __attribute__((unused)),
uint dstlen __attribute__((unused)))
{
register uint32 l;
register char *end=str+length;
register char *srcend= src + srclen;
register uchar *map=cs->to_lower;
while (str<end)
DBUG_ASSERT(src == dst && srclen == dstlen);
while (src < srcend)
{
if ((l=my_ismbchar(cs, str,end)))
str+=l;
if ((l= my_ismbchar(cs, src, srcend)))
src+= l;
else
{
*str=(char) map[(uchar)*str];
str++;
*src= (char) map[(uchar)*src];
src++;
}
}
return srclen;
}
int my_strcasecmp_mb(CHARSET_INFO * cs,const char *s, const char *t)

View File

@ -201,18 +201,28 @@ void my_casedn_str_8bit(CHARSET_INFO * cs,char *str)
str++;
}
void my_caseup_8bit(CHARSET_INFO * cs, char *str, uint length)
uint my_caseup_8bit(CHARSET_INFO * cs, char *src, uint srclen,
char *dst __attribute__((unused)),
uint dstlen __attribute__((unused)))
{
register uchar *map=cs->to_upper;
for ( ; length>0 ; length--, str++)
*str= (char) map[(uchar)*str];
uint srclen0= srclen;
register uchar *map= cs->to_upper;
DBUG_ASSERT(src == dst && srclen == dstlen);
for ( ; srclen > 0 ; srclen--, src++)
*src= (char) map[(uchar) *src];
return srclen0;
}
void my_casedn_8bit(CHARSET_INFO * cs, char *str, uint length)
uint my_casedn_8bit(CHARSET_INFO * cs, char *src, uint srclen,
char *dst __attribute__((unused)),
uint dstlen __attribute__((unused)))
{
uint srclen0= srclen;
register uchar *map=cs->to_lower;
for ( ; length>0 ; length--, str++)
*str= (char) map[(uchar) *str];
DBUG_ASSERT(src == dst && srclen == dstlen);
for ( ; srclen > 0 ; srclen--, src++)
*src= (char) map[(uchar) *src];
return srclen0;
}
int my_strcasecmp_8bit(CHARSET_INFO * cs,const char *s, const char *t)
@ -1303,6 +1313,8 @@ static my_bool create_fromuni(CHARSET_INFO *cs, void *(*alloc)(uint))
static my_bool my_cset_init_8bit(CHARSET_INFO *cs, void *(*alloc)(uint))
{
cs->caseup_multiply= 1;
cs->casedn_multiply= 1;
return create_fromuni(cs, alloc);
}

View File

@ -4681,9 +4681,12 @@ CHARSET_INFO my_charset_sjis_japanese_ci=
NULL, /* sort_order_big*/
NULL, /* tab_to_uni */
NULL, /* tab_from_uni */
my_unicase_default, /* caseinfo */
NULL, /* state_map */
NULL, /* ident_map */
1, /* strxfrm_multiply */
1, /* caseup_multiply */
1, /* casedn_multiply */
1, /* mbminlen */
2, /* mbmaxlen */
0, /* min_sort_char */
@ -4708,9 +4711,12 @@ CHARSET_INFO my_charset_sjis_bin=
NULL, /* sort_order_big*/
NULL, /* tab_to_uni */
NULL, /* tab_from_uni */
my_unicase_default, /* caseinfo */
NULL, /* state_map */
NULL, /* ident_map */
1, /* strxfrm_multiply */
1, /* caseup_multiply */
1, /* casedn_multiply */
1, /* mbminlen */
2, /* mbmaxlen */
0, /* min_sort_char */

View File

@ -983,9 +983,12 @@ CHARSET_INFO my_charset_tis620_thai_ci=
NULL, /* sort_order_big*/
NULL, /* tab_to_uni */
NULL, /* tab_from_uni */
my_unicase_default, /* caseinfo */
NULL, /* state_map */
NULL, /* ident_map */
4, /* strxfrm_multiply */
1, /* caseup_multiply */
1, /* casedn_multiply */
1, /* mbminlen */
1, /* mbmaxlen */
0, /* min_sort_char */
@ -1010,9 +1013,12 @@ CHARSET_INFO my_charset_tis620_bin=
NULL, /* sort_order_big*/
NULL, /* tab_to_uni */
NULL, /* tab_from_uni */
my_unicase_default, /* caseinfo */
NULL, /* state_map */
NULL, /* ident_map */
1, /* strxfrm_multiply */
1, /* caseup_multiply */
1, /* casedn_multiply */
1, /* mbminlen */
1, /* mbmaxlen */
0, /* min_sort_char */

View File

@ -8049,9 +8049,12 @@ CHARSET_INFO my_charset_ucs2_general_uca=
uca_weight, /* sort_order_big*/
NULL, /* tab_to_uni */
NULL, /* tab_from_uni */
my_unicase_default, /* caseinfo */
NULL, /* state_map */
NULL, /* ident_map */
8, /* strxfrm_multiply */
1, /* caseup_multiply */
1, /* casedn_multiply */
2, /* mbminlen */
2, /* mbmaxlen */
9, /* min_sort_char */
@ -8076,9 +8079,12 @@ CHARSET_INFO my_charset_ucs2_icelandic_uca_ci=
NULL, /* sort_order_big*/
NULL, /* tab_to_uni */
NULL, /* tab_from_uni */
my_unicase_default, /* caseinfo */
NULL, /* state_map */
NULL, /* ident_map */
8, /* strxfrm_multiply */
1, /* caseup_multiply */
1, /* casedn_multiply */
2, /* mbminlen */
2, /* mbmaxlen */
9, /* min_sort_char */
@ -8103,9 +8109,12 @@ CHARSET_INFO my_charset_ucs2_latvian_uca_ci=
NULL, /* sort_order_big*/
NULL, /* tab_to_uni */
NULL, /* tab_from_uni */
my_unicase_default, /* caseinfo */
NULL, /* state_map */
NULL, /* ident_map */
8, /* strxfrm_multiply */
1, /* caseup_multiply */
1, /* casedn_multiply */
2, /* mbminlen */
2, /* mbmaxlen */
9, /* min_sort_char */
@ -8130,9 +8139,12 @@ CHARSET_INFO my_charset_ucs2_romanian_uca_ci=
NULL, /* sort_order_big*/
NULL, /* tab_to_uni */
NULL, /* tab_from_uni */
my_unicase_default, /* caseinfo */
NULL, /* state_map */
NULL, /* ident_map */
8, /* strxfrm_multiply */
1, /* caseup_multiply */
1, /* casedn_multiply */
2, /* mbminlen */
2, /* mbmaxlen */
9, /* min_sort_char */
@ -8157,9 +8169,12 @@ CHARSET_INFO my_charset_ucs2_slovenian_uca_ci=
NULL, /* sort_order_big*/
NULL, /* tab_to_uni */
NULL, /* tab_from_uni */
my_unicase_default, /* caseinfo */
NULL, /* state_map */
NULL, /* ident_map */
8, /* strxfrm_multiply */
1, /* caseup_multiply */
1, /* casedn_multiply */
2, /* mbminlen */
2, /* mbmaxlen */
9, /* min_sort_char */
@ -8184,9 +8199,12 @@ CHARSET_INFO my_charset_ucs2_polish_uca_ci=
NULL, /* sort_order_big*/
NULL, /* tab_to_uni */
NULL, /* tab_from_uni */
my_unicase_default, /* caseinfo */
NULL, /* state_map */
NULL, /* ident_map */
8, /* strxfrm_multiply */
1, /* caseup_multiply */
1, /* casedn_multiply */
2, /* mbminlen */
2, /* mbmaxlen */
9, /* min_sort_char */
@ -8211,9 +8229,12 @@ CHARSET_INFO my_charset_ucs2_estonian_uca_ci=
NULL, /* sort_order_big*/
NULL, /* tab_to_uni */
NULL, /* tab_from_uni */
my_unicase_default, /* caseinfo */
NULL, /* state_map */
NULL, /* ident_map */
8, /* strxfrm_multiply */
1, /* caseup_multiply */
1, /* casedn_multiply */
2, /* mbminlen */
2, /* mbmaxlen */
9, /* min_sort_char */
@ -8238,9 +8259,12 @@ CHARSET_INFO my_charset_ucs2_spanish_uca_ci=
NULL, /* sort_order_big*/
NULL, /* tab_to_uni */
NULL, /* tab_from_uni */
my_unicase_default, /* caseinfo */
NULL, /* state_map */
NULL, /* ident_map */
8, /* strxfrm_multiply */
1, /* caseup_multiply */
1, /* casedn_multiply */
2, /* mbminlen */
2, /* mbmaxlen */
9, /* min_sort_char */
@ -8265,9 +8289,12 @@ CHARSET_INFO my_charset_ucs2_swedish_uca_ci=
NULL, /* sort_order_big*/
NULL, /* tab_to_uni */
NULL, /* tab_from_uni */
my_unicase_default, /* caseinfo */
NULL, /* state_map */
NULL, /* ident_map */
8, /* strxfrm_multiply */
1, /* caseup_multiply */
1, /* casedn_multiply */
2, /* mbminlen */
2, /* mbmaxlen */
9, /* min_sort_char */
@ -8292,9 +8319,12 @@ CHARSET_INFO my_charset_ucs2_turkish_uca_ci=
NULL, /* sort_order_big*/
NULL, /* tab_to_uni */
NULL, /* tab_from_uni */
my_unicase_turkish, /* caseinfo */
NULL, /* state_map */
NULL, /* ident_map */
8, /* strxfrm_multiply */
1, /* caseup_multiply */
1, /* casedn_multiply */
2, /* mbminlen */
2, /* mbmaxlen */
9, /* min_sort_char */
@ -8319,9 +8349,12 @@ CHARSET_INFO my_charset_ucs2_czech_uca_ci=
NULL, /* sort_order_big*/
NULL, /* tab_to_uni */
NULL, /* tab_from_uni */
my_unicase_default, /* caseinfo */
NULL, /* state_map */
NULL, /* ident_map */
8, /* strxfrm_multiply */
1, /* caseup_multiply */
1, /* casedn_multiply */
2, /* mbminlen */
2, /* mbmaxlen */
9, /* min_sort_char */
@ -8347,9 +8380,12 @@ CHARSET_INFO my_charset_ucs2_danish_uca_ci=
NULL, /* sort_order_big*/
NULL, /* tab_to_uni */
NULL, /* tab_from_uni */
my_unicase_default, /* caseinfo */
NULL, /* state_map */
NULL, /* ident_map */
8, /* strxfrm_multiply */
1, /* caseup_multiply */
1, /* casedn_multiply */
2, /* mbminlen */
2, /* mbmaxlen */
9, /* min_sort_char */
@ -8374,9 +8410,12 @@ CHARSET_INFO my_charset_ucs2_lithuanian_uca_ci=
NULL, /* sort_order_big*/
NULL, /* tab_to_uni */
NULL, /* tab_from_uni */
my_unicase_default, /* caseinfo */
NULL, /* state_map */
NULL, /* ident_map */
8, /* strxfrm_multiply */
1, /* caseup_multiply */
1, /* casedn_multiply */
2, /* mbminlen */
2, /* mbmaxlen */
9, /* min_sort_char */
@ -8401,9 +8440,12 @@ CHARSET_INFO my_charset_ucs2_slovak_uca_ci=
NULL, /* sort_order_big*/
NULL, /* tab_to_uni */
NULL, /* tab_from_uni */
my_unicase_default, /* caseinfo */
NULL, /* state_map */
NULL, /* ident_map */
8, /* strxfrm_multiply */
1, /* caseup_multiply */
1, /* casedn_multiply */
2, /* mbminlen */
2, /* mbmaxlen */
9, /* min_sort_char */
@ -8428,9 +8470,12 @@ CHARSET_INFO my_charset_ucs2_spanish2_uca_ci=
NULL, /* sort_order_big*/
NULL, /* tab_to_uni */
NULL, /* tab_from_uni */
my_unicase_default, /* caseinfo */
NULL, /* state_map */
NULL, /* ident_map */
8, /* strxfrm_multiply */
1, /* caseup_multiply */
1, /* casedn_multiply */
2, /* mbminlen */
2, /* mbmaxlen */
9, /* min_sort_char */
@ -8456,9 +8501,12 @@ CHARSET_INFO my_charset_ucs2_roman_uca_ci=
NULL, /* sort_order_big*/
NULL, /* tab_to_uni */
NULL, /* tab_from_uni */
my_unicase_default, /* caseinfo */
NULL, /* state_map */
NULL, /* ident_map */
8, /* strxfrm_multiply */
1, /* caseup_multiply */
1, /* casedn_multiply */
2, /* mbminlen */
2, /* mbmaxlen */
9, /* min_sort_char */
@ -8484,9 +8532,12 @@ CHARSET_INFO my_charset_ucs2_persian_uca_ci=
NULL, /* sort_order_big*/
NULL, /* tab_to_uni */
NULL, /* tab_from_uni */
my_unicase_default, /* caseinfo */
NULL, /* state_map */
NULL, /* ident_map */
8, /* strxfrm_multiply */
1, /* caseup_multiply */
1, /* casedn_multiply */
2, /* mbminlen */
2, /* mbmaxlen */
9, /* min_sort_char */
@ -8559,9 +8610,12 @@ CHARSET_INFO my_charset_utf8_general_uca_ci=
uca_weight, /* sort_order_big*/
NULL, /* tab_to_uni */
NULL, /* tab_from_uni */
my_unicase_default, /* caseinfo */
NULL, /* state_map */
NULL, /* ident_map */
8, /* strxfrm_multiply */
1, /* caseup_multiply */
1, /* casedn_multiply */
1, /* mbminlen */
3, /* mbmaxlen */
9, /* min_sort_char */
@ -8587,9 +8641,12 @@ CHARSET_INFO my_charset_utf8_icelandic_uca_ci=
NULL, /* sort_order_big*/
NULL, /* tab_to_uni */
NULL, /* tab_from_uni */
my_unicase_default, /* caseinfo */
NULL, /* state_map */
NULL, /* ident_map */
8, /* strxfrm_multiply */
1, /* caseup_multiply */
1, /* casedn_multiply */
1, /* mbminlen */
3, /* mbmaxlen */
9, /* min_sort_char */
@ -8614,9 +8671,12 @@ CHARSET_INFO my_charset_utf8_latvian_uca_ci=
NULL, /* sort_order_big*/
NULL, /* tab_to_uni */
NULL, /* tab_from_uni */
my_unicase_default, /* caseinfo */
NULL, /* state_map */
NULL, /* ident_map */
8, /* strxfrm_multiply */
1, /* caseup_multiply */
1, /* casedn_multiply */
1, /* mbminlen */
3, /* mbmaxlen */
9, /* min_sort_char */
@ -8641,9 +8701,12 @@ CHARSET_INFO my_charset_utf8_romanian_uca_ci=
NULL, /* sort_order_big*/
NULL, /* tab_to_uni */
NULL, /* tab_from_uni */
my_unicase_default, /* caseinfo */
NULL, /* state_map */
NULL, /* ident_map */
8, /* strxfrm_multiply */
1, /* caseup_multiply */
1, /* casedn_multiply */
1, /* mbminlen */
3, /* mbmaxlen */
9, /* min_sort_char */
@ -8668,9 +8731,12 @@ CHARSET_INFO my_charset_utf8_slovenian_uca_ci=
NULL, /* sort_order_big*/
NULL, /* tab_to_uni */
NULL, /* tab_from_uni */
my_unicase_default, /* caseinfo */
NULL, /* state_map */
NULL, /* ident_map */
8, /* strxfrm_multiply */
1, /* caseup_multiply */
1, /* casedn_multiply */
1, /* mbminlen */
3, /* mbmaxlen */
9, /* min_sort_char */
@ -8695,9 +8761,12 @@ CHARSET_INFO my_charset_utf8_polish_uca_ci=
NULL, /* sort_order_big*/
NULL, /* tab_to_uni */
NULL, /* tab_from_uni */
my_unicase_default, /* caseinfo */
NULL, /* state_map */
NULL, /* ident_map */
8, /* strxfrm_multiply */
1, /* caseup_multiply */
1, /* casedn_multiply */
1, /* mbminlen */
3, /* mbmaxlen */
9, /* min_sort_char */
@ -8722,9 +8791,12 @@ CHARSET_INFO my_charset_utf8_estonian_uca_ci=
NULL, /* sort_order_big*/
NULL, /* tab_to_uni */
NULL, /* tab_from_uni */
my_unicase_default, /* caseinfo */
NULL, /* state_map */
NULL, /* ident_map */
8, /* strxfrm_multiply */
1, /* caseup_multiply */
1, /* casedn_multiply */
1, /* mbminlen */
3, /* mbmaxlen */
9, /* min_sort_char */
@ -8749,9 +8821,12 @@ CHARSET_INFO my_charset_utf8_spanish_uca_ci=
NULL, /* sort_order_big*/
NULL, /* tab_to_uni */
NULL, /* tab_from_uni */
my_unicase_default, /* caseinfo */
NULL, /* state_map */
NULL, /* ident_map */
8, /* strxfrm_multiply */
1, /* caseup_multiply */
1, /* casedn_multiply */
1, /* mbminlen */
3, /* mbmaxlen */
9, /* min_sort_char */
@ -8776,9 +8851,12 @@ CHARSET_INFO my_charset_utf8_swedish_uca_ci=
NULL, /* sort_order_big*/
NULL, /* tab_to_uni */
NULL, /* tab_from_uni */
my_unicase_default, /* caseinfo */
NULL, /* state_map */
NULL, /* ident_map */
8, /* strxfrm_multiply */
1, /* caseup_multiply */
1, /* casedn_multiply */
1, /* mbminlen */
3, /* mbmaxlen */
9, /* min_sort_char */
@ -8803,9 +8881,12 @@ CHARSET_INFO my_charset_utf8_turkish_uca_ci=
NULL, /* sort_order_big*/
NULL, /* tab_to_uni */
NULL, /* tab_from_uni */
my_unicase_turkish, /* caseinfo */
NULL, /* state_map */
NULL, /* ident_map */
8, /* strxfrm_multiply */
2, /* caseup_multiply */
2, /* casedn_multiply */
1, /* mbminlen */
3, /* mbmaxlen */
9, /* min_sort_char */
@ -8830,9 +8911,12 @@ CHARSET_INFO my_charset_utf8_czech_uca_ci=
NULL, /* sort_order_big*/
NULL, /* tab_to_uni */
NULL, /* tab_from_uni */
my_unicase_default, /* caseinfo */
NULL, /* state_map */
NULL, /* ident_map */
8, /* strxfrm_multiply */
1, /* caseup_multiply */
1, /* casedn_multiply */
1, /* mbminlen */
3, /* mbmaxlen */
9, /* min_sort_char */
@ -8858,9 +8942,12 @@ CHARSET_INFO my_charset_utf8_danish_uca_ci=
NULL, /* sort_order_big*/
NULL, /* tab_to_uni */
NULL, /* tab_from_uni */
my_unicase_default, /* caseinfo */
NULL, /* state_map */
NULL, /* ident_map */
8, /* strxfrm_multiply */
1, /* caseup_multiply */
1, /* casedn_multiply */
1, /* mbminlen */
3, /* mbmaxlen */
9, /* min_sort_char */
@ -8885,9 +8972,12 @@ CHARSET_INFO my_charset_utf8_lithuanian_uca_ci=
NULL, /* sort_order_big*/
NULL, /* tab_to_uni */
NULL, /* tab_from_uni */
my_unicase_default, /* caseinfo */
NULL, /* state_map */
NULL, /* ident_map */
8, /* strxfrm_multiply */
1, /* caseup_multiply */
1, /* casedn_multiply */
1, /* mbminlen */
3, /* mbmaxlen */
9, /* min_sort_char */
@ -8912,9 +9002,12 @@ CHARSET_INFO my_charset_utf8_slovak_uca_ci=
NULL, /* sort_order_big*/
NULL, /* tab_to_uni */
NULL, /* tab_from_uni */
my_unicase_default, /* caseinfo */
NULL, /* state_map */
NULL, /* ident_map */
8, /* strxfrm_multiply */
1, /* caseup_multiply */
1, /* casedn_multiply */
1, /* mbminlen */
3, /* mbmaxlen */
9, /* min_sort_char */
@ -8939,9 +9032,12 @@ CHARSET_INFO my_charset_utf8_spanish2_uca_ci=
NULL, /* sort_order_big*/
NULL, /* tab_to_uni */
NULL, /* tab_from_uni */
my_unicase_default, /* caseinfo */
NULL, /* state_map */
NULL, /* ident_map */
8, /* strxfrm_multiply */
1, /* caseup_multiply */
1, /* casedn_multiply */
1, /* mbminlen */
3, /* mbmaxlen */
9, /* min_sort_char */
@ -8966,9 +9062,12 @@ CHARSET_INFO my_charset_utf8_roman_uca_ci=
NULL, /* sort_order_big*/
NULL, /* tab_to_uni */
NULL, /* tab_from_uni */
my_unicase_default, /* caseinfo */
NULL, /* state_map */
NULL, /* ident_map */
8, /* strxfrm_multiply */
1, /* caseup_multiply */
1, /* casedn_multiply */
1, /* mbminlen */
3, /* mbmaxlen */
9, /* min_sort_char */
@ -8993,9 +9092,12 @@ CHARSET_INFO my_charset_utf8_persian_uca_ci=
NULL, /* sort_order_big*/
NULL, /* tab_to_uni */
NULL, /* tab_from_uni */
my_unicase_default, /* caseinfo */
NULL, /* state_map */
NULL, /* ident_map */
8, /* strxfrm_multiply */
1, /* caseup_multiply */
1, /* casedn_multiply */
1, /* mbminlen */
3, /* mbmaxlen */
9, /* min_sort_char */

View File

@ -30,7 +30,6 @@
#define EILSEQ ENOENT
#endif
extern MY_UNICASE_INFO *uni_plane[256];
static uchar ctype_ucs2[] = {
0,
@ -113,20 +112,26 @@ static int my_uni_ucs2(CHARSET_INFO *cs __attribute__((unused)) ,
}
static void my_caseup_ucs2(CHARSET_INFO *cs, char *s, uint slen)
static uint my_caseup_ucs2(CHARSET_INFO *cs, char *src, uint srclen,
char *dst __attribute__((unused)),
uint dstlen __attribute__((unused)))
{
my_wc_t wc;
int res;
char *e=s+slen;
while ((s < e) && (res=my_ucs2_uni(cs,&wc, (uchar *)s, (uchar*)e))>0 )
char *srcend= src + srclen;
MY_UNICASE_INFO **uni_plane= cs->caseinfo;
DBUG_ASSERT(src == dst && srclen == dstlen);
while ((src < srcend) &&
(res= my_ucs2_uni(cs, &wc, (uchar *)src, (uchar*) srcend)) > 0)
{
int plane = (wc>>8) & 0xFF;
wc = uni_plane[plane] ? uni_plane[plane][wc & 0xFF].toupper : wc;
if (res != my_uni_ucs2(cs,wc,(uchar*)s,(uchar*)e))
int plane= (wc>>8) & 0xFF;
wc= uni_plane[plane] ? uni_plane[plane][wc & 0xFF].toupper : wc;
if (res != my_uni_ucs2(cs, wc, (uchar*) src, (uchar*) srcend))
break;
s+=res;
src+= res;
}
return srclen;
}
@ -136,6 +141,7 @@ static void my_hash_sort_ucs2(CHARSET_INFO *cs, const uchar *s, uint slen,
my_wc_t wc;
int res;
const uchar *e=s+slen;
MY_UNICASE_INFO **uni_plane= cs->caseinfo;
while (e > s+1 && e[-1] == ' ' && e[-2] == '\0')
e-= 2;
@ -160,22 +166,26 @@ static void my_caseup_str_ucs2(CHARSET_INFO * cs __attribute__((unused)),
static void my_casedn_ucs2(CHARSET_INFO *cs, char *s, uint slen)
static uint my_casedn_ucs2(CHARSET_INFO *cs, char *src, uint srclen,
char *dst __attribute__((unused)),
uint dstlen __attribute__((unused)))
{
my_wc_t wc;
int res;
char *e=s+slen;
char *srcend= src + srclen;
MY_UNICASE_INFO **uni_plane= cs->caseinfo;
DBUG_ASSERT(src == dst && srclen == dstlen);
while ((s < e) && (res=my_ucs2_uni(cs, &wc, (uchar*)s, (uchar*)e))>0)
while ((src < srcend) &&
(res= my_ucs2_uni(cs, &wc, (uchar*) src, (uchar*) srcend)) > 0)
{
int plane = (wc>>8) & 0xFF;
wc = uni_plane[plane] ? uni_plane[plane][wc & 0xFF].tolower : wc;
if (res != my_uni_ucs2(cs, wc, (uchar*)s, (uchar*)e))
{
int plane= (wc>>8) & 0xFF;
wc= uni_plane[plane] ? uni_plane[plane][wc & 0xFF].tolower : wc;
if (res != my_uni_ucs2(cs, wc, (uchar*) src, (uchar*) srcend))
break;
}
s+=res;
src+= res;
}
return srclen;
}
static void my_casedn_str_ucs2(CHARSET_INFO *cs __attribute__((unused)),
@ -193,6 +203,7 @@ static int my_strnncoll_ucs2(CHARSET_INFO *cs,
my_wc_t s_wc,t_wc;
const uchar *se=s+slen;
const uchar *te=t+tlen;
MY_UNICASE_INFO **uni_plane= cs->caseinfo;
while ( s < se && t < te )
{
@ -256,6 +267,7 @@ static int my_strnncollsp_ucs2(CHARSET_INFO *cs __attribute__((unused)),
{
const uchar *se, *te;
uint minlen;
MY_UNICASE_INFO **uni_plane= cs->caseinfo;
/* extra safety to make sure the lengths are even numbers */
slen&= ~1;
@ -305,6 +317,7 @@ static int my_strncasecmp_ucs2(CHARSET_INFO *cs,
my_wc_t s_wc,t_wc;
const char *se=s+len;
const char *te=t+len;
MY_UNICASE_INFO **uni_plane= cs->caseinfo;
while ( s < se && t < te )
{
@ -352,6 +365,7 @@ static int my_strnxfrm_ucs2(CHARSET_INFO *cs,
int plane;
uchar *de = dst + dstlen;
const uchar *se = src + srclen;
MY_UNICASE_INFO **uni_plane= cs->caseinfo;
while( src < se && dst < de )
{
@ -1310,6 +1324,7 @@ int my_wildcmp_ucs2_ci(CHARSET_INFO *cs,
const char *wildstr,const char *wildend,
int escape, int w_one, int w_many)
{
MY_UNICASE_INFO **uni_plane= cs->caseinfo;
return my_wildcmp_unicode(cs,str,str_end,wildstr,wildend,
escape,w_one,w_many,uni_plane);
}
@ -1596,9 +1611,12 @@ CHARSET_INFO my_charset_ucs2_general_ci=
NULL, /* sort_order_big*/
NULL, /* tab_to_uni */
NULL, /* tab_from_uni */
my_unicase_default, /* caseinfo */
NULL, /* state_map */
NULL, /* ident_map */
1, /* strxfrm_multiply */
1, /* caseup_multiply */
1, /* casedn_multiply */
2, /* mbminlen */
2, /* mbmaxlen */
0, /* min_sort_char */
@ -1623,9 +1641,12 @@ CHARSET_INFO my_charset_ucs2_bin=
NULL, /* sort_order_big*/
NULL, /* tab_to_uni */
NULL, /* tab_from_uni */
my_unicase_default, /* caseinfo */
NULL, /* state_map */
NULL, /* ident_map */
1, /* strxfrm_multiply */
1, /* caseup_multiply */
1, /* casedn_multiply */
2, /* mbminlen */
2, /* mbmaxlen */
0, /* min_sort_char */

View File

@ -8566,9 +8566,12 @@ CHARSET_INFO my_charset_ujis_japanese_ci=
NULL, /* contractions */
NULL, /* tab_to_uni */
NULL, /* tab_from_uni */
my_unicase_default, /* caseinfo */
NULL, /* state_map */
NULL, /* ident_map */
1, /* strxfrm_multiply */
1, /* caseup_multiply */
1, /* casedn_multiply */
1, /* mbminlen */
3, /* mbmaxlen */
0, /* min_sort_char */
@ -8594,9 +8597,12 @@ CHARSET_INFO my_charset_ujis_bin=
NULL, /* sort_order_big*/
NULL, /* tab_to_uni */
NULL, /* tab_from_uni */
my_unicase_default, /* caseinfo */
NULL, /* state_map */
NULL, /* ident_map */
1, /* strxfrm_multiply */
1, /* caseup_multiply */
1, /* casedn_multiply */
1, /* mbminlen */
3, /* mbmaxlen */
0, /* min_sort_char */

View File

@ -172,6 +172,8 @@ static MY_UNICASE_INFO plane00[]={
{0x00DE,0x00FE,0x00DE}, {0x0178,0x00FF,0x0059}
};
static MY_UNICASE_INFO plane01[]={
{0x0100,0x0101,0x0041}, {0x0100,0x0101,0x0041},
{0x0102,0x0103,0x0041}, {0x0102,0x0103,0x0041},
@ -1482,7 +1484,7 @@ static MY_UNICASE_INFO planeFF[]={
{0xFFFE,0xFFFE,0xFFFE}, {0xFFFF,0xFFFF,0xFFFF}
};
MY_UNICASE_INFO *uni_plane[256]={
MY_UNICASE_INFO *my_unicase_default[256]={
plane00, plane01, plane02, plane03, plane04, plane05, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
@ -1519,6 +1521,186 @@ MY_UNICASE_INFO *uni_plane[256]={
};
/*
Turkish lower/upper mapping:
1. LOWER(0x0049 LATIN CAPITAL LETTER I) ->
0x0131 LATIN SMALL LETTER DOTLESS I
2. UPPER(0x0069 LATIN SMALL LETTER I) ->
0x0130 LATIN CAPITAL LETTER I WITH DOT ABOVE
*/
static MY_UNICASE_INFO turk00[]=
{
{0x0000,0x0000,0x0000}, {0x0001,0x0001,0x0001},
{0x0002,0x0002,0x0002}, {0x0003,0x0003,0x0003},
{0x0004,0x0004,0x0004}, {0x0005,0x0005,0x0005},
{0x0006,0x0006,0x0006}, {0x0007,0x0007,0x0007},
{0x0008,0x0008,0x0008}, {0x0009,0x0009,0x0009},
{0x000A,0x000A,0x000A}, {0x000B,0x000B,0x000B},
{0x000C,0x000C,0x000C}, {0x000D,0x000D,0x000D},
{0x000E,0x000E,0x000E}, {0x000F,0x000F,0x000F},
{0x0010,0x0010,0x0010}, {0x0011,0x0011,0x0011},
{0x0012,0x0012,0x0012}, {0x0013,0x0013,0x0013},
{0x0014,0x0014,0x0014}, {0x0015,0x0015,0x0015},
{0x0016,0x0016,0x0016}, {0x0017,0x0017,0x0017},
{0x0018,0x0018,0x0018}, {0x0019,0x0019,0x0019},
{0x001A,0x001A,0x001A}, {0x001B,0x001B,0x001B},
{0x001C,0x001C,0x001C}, {0x001D,0x001D,0x001D},
{0x001E,0x001E,0x001E}, {0x001F,0x001F,0x001F},
{0x0020,0x0020,0x0020}, {0x0021,0x0021,0x0021},
{0x0022,0x0022,0x0022}, {0x0023,0x0023,0x0023},
{0x0024,0x0024,0x0024}, {0x0025,0x0025,0x0025},
{0x0026,0x0026,0x0026}, {0x0027,0x0027,0x0027},
{0x0028,0x0028,0x0028}, {0x0029,0x0029,0x0029},
{0x002A,0x002A,0x002A}, {0x002B,0x002B,0x002B},
{0x002C,0x002C,0x002C}, {0x002D,0x002D,0x002D},
{0x002E,0x002E,0x002E}, {0x002F,0x002F,0x002F},
{0x0030,0x0030,0x0030}, {0x0031,0x0031,0x0031},
{0x0032,0x0032,0x0032}, {0x0033,0x0033,0x0033},
{0x0034,0x0034,0x0034}, {0x0035,0x0035,0x0035},
{0x0036,0x0036,0x0036}, {0x0037,0x0037,0x0037},
{0x0038,0x0038,0x0038}, {0x0039,0x0039,0x0039},
{0x003A,0x003A,0x003A}, {0x003B,0x003B,0x003B},
{0x003C,0x003C,0x003C}, {0x003D,0x003D,0x003D},
{0x003E,0x003E,0x003E}, {0x003F,0x003F,0x003F},
{0x0040,0x0040,0x0040}, {0x0041,0x0061,0x0041},
{0x0042,0x0062,0x0042}, {0x0043,0x0063,0x0043},
{0x0044,0x0064,0x0044}, {0x0045,0x0065,0x0045},
{0x0046,0x0066,0x0046}, {0x0047,0x0067,0x0047},
{0x0048,0x0068,0x0048}, {0x0049,0x0131,0x0049},
{0x004A,0x006A,0x004A}, {0x004B,0x006B,0x004B},
{0x004C,0x006C,0x004C}, {0x004D,0x006D,0x004D},
{0x004E,0x006E,0x004E}, {0x004F,0x006F,0x004F},
{0x0050,0x0070,0x0050}, {0x0051,0x0071,0x0051},
{0x0052,0x0072,0x0052}, {0x0053,0x0073,0x0053},
{0x0054,0x0074,0x0054}, {0x0055,0x0075,0x0055},
{0x0056,0x0076,0x0056}, {0x0057,0x0077,0x0057},
{0x0058,0x0078,0x0058}, {0x0059,0x0079,0x0059},
{0x005A,0x007A,0x005A}, {0x005B,0x005B,0x005B},
{0x005C,0x005C,0x005C}, {0x005D,0x005D,0x005D},
{0x005E,0x005E,0x005E}, {0x005F,0x005F,0x005F},
{0x0060,0x0060,0x0060}, {0x0041,0x0061,0x0041},
{0x0042,0x0062,0x0042}, {0x0043,0x0063,0x0043},
{0x0044,0x0064,0x0044}, {0x0045,0x0065,0x0045},
{0x0046,0x0066,0x0046}, {0x0047,0x0067,0x0047},
{0x0048,0x0068,0x0048}, {0x0130,0x0069,0x0049},
{0x004A,0x006A,0x004A}, {0x004B,0x006B,0x004B},
{0x004C,0x006C,0x004C}, {0x004D,0x006D,0x004D},
{0x004E,0x006E,0x004E}, {0x004F,0x006F,0x004F},
{0x0050,0x0070,0x0050}, {0x0051,0x0071,0x0051},
{0x0052,0x0072,0x0052}, {0x0053,0x0073,0x0053},
{0x0054,0x0074,0x0054}, {0x0055,0x0075,0x0055},
{0x0056,0x0076,0x0056}, {0x0057,0x0077,0x0057},
{0x0058,0x0078,0x0058}, {0x0059,0x0079,0x0059},
{0x005A,0x007A,0x005A}, {0x007B,0x007B,0x007B},
{0x007C,0x007C,0x007C}, {0x007D,0x007D,0x007D},
{0x007E,0x007E,0x007E}, {0x007F,0x007F,0x007F},
{0x0080,0x0080,0x0080}, {0x0081,0x0081,0x0081},
{0x0082,0x0082,0x0082}, {0x0083,0x0083,0x0083},
{0x0084,0x0084,0x0084}, {0x0085,0x0085,0x0085},
{0x0086,0x0086,0x0086}, {0x0087,0x0087,0x0087},
{0x0088,0x0088,0x0088}, {0x0089,0x0089,0x0089},
{0x008A,0x008A,0x008A}, {0x008B,0x008B,0x008B},
{0x008C,0x008C,0x008C}, {0x008D,0x008D,0x008D},
{0x008E,0x008E,0x008E}, {0x008F,0x008F,0x008F},
{0x0090,0x0090,0x0090}, {0x0091,0x0091,0x0091},
{0x0092,0x0092,0x0092}, {0x0093,0x0093,0x0093},
{0x0094,0x0094,0x0094}, {0x0095,0x0095,0x0095},
{0x0096,0x0096,0x0096}, {0x0097,0x0097,0x0097},
{0x0098,0x0098,0x0098}, {0x0099,0x0099,0x0099},
{0x009A,0x009A,0x009A}, {0x009B,0x009B,0x009B},
{0x009C,0x009C,0x009C}, {0x009D,0x009D,0x009D},
{0x009E,0x009E,0x009E}, {0x009F,0x009F,0x009F},
{0x00A0,0x00A0,0x00A0}, {0x00A1,0x00A1,0x00A1},
{0x00A2,0x00A2,0x00A2}, {0x00A3,0x00A3,0x00A3},
{0x00A4,0x00A4,0x00A4}, {0x00A5,0x00A5,0x00A5},
{0x00A6,0x00A6,0x00A6}, {0x00A7,0x00A7,0x00A7},
{0x00A8,0x00A8,0x00A8}, {0x00A9,0x00A9,0x00A9},
{0x00AA,0x00AA,0x00AA}, {0x00AB,0x00AB,0x00AB},
{0x00AC,0x00AC,0x00AC}, {0x00AD,0x00AD,0x00AD},
{0x00AE,0x00AE,0x00AE}, {0x00AF,0x00AF,0x00AF},
{0x00B0,0x00B0,0x00B0}, {0x00B1,0x00B1,0x00B1},
{0x00B2,0x00B2,0x00B2}, {0x00B3,0x00B3,0x00B3},
{0x00B4,0x00B4,0x00B4}, {0x039C,0x00B5,0x039C},
{0x00B6,0x00B6,0x00B6}, {0x00B7,0x00B7,0x00B7},
{0x00B8,0x00B8,0x00B8}, {0x00B9,0x00B9,0x00B9},
{0x00BA,0x00BA,0x00BA}, {0x00BB,0x00BB,0x00BB},
{0x00BC,0x00BC,0x00BC}, {0x00BD,0x00BD,0x00BD},
{0x00BE,0x00BE,0x00BE}, {0x00BF,0x00BF,0x00BF},
{0x00C0,0x00E0,0x0041}, {0x00C1,0x00E1,0x0041},
{0x00C2,0x00E2,0x0041}, {0x00C3,0x00E3,0x0041},
{0x00C4,0x00E4,0x0041}, {0x00C5,0x00E5,0x0041},
{0x00C6,0x00E6,0x00C6}, {0x00C7,0x00E7,0x0043},
{0x00C8,0x00E8,0x0045}, {0x00C9,0x00E9,0x0045},
{0x00CA,0x00EA,0x0045}, {0x00CB,0x00EB,0x0045},
{0x00CC,0x00EC,0x0049}, {0x00CD,0x00ED,0x0049},
{0x00CE,0x00EE,0x0049}, {0x00CF,0x00EF,0x0049},
{0x00D0,0x00F0,0x00D0}, {0x00D1,0x00F1,0x004E},
{0x00D2,0x00F2,0x004F}, {0x00D3,0x00F3,0x004F},
{0x00D4,0x00F4,0x004F}, {0x00D5,0x00F5,0x004F},
{0x00D6,0x00F6,0x004F}, {0x00D7,0x00D7,0x00D7},
{0x00D8,0x00F8,0x00D8}, {0x00D9,0x00F9,0x0055},
{0x00DA,0x00FA,0x0055}, {0x00DB,0x00FB,0x0055},
{0x00DC,0x00FC,0x0055}, {0x00DD,0x00FD,0x0059},
{0x00DE,0x00FE,0x00DE}, {0x00DF,0x00DF,0x00DF},
{0x00C0,0x00E0,0x0041}, {0x00C1,0x00E1,0x0041},
{0x00C2,0x00E2,0x0041}, {0x00C3,0x00E3,0x0041},
{0x00C4,0x00E4,0x0041}, {0x00C5,0x00E5,0x0041},
{0x00C6,0x00E6,0x00C6}, {0x00C7,0x00E7,0x0043},
{0x00C8,0x00E8,0x0045}, {0x00C9,0x00E9,0x0045},
{0x00CA,0x00EA,0x0045}, {0x00CB,0x00EB,0x0045},
{0x00CC,0x00EC,0x0049}, {0x00CD,0x00ED,0x0049},
{0x00CE,0x00EE,0x0049}, {0x00CF,0x00EF,0x0049},
{0x00D0,0x00F0,0x00D0}, {0x00D1,0x00F1,0x004E},
{0x00D2,0x00F2,0x004F}, {0x00D3,0x00F3,0x004F},
{0x00D4,0x00F4,0x004F}, {0x00D5,0x00F5,0x004F},
{0x00D6,0x00F6,0x004F}, {0x00F7,0x00F7,0x00F7},
{0x00D8,0x00F8,0x00D8}, {0x00D9,0x00F9,0x0055},
{0x00DA,0x00FA,0x0055}, {0x00DB,0x00FB,0x0055},
{0x00DC,0x00FC,0x0055}, {0x00DD,0x00FD,0x0059},
{0x00DE,0x00FE,0x00DE}, {0x0178,0x00FF,0x0059}
};
MY_UNICASE_INFO *my_unicase_turkish[256]=
{
turk00, plane01, plane02, plane03, plane04, plane05, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, plane1E, plane1F,
NULL, plane21, NULL, NULL, plane24, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, planeFF
};
/*
** Compare string against string with wildcard
** This function is used in UTF8 and UCS2
@ -1907,20 +2089,26 @@ static int my_uni_utf8 (CHARSET_INFO *cs __attribute__((unused)) ,
}
static void my_caseup_utf8(CHARSET_INFO *cs, char *s, uint slen)
static uint my_caseup_utf8(CHARSET_INFO *cs, char *src, uint srclen,
char *dst, uint dstlen)
{
my_wc_t wc;
int res;
char *e=s+slen;
int srcres, dstres;
char *srcend= src + srclen, *dstend= dst + dstlen, *dst0= dst;
MY_UNICASE_INFO **uni_plane= cs->caseinfo;
DBUG_ASSERT(src != dst || cs->caseup_multiply == 1);
while ((s < e) && (res=my_utf8_uni(cs,&wc, (uchar *)s, (uchar*)e))>0 )
while ((src < srcend) &&
(srcres= my_utf8_uni(cs, &wc, (uchar *) src, (uchar*) srcend)) > 0)
{
int plane = (wc>>8) & 0xFF;
wc = uni_plane[plane] ? uni_plane[plane][wc & 0xFF].toupper : wc;
if (res != my_uni_utf8(cs,wc,(uchar*)s,(uchar*)e))
int plane= (wc>>8) & 0xFF;
wc= uni_plane[plane] ? uni_plane[plane][wc & 0xFF].toupper : wc;
if ((dstres= my_uni_utf8(cs, wc, (uchar*) dst, (uchar*) dstend)) <= 0)
break;
s+=res;
src+= srcres;
dst+= dstres;
}
return dst - dst0;
}
static void my_hash_sort_utf8(CHARSET_INFO *cs, const uchar *s, uint slen,
@ -1929,6 +2117,7 @@ static void my_hash_sort_utf8(CHARSET_INFO *cs, const uchar *s, uint slen,
my_wc_t wc;
int res;
const uchar *e=s+slen;
MY_UNICASE_INFO **uni_plane= cs->caseinfo;
/*
Remove end space. We have to do this to be able to compare
@ -1952,31 +2141,37 @@ static void my_hash_sort_utf8(CHARSET_INFO *cs, const uchar *s, uint slen,
static void my_caseup_str_utf8(CHARSET_INFO * cs, char * s)
{
my_caseup_utf8(cs, s, strlen(s));
uint len= strlen(s);
my_caseup_utf8(cs, s, len, s, len);
}
static void my_casedn_utf8(CHARSET_INFO *cs, char *s, uint slen)
static uint my_casedn_utf8(CHARSET_INFO *cs, char *src, uint srclen,
char *dst, uint dstlen)
{
my_wc_t wc;
int res;
char *e=s+slen;
int srcres, dstres;
char *srcend= src + srclen, *dstend= dst + dstlen, *dst0= dst;
MY_UNICASE_INFO **uni_plane= cs->caseinfo;
DBUG_ASSERT(src != dst || cs->casedn_multiply == 1);
while ((s < e) && (res=my_utf8_uni(cs, &wc, (uchar*)s, (uchar*)e))>0)
while ((src < srcend) &&
(srcres= my_utf8_uni(cs, &wc, (uchar*) src, (uchar*)srcend)) > 0)
{
int plane = (wc>>8) & 0xFF;
wc = uni_plane[plane] ? uni_plane[plane][wc & 0xFF].tolower : wc;
if (res != my_uni_utf8(cs, wc, (uchar*)s, (uchar*)e))
{
int plane= (wc>>8) & 0xFF;
wc= uni_plane[plane] ? uni_plane[plane][wc & 0xFF].tolower : wc;
if ((dstres= my_uni_utf8(cs, wc, (uchar*) dst, (uchar*) dstend)) <= 0)
break;
}
s+=res;
src+= srcres;
dst+= dstres;
}
return dst - dst0;
}
static void my_casedn_str_utf8(CHARSET_INFO *cs, char * s)
{
my_casedn_utf8(cs, s, strlen(s));
uint len= strlen(s);
my_casedn_utf8(cs, s, len, s, len);
}
@ -1989,6 +2184,7 @@ static int my_strnncoll_utf8(CHARSET_INFO *cs,
my_wc_t s_wc,t_wc;
const uchar *se=s+slen;
const uchar *te=t+tlen;
MY_UNICASE_INFO **uni_plane= cs->caseinfo;
while ( s < se && t < te )
{
@ -2057,6 +2253,7 @@ static int my_strnncollsp_utf8(CHARSET_INFO *cs,
int s_res, t_res, res;
my_wc_t s_wc,t_wc;
const uchar *se= s+slen, *te= t+tlen;
MY_UNICASE_INFO **uni_plane= cs->caseinfo;
#ifndef VARCHAR_WITH_DIFF_ENDSPACE_ARE_DIFFERENT_FOR_UNIQUE
diff_if_only_endspace_difference= 0;
@ -2144,6 +2341,7 @@ static int my_strnncollsp_utf8(CHARSET_INFO *cs,
static
int my_strcasecmp_utf8(CHARSET_INFO *cs, const char *s, const char *t)
{
MY_UNICASE_INFO **uni_plane= cs->caseinfo;
while (s[0] && t[0])
{
my_wc_t s_wc,t_wc;
@ -2228,6 +2426,7 @@ int my_wildcmp_utf8(CHARSET_INFO *cs,
const char *wildstr,const char *wildend,
int escape, int w_one, int w_many)
{
MY_UNICASE_INFO **uni_plane= cs->caseinfo;
return my_wildcmp_unicode(cs,str,str_end,wildstr,wildend,
escape,w_one,w_many,uni_plane);
}
@ -2249,6 +2448,7 @@ static int my_strnxfrm_utf8(CHARSET_INFO *cs,
uchar *de= dst + dstlen;
uchar *de_beg= de - 1;
const uchar *se = src + srclen;
MY_UNICASE_INFO **uni_plane= cs->caseinfo;
while (dst < de_beg)
{
@ -2367,9 +2567,12 @@ CHARSET_INFO my_charset_utf8_general_ci=
NULL, /* sort_order_big*/
NULL, /* tab_to_uni */
NULL, /* tab_from_uni */
my_unicase_default, /* caseinfo */
NULL, /* state_map */
NULL, /* ident_map */
1, /* strxfrm_multiply */
1, /* caseup_multiply */
1, /* casedn_multiply */
1, /* mbminlen */
3, /* mbmaxlen */
0, /* min_sort_char */
@ -2395,9 +2598,12 @@ CHARSET_INFO my_charset_utf8_bin=
NULL, /* sort_order_big*/
NULL, /* tab_to_uni */
NULL, /* tab_from_uni */
my_unicase_default, /* caseinfo */
NULL, /* state_map */
NULL, /* ident_map */
1, /* strxfrm_multiply */
1, /* caseup_multiply */
1, /* casedn_multiply */
1, /* mbminlen */
3, /* mbmaxlen */
0, /* min_sort_char */
@ -2561,9 +2767,12 @@ CHARSET_INFO my_charset_utf8_general_cs=
NULL, /* sort_order_big*/
NULL, /* tab_to_uni */
NULL, /* tab_from_uni */
my_unicase_default, /* caseinfo */
NULL, /* state_map */
NULL, /* ident_map */
1, /* strxfrm_multiply */
1, /* caseup_multiply */
1, /* casedn_multiply */
1, /* mbminlen */
3, /* mbmaxlen */
0, /* min_sort_char */

View File

@ -652,9 +652,12 @@ CHARSET_INFO my_charset_cp1250_czech_ci =
NULL, /* sort_order_big*/
tab_cp1250_uni, /* tab_to_uni */
idx_uni_cp1250, /* tab_from_uni */
my_unicase_default, /* caseinfo */
NULL, /* state_map */
NULL, /* ident_map */
2, /* strxfrm_multiply */
1, /* caseup_multiply */
1, /* casedn_multiply */
1, /* mbminlen */
1, /* mbmaxlen */
0, /* min_sort_char */