Merge abarkov@work.mysql.com:/home/bk/mysql-4.1

into bar.mysql.r18.ru:/usr/home/bar/mysql-4.1
This commit is contained in:
bar@bar.mysql.r18.ru 2003-01-31 13:49:18 +04:00
commit 41eb85658d
17 changed files with 150 additions and 1 deletions

View file

@ -92,6 +92,8 @@ typedef struct charset_info_st
uint strxfrm_multiply;
int (*strnncoll)(struct charset_info_st *,
const uchar *, uint, const uchar *, uint);
int (*strnncollsp)(struct charset_info_st *,
const uchar *, uint, const uchar *, uint);
int (*strnxfrm)(struct charset_info_st *,
uchar *, uint, const uchar *, uint);
my_bool (*like_range)(struct charset_info_st *,
@ -189,6 +191,9 @@ extern int my_strnxfrm_simple(CHARSET_INFO *, uchar *, uint, const uchar *,
extern int my_strnncoll_simple(CHARSET_INFO *, const uchar *, uint,
const uchar *, uint);
extern int my_strnncollsp_simple(CHARSET_INFO *, const uchar *, uint,
const uchar *, uint);
extern uint my_hash_caseup_simple(CHARSET_INFO *cs,
const byte *key, uint len);

View file

@ -59,6 +59,7 @@ static void simple_cs_init_functions(CHARSET_INFO *cs)
cs->strnxfrm = my_strnxfrm_simple;
cs->strnncoll = my_strnncoll_simple;
cs->strnncollsp = my_strnncollsp_simple;
cs->like_range = my_like_range_simple;
cs->wildcmp = my_wildcmp_8bit;
cs->mb_wc = my_mb_wc_8bit;

View file

@ -242,6 +242,16 @@ static int my_strnncoll_big5(CHARSET_INFO *cs __attribute__((unused)),
return (int) (len1-len2);
}
static
int my_strnncollsp_big5(CHARSET_INFO * cs,
const uchar *s, uint slen,
const uchar *t, uint tlen)
{
for ( ; slen && my_isspace(cs, s[slen-1]) ; slen--);
for ( ; tlen && my_isspace(cs, t[tlen-1]) ; tlen--);
return my_strnncoll_big5(cs,s,slen,t,tlen);
}
static int my_strnxfrm_big5(CHARSET_INFO *cs __attribute__((unused)),
uchar * dest, uint len,
const uchar * src, uint srclen)
@ -6236,6 +6246,7 @@ CHARSET_INFO my_charset_big5 =
NULL, /* tab_from_uni */
1, /* strxfrm_multiply */
my_strnncoll_big5,
my_strnncollsp_big5,
my_strnxfrm_big5,
my_like_range_big5,
my_wildcmp_mb,

View file

@ -284,6 +284,7 @@ CHARSET_INFO my_charset_bin =
NULL, /* tab_from_uni */
0, /* strxfrm_multiply */
my_strnncoll_binary, /* strnncoll */
my_strnncoll_binary,
my_strnxfrm_bin, /* strxnfrm */
my_like_range_simple, /* like_range */
my_wildcmp_bin, /* wildcmp */

View file

@ -593,6 +593,18 @@ static MY_UNI_IDX idx_uni_8859_2[]={
{0,0,NULL}
};
static
int my_strnncollsp_czech(CHARSET_INFO * cs,
const uchar *s, uint slen,
const uchar *t, uint tlen)
{
for ( ; slen && my_isspace(cs, s[slen-1]) ; slen--);
for ( ; tlen && my_isspace(cs, t[tlen-1]) ; tlen--);
return my_strnncoll_czech(cs,s,slen,t,tlen);
}
CHARSET_INFO my_charset_czech =
{
2, /* number */
@ -608,6 +620,7 @@ CHARSET_INFO my_charset_czech =
idx_uni_8859_2, /* tab_from_uni */
4, /* strxfrm_multiply */
my_strnncoll_czech,
my_strnncollsp_czech,
my_strnxfrm_czech,
my_like_range_czech,
my_wildcmp_8bit,

View file

@ -8654,6 +8654,7 @@ CHARSET_INFO my_charset_euc_kr =
NULL, /* tab_from_uni */
0, /* strxfrm_multiply */
my_strnncoll_simple,/* strnncoll */
my_strnncollsp_simple,
my_strnxfrm_simple, /* strnxfrm */
my_like_range_simple,/* like_range */
my_wildcmp_mb, /* wildcmp */

View file

@ -2820,6 +2820,7 @@ CHARSET_INFO compiled_charsets[] = {
idx_uni_8859_1, /* tab_from_uni */
0, /* strxfrm_multiply */
my_strnncoll_simple,/* strnncoll */
my_strnncollsp_simple,/* strnncollsp */
my_strnxfrm_simple, /* strnxfrm */
my_like_range_simple,/* like_range */
my_wildcmp_8bit, /* wildcmp */
@ -2868,6 +2869,7 @@ CHARSET_INFO compiled_charsets[] = {
idx_uni_cp1251, /* tab_from_uni */
0, /* strxfrm_multiply */
my_strnncoll_simple,/* strnncoll */
my_strnncollsp_simple,/* strnncollsp */
my_strnxfrm_simple, /* strnxfrm */
my_like_range_simple,/* like_range */
my_wildcmp_8bit, /* wildcmp */
@ -2915,6 +2917,7 @@ CHARSET_INFO compiled_charsets[] = {
idx_uni_cp1257, /* tab_from_uni */
0, /* strxfrm_multiply */
my_strnncoll_simple,/* strnncoll */
my_strnncollsp_simple,/* strnncollsp */
my_strnxfrm_simple, /* strnxfrm */
my_like_range_simple,/* like_range */
my_wildcmp_8bit, /* wildcmp */
@ -2962,6 +2965,7 @@ CHARSET_INFO compiled_charsets[] = {
idx_uni_8859_2, /* tab_from_uni */
0, /* strxfrm_multiply */
my_strnncoll_simple,/* strnncoll */
my_strnncollsp_simple,/* strnncollsp */
my_strnxfrm_simple, /* strnxfrm */
my_like_range_simple,/* like_range */
my_wildcmp_8bit, /* wildcmp */
@ -3010,6 +3014,7 @@ CHARSET_INFO compiled_charsets[] = {
idx_uni_8859_1, /* tab_from_uni */
0, /* strxfrm_multiply */
my_strnncoll_simple,/* strnncoll */
my_strnncollsp_simple,/* strnncollsp */
my_strnxfrm_simple, /* strnxfrm */
my_like_range_simple,/* like_range */
my_wildcmp_8bit, /* wildcmp */
@ -3057,6 +3062,7 @@ CHARSET_INFO compiled_charsets[] = {
NULL, /* tab_from_uni */
0, /* strxfrm_multiply */
my_strnncoll_simple,/* strnncoll */
my_strnncollsp_simple,/* strnncollsp */
my_strnxfrm_simple, /* strnxfrm */
my_like_range_simple,/* like_range */
my_wildcmp_8bit, /* wildcmp */
@ -3104,6 +3110,7 @@ CHARSET_INFO compiled_charsets[] = {
NULL, /* tab_from_uni */
0, /* strxfrm_multiply */
my_strnncoll_simple,/* strnncoll */
my_strnncollsp_simple,/* strnncollsp */
my_strnxfrm_simple, /* strnxfrm */
my_like_range_simple,/* like_range */
my_wildcmp_8bit, /* wildcmp */
@ -3151,6 +3158,7 @@ CHARSET_INFO compiled_charsets[] = {
NULL, /* tab_from_uni */
0, /* strxfrm_multiply */
my_strnncoll_simple,/* strnncoll */
my_strnncollsp_simple,/* strnncollsp */
my_strnxfrm_simple, /* strnxfrm */
my_like_range_simple,/* like_range */
my_wildcmp_8bit, /* wildcmp */
@ -3199,6 +3207,7 @@ CHARSET_INFO compiled_charsets[] = {
idx_uni_8859_1, /* tab_from_uni */
0, /* strxfrm_multiply */
my_strnncoll_simple,/* strnncoll */
my_strnncollsp_simple,/* strnncollsp */
my_strnxfrm_simple, /* strnxfrm */
my_like_range_simple,/* like_range */
my_wildcmp_8bit, /* wildcmp */
@ -3246,6 +3255,7 @@ CHARSET_INFO compiled_charsets[] = {
NULL, /* tab_from_uni */
0, /* strxfrm_multiply */
my_strnncoll_simple,/* strnncoll */
my_strnncollsp_simple,/* strnncollsp */
my_strnxfrm_simple, /* strnxfrm */
my_like_range_simple,/* like_range */
my_wildcmp_8bit, /* wildcmp */
@ -3293,6 +3303,7 @@ CHARSET_INFO compiled_charsets[] = {
NULL, /* tab_from_uni */
0, /* strxfrm_multiply */
my_strnncoll_simple,/* strnncoll */
my_strnncollsp_simple,/* strnncollsp */
my_strnxfrm_simple, /* strnxfrm */
my_like_range_simple,/* like_range */
my_wildcmp_8bit, /* wildcmp */
@ -3340,6 +3351,7 @@ CHARSET_INFO compiled_charsets[] = {
NULL, /* tab_from_uni */
0, /* strxfrm_multiply */
my_strnncoll_simple,/* strnncoll */
my_strnncollsp_simple,/* strnncollsp */
my_strnxfrm_simple, /* strnxfrm */
my_like_range_simple,/* like_range */
my_wildcmp_8bit, /* wildcmp */
@ -3387,6 +3399,7 @@ CHARSET_INFO compiled_charsets[] = {
idx_uni_8859_2, /* tab_from_uni */
0, /* strxfrm_multiply */
my_strnncoll_simple,/* strnncoll */
my_strnncollsp_simple,/* strnncollsp */
my_strnxfrm_simple, /* strnxfrm */
my_like_range_simple,/* like_range */
my_wildcmp_8bit, /* wildcmp */
@ -3434,6 +3447,7 @@ CHARSET_INFO compiled_charsets[] = {
idx_uni_koi8_r, /* tab_from_uni */
0, /* strxfrm_multiply */
my_strnncoll_simple,/* strnncoll */
my_strnncollsp_simple,/* strnncollsp */
my_strnxfrm_simple, /* strnxfrm */
my_like_range_simple,/* like_range */
my_wildcmp_8bit, /* wildcmp */
@ -3481,6 +3495,7 @@ CHARSET_INFO compiled_charsets[] = {
idx_uni_koi8_u, /* tab_from_uni */
0, /* strxfrm_multiply */
my_strnncoll_simple,/* strnncoll */
my_strnncollsp_simple,/* strnncollsp */
my_strnxfrm_simple, /* strnxfrm */
my_like_range_simple,/* like_range */
my_wildcmp_8bit, /* wildcmp */
@ -3529,6 +3544,7 @@ CHARSET_INFO compiled_charsets[] = {
idx_uni_8859_2, /* tab_from_uni */
0, /* strxfrm_multiply */
my_strnncoll_simple,/* strnncoll */
my_strnncollsp_simple,/* strnncollsp */
my_strnxfrm_simple, /* strnxfrm */
my_like_range_simple,/* like_range */
my_wildcmp_8bit, /* wildcmp */
@ -3576,6 +3592,7 @@ CHARSET_INFO compiled_charsets[] = {
idx_uni_8859_9, /* tab_from_uni */
0, /* strxfrm_multiply */
my_strnncoll_simple,/* strnncoll */
my_strnncollsp_simple,/* strnncollsp */
my_strnxfrm_simple, /* strnxfrm */
my_like_range_simple,/* like_range */
my_wildcmp_8bit, /* wildcmp */
@ -3624,6 +3641,7 @@ CHARSET_INFO compiled_charsets[] = {
NULL, /* tab_from_uni */
0, /* strxfrm_multiply */
my_strnncoll_simple,/* strnncoll */
my_strnncollsp_simple,/* strnncollsp */
my_strnxfrm_simple, /* strnxfrm */
my_like_range_simple,/* like_range */
my_wildcmp_8bit, /* wildcmp */
@ -3672,6 +3690,7 @@ CHARSET_INFO compiled_charsets[] = {
idx_uni_us_ascii, /* tab_from_uni */
0, /* strxfrm_multiply */
my_strnncoll_simple,/* strnncoll */
my_strnncollsp_simple,/* strnncollsp */
my_strnxfrm_simple, /* strnxfrm */
my_like_range_simple,/* like_range */
my_wildcmp_8bit, /* wildcmp */
@ -3719,6 +3738,7 @@ CHARSET_INFO compiled_charsets[] = {
idx_uni_cp1250, /* tab_from_uni */
0, /* strxfrm_multiply */
my_strnncoll_simple,/* strnncoll */
my_strnncollsp_simple,/* strnncollsp */
my_strnxfrm_simple, /* strnxfrm */
my_like_range_simple,/* like_range */
my_wildcmp_8bit, /* wildcmp */
@ -3766,6 +3786,7 @@ CHARSET_INFO compiled_charsets[] = {
idx_uni_cp1251, /* tab_from_uni */
0, /* strxfrm_multiply */
my_strnncoll_simple,/* strnncoll */
my_strnncollsp_simple,/* strnncollsp */
my_strnxfrm_simple, /* strnxfrm */
my_like_range_simple,/* like_range */
my_wildcmp_8bit, /* wildcmp */
@ -3813,6 +3834,7 @@ CHARSET_INFO compiled_charsets[] = {
idx_uni_armscii_8, /* tab_from_uni */
0, /* strxfrm_multiply */
my_strnncoll_simple,/* strnncoll */
my_strnncollsp_simple,/* strnncollsp */
my_strnxfrm_simple, /* strnxfrm */
my_like_range_simple,/* like_range */
my_wildcmp_8bit, /* wildcmp */
@ -3860,6 +3882,7 @@ CHARSET_INFO compiled_charsets[] = {
idx_uni_cp1251, /* tab_from_uni */
0, /* strxfrm_multiply */
my_strnncoll_simple,/* strnncoll */
my_strnncollsp_simple,/* strnncollsp */
my_strnxfrm_simple, /* strnxfrm */
my_like_range_simple,/* like_range */
my_wildcmp_8bit, /* wildcmp */
@ -3906,6 +3929,7 @@ CHARSET_INFO compiled_charsets[] = {
NULL, /* tab_from_uni */
0,
NULL, /* strnncoll */
NULL, /* strnncollsp */
NULL, /* strnxfrm */
NULL, /* like_range */
NULL, /* wildcmp */

View file

@ -5704,6 +5704,7 @@ CHARSET_INFO my_charset_gb2312 =
NULL, /* tab_from_uni */
0, /* strxfrm_multiply */
my_strnncoll_simple,/* strnncoll */
my_strnncollsp_simple,
my_strnxfrm_simple, /* strnxfrm */
my_like_range_simple,/* like_range */
my_wildcmp_mb, /* wildcmp */

View file

@ -2608,6 +2608,16 @@ int my_strnncoll_gbk(CHARSET_INFO *cs __attribute__((unused)),
return (int) (len1-len2);
}
static
int my_strnncollsp_gbk(CHARSET_INFO * cs,
const uchar *s, uint slen,
const uchar *t, uint tlen)
{
for ( ; slen && my_isspace(cs, s[slen-1]) ; slen--);
for ( ; tlen && my_isspace(cs, t[tlen-1]) ; tlen--);
return my_strnncoll_gbk(cs,s,slen,t,tlen);
}
int my_strnxfrm_gbk(CHARSET_INFO *cs __attribute__((unused)),
uchar * dest, uint len,
@ -9891,6 +9901,7 @@ CHARSET_INFO my_charset_gbk =
NULL, /* tab_from_uni */
1, /* strxfrm_multiply */
my_strnncoll_gbk,
my_strnncollsp_gbk,
my_strnxfrm_gbk,
my_like_range_gbk,
my_wildcmp_mb, /* wildcmp */

View file

@ -190,6 +190,7 @@ CHARSET_INFO my_charset_latin1 =
NULL, /* tab_from_uni */
2, /* strxfrm_multiply */
my_strnncoll_simple,
my_strnncollsp_simple,
my_strnxfrm_simple,
my_like_range_simple,
my_wildcmp_8bit, /* wildcmp */

View file

@ -295,6 +295,16 @@ static int my_strnncoll_latin1_de(CHARSET_INFO *cs __attribute__((unused)),
return s1 < e1 ? 1 : s2 < e2 ? -1 : 0;
}
static
int my_strnncollsp_latin1_de(CHARSET_INFO * cs,
const uchar *s, uint slen,
const uchar *t, uint tlen)
{
for ( ; slen && my_isspace(cs, s[slen-1]) ; slen--);
for ( ; tlen && my_isspace(cs, t[tlen-1]) ; tlen--);
return my_strnncoll_latin1_de(cs,s,slen,t,tlen);
}
static int my_strnxfrm_latin1_de(CHARSET_INFO *cs __attribute__((unused)),
uchar * dest, uint len,
@ -351,6 +361,7 @@ CHARSET_INFO my_charset_latin1_de =
idx_uni_8859_1, /* tab_from_uni */
2, /* strxfrm_multiply */
my_strnncoll_latin1_de,
my_strnncollsp_latin1_de,
my_strnxfrm_latin1_de,
my_like_range_simple,
my_wildcmp_8bit, /* wildcmp */

View file

@ -50,6 +50,26 @@ int my_strnncoll_simple(CHARSET_INFO * cs, const uchar *s, uint slen,
return (int) (slen-tlen);
}
int my_strnncollsp_simple(CHARSET_INFO * cs, const uchar *s, uint slen,
const uchar *t, uint tlen)
{
uchar *map= cs->sort_order;
int len;
for ( ; slen && my_isspace(cs, s[slen-1]) ; slen--);
for ( ; tlen && my_isspace(cs, t[tlen-1]) ; tlen--);
len = ( slen > tlen ) ? tlen : slen;
while (len--)
{
if (map[*s++] != map[*t++])
return ((int) map[s[-1]] - (int) map[t[-1]]);
}
return (int) (slen-tlen);
}
void my_caseup_str_8bit(CHARSET_INFO * cs,char *str)
{
register uchar *map=cs->to_upper;

View file

@ -227,6 +227,16 @@ static int my_strnncoll_sjis(CHARSET_INFO *cs __attribute__((unused)),
return len1 - len2;
}
static
int my_strnncollsp_sjis(CHARSET_INFO * cs,
const uchar *s, uint slen,
const uchar *t, uint tlen)
{
for ( ; slen && my_isspace(cs, s[slen-1]) ; slen--);
for ( ; tlen && my_isspace(cs, t[tlen-1]) ; tlen--);
return my_strnncoll_sjis(cs,s,slen,t,tlen);
}
static int my_strnxfrm_sjis(CHARSET_INFO *cs __attribute__((unused)),
uchar *dest, uint len,
const uchar *src, uint srclen)
@ -4478,6 +4488,7 @@ CHARSET_INFO my_charset_sjis =
NULL, /* tab_from_uni */
1, /* strxfrm_multiply */
my_strnncoll_sjis,
my_strnncollsp_sjis,
my_strnxfrm_sjis,
my_like_range_sjis,
my_wildcmp_mb, /* wildcmp */

View file

@ -551,6 +551,17 @@ int my_strnncoll_tis620(CHARSET_INFO *cs __attribute__((unused)),
return(i);
}
static
int my_strnncollsp_tis620(CHARSET_INFO * cs,
const uchar *s, uint slen,
const uchar *t, uint tlen)
{
for ( ; slen && my_isspace(cs, s[slen-1]) ; slen--);
for ( ; tlen && my_isspace(cs, t[tlen-1]) ; tlen--);
return my_strnncoll_tis620(cs,s,slen,t,tlen);
}
/* strnxfrm replacment, convert Thai string to sortable string
Arg: Destination buffer, source string, dest length and source length
Ret: Conveted string size
@ -700,6 +711,7 @@ CHARSET_INFO my_charset_tis620 =
NULL, /* tab_from_uni */
4, /* strxfrm_multiply */
my_strnncoll_tis620,
my_strnncollsp_tis620,
my_strnxfrm_tis620,
my_like_range_tis620,
my_wildcmp_8bit, /* wildcmp */

View file

@ -8444,7 +8444,8 @@ CHARSET_INFO my_charset_ujis =
NULL, /* tab_to_uni */
NULL, /* tab_from_uni */
0, /* strxfrm_multiply */
NULL, /* strnncoll */
my_strnncoll_simple,/* strnncoll */
my_strnncollsp_simple,
my_strnxfrm_simple, /* strnxfrm */
my_like_range_simple,/* like_range */
my_wildcmp_mb, /* wildcmp */

View file

@ -1855,6 +1855,17 @@ static int my_strnncoll_utf8(CHARSET_INFO *cs,
return ( (se-s) - (te-t) );
}
static
int my_strnncollsp_utf8(CHARSET_INFO * cs,
const uchar *s, uint slen,
const uchar *t, uint tlen)
{
for ( ; slen && my_isspace(cs, s[slen-1]) ; slen--);
for ( ; tlen && my_isspace(cs, t[tlen-1]) ; tlen--);
return my_strnncoll_utf8(cs,s,slen,t,tlen);
}
static int my_strncasecmp_utf8(CHARSET_INFO *cs,
const char *s, const char *t, uint len)
{
@ -1979,6 +1990,7 @@ CHARSET_INFO my_charset_utf8 =
NULL, /* tab_from_uni */
1, /* strxfrm_multiply */
my_strnncoll_utf8, /* strnncoll */
my_strnncollsp_utf8,
my_strnxfrm_utf8, /* strnxfrm */
my_like_range_simple,/* like_range */
my_wildcmp_mb, /* wildcmp */
@ -3068,6 +3080,7 @@ CHARSET_INFO my_charset_ucs2 =
NULL, /* tab_from_uni */
1, /* strxfrm_multiply */
my_strnncoll_ucs2, /* strnncoll */
my_strnncoll_ucs2,
my_strnxfrm_ucs2, /* strnxfrm */
my_like_range_simple,/* like_range */
my_wildcmp_mb, /* wildcmp */

View file

@ -503,6 +503,17 @@ static int my_strnncoll_win1250ch(CHARSET_INFO *cs __attribute__((unused)),
return 0;
}
static
int my_strnncollsp_win1250ch(CHARSET_INFO * cs,
const uchar *s, uint slen,
const uchar *t, uint tlen)
{
for ( ; slen && my_isspace(cs, s[slen-1]) ; slen--);
for ( ; tlen && my_isspace(cs, t[tlen-1]) ; tlen--);
return my_strnncoll_win1250ch(cs,s,slen,t,tlen);
}
static int my_strnxfrm_win1250ch(CHARSET_INFO * cs __attribute__((unused)),
uchar * dest, uint len,
const uchar * src, uint srclen) {
@ -644,6 +655,7 @@ CHARSET_INFO my_charset_win1250ch =
idx_uni_cp1250, /* tab_from_uni */
2, /* strxfrm_multiply */
my_strnncoll_win1250ch,
my_strnncollsp_win1250ch,
my_strnxfrm_win1250ch,
my_like_range_win1250ch,
my_wildcmp_8bit, /* wildcmp */