Commit 36947f19 authored by unknown's avatar unknown

Merge bk-internal.mysql.com:/home/bk/mysql-5.0

into mysql.com:/home/my/mysql-5.0


sql/mysql_priv.h:
  Auto merged
parents 8ae95213 22eeea04
......@@ -260,8 +260,6 @@ class String
}
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);
......
......@@ -37,16 +37,18 @@
namespace mySTL {
template<typename T, typename Deletor = void (*) (T*)>
template<typename T>
struct auto_ptr_ref {
typedef void (*Deletor)(T*);
T* ptr_;
Deletor del_;
auto_ptr_ref(T* p, Deletor d) : ptr_(p), del_(d) {}
};
template<typename T, typename Deletor = void (*) (T*)>
template<typename T>
class auto_ptr {
typedef void (*Deletor)(T*);
T* ptr_;
Deletor del_;
......
......@@ -718,7 +718,7 @@ void processReply(SSL& ssl)
mySTL::auto_ptr<input_buffer> buffered(ysDelete);
for (;;) {
mySTL::auto_ptr<input_buffer> tmp = DoProcessReply(ssl, buffered);
mySTL::auto_ptr<input_buffer> tmp(DoProcessReply(ssl, buffered));
if (tmp.get()) // had only part of a record's data, call again
buffered = tmp;
else
......
......@@ -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)))
......
......@@ -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;
}
......
......@@ -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;
......@@ -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;
......@@ -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;
}
......
......@@ -133,13 +133,14 @@ class Item_func_insert :public Item_str_func
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;
}
};
......
......@@ -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)
......
......@@ -261,8 +261,6 @@ class String
}
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);
......
......@@ -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 */
......
......@@ -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 */
......
......@@ -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 */
......
......@@ -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 */
......
......@@ -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 */
......
......@@ -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 */
......
......@@ -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 */
......
......@@ -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 */
......
......@@ -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 */
......
......@@ -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 */
......
......@@ -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)
......
......@@ -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);
}
......
......@@ -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 */
......
......@@ -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 */
......
This diff is collapsed.
......@@ -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 */
......
......@@ -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 */
......
This diff is collapsed.
......@@ -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 */
......
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