Changed wellformedlen to well_formed_len

Fixed that blobs >16M can be inserted/updated
Fixed bug when doing CREATE TEMPORARY TABLE ... LIKE
This commit is contained in:
monty@mysql.com 2004-02-17 01:35:17 +02:00
commit e9315f984d
34 changed files with 266 additions and 211 deletions

View file

@ -6245,7 +6245,7 @@ static MY_CHARSET_HANDLER my_charset_big5_handler=
mbcharlen_big5,
my_numchars_mb,
my_charpos_mb,
my_wellformedlen_mb,
my_well_formed_len_mb,
my_lengthsp_8bit,
my_mb_wc_big5, /* mb_wc */
my_wc_mb_big5, /* wc_mb */

View file

@ -350,7 +350,7 @@ static MY_CHARSET_HANDLER my_charset_handler=
my_mbcharlen_8bit, /* mbcharlen */
my_numchars_8bit,
my_charpos_8bit,
my_wellformedlen_8bit,
my_well_formed_len_8bit,
my_lengthsp_8bit,
my_mb_wc_bin,
my_wc_mb_bin,

View file

@ -8653,7 +8653,7 @@ static MY_CHARSET_HANDLER my_charset_handler=
mbcharlen_euc_kr,
my_numchars_mb,
my_charpos_mb,
my_wellformedlen_mb,
my_well_formed_len_mb,
my_lengthsp_8bit,
my_mb_wc_euc_kr, /* mb_wc */
my_wc_mb_euc_kr, /* wc_mb */

View file

@ -5704,7 +5704,7 @@ static MY_CHARSET_HANDLER my_charset_handler=
mbcharlen_gb2312,
my_numchars_mb,
my_charpos_mb,
my_wellformedlen_mb,
my_well_formed_len_mb,
my_lengthsp_8bit,
my_mb_wc_gb2312, /* mb_wc */
my_wc_mb_gb2312, /* wc_mb */

View file

@ -9900,7 +9900,7 @@ static MY_CHARSET_HANDLER my_charset_handler=
mbcharlen_gbk,
my_numchars_mb,
my_charpos_mb,
my_wellformedlen_mb,
my_well_formed_len_mb,
my_lengthsp_8bit,
my_mb_wc_gbk,
my_wc_mb_gbk,

View file

@ -180,7 +180,7 @@ static MY_CHARSET_HANDLER my_charset_handler=
my_mbcharlen_8bit,
my_numchars_8bit,
my_charpos_8bit,
my_wellformedlen_8bit,
my_well_formed_len_8bit,
my_lengthsp_8bit,
my_mb_wc_latin1,
my_wc_mb_latin1,

View file

@ -274,12 +274,12 @@ uint my_charpos_mb(CHARSET_INFO *cs __attribute__((unused)),
return pos ? e+2-b0 : b-b0;
}
uint my_wellformedlen_mb(CHARSET_INFO *cs,
const char *b, const char *e, uint pos)
uint my_well_formed_len_mb(CHARSET_INFO *cs,
const char *b, const char *e, uint pos)
{
my_wc_t wc;
int mblen;
const char *b0= b;
const char *b_start= b;
while (pos)
{
@ -288,7 +288,7 @@ uint my_wellformedlen_mb(CHARSET_INFO *cs,
b+= mblen;
pos--;
}
return b - b0;
return b - b_start;
}

View file

@ -1001,18 +1001,21 @@ ulong my_scan_8bit(CHARSET_INFO *cs, const char *str, const char *end, int sq)
}
}
void my_fill_8bit(CHARSET_INFO *cs __attribute__((unused)),
char *s, uint l, int fill)
{
bfill(s,l,fill);
}
uint my_numchars_8bit(CHARSET_INFO *cs __attribute__((unused)),
const char *b, const char *e)
{
return e-b;
}
uint my_charpos_8bit(CHARSET_INFO *cs __attribute__((unused)),
const char *b __attribute__((unused)),
const char *e __attribute__((unused)),
@ -1021,15 +1024,17 @@ uint my_charpos_8bit(CHARSET_INFO *cs __attribute__((unused)),
return pos;
}
uint my_wellformedlen_8bit(CHARSET_INFO *cs __attribute__((unused)),
const char *start,
const char *end,
uint nchars)
uint my_well_formed_len_8bit(CHARSET_INFO *cs __attribute__((unused)),
const char *start,
const char *end,
uint nchars)
{
uint nbytes= (uint) (end-start);
return nbytes < nchars ? nbytes : nchars;
return min(nbytes, nchars);
}
uint my_lengthsp_8bit(CHARSET_INFO *cs __attribute__((unused)),
const char *ptr, uint length)
{
@ -1106,7 +1111,7 @@ MY_CHARSET_HANDLER my_charset_8bit_handler=
my_mbcharlen_8bit, /* mbcharlen */
my_numchars_8bit,
my_charpos_8bit,
my_wellformedlen_8bit,
my_well_formed_len_8bit,
my_lengthsp_8bit,
my_mb_wc_8bit,
my_wc_mb_8bit,

View file

@ -4489,7 +4489,7 @@ static MY_CHARSET_HANDLER my_charset_handler=
mbcharlen_sjis,
my_numchars_mb,
my_charpos_mb,
my_wellformedlen_mb,
my_well_formed_len_mb,
my_lengthsp_8bit,
my_mb_wc_sjis, /* mb_wc */
my_wc_mb_sjis, /* wc_mb */

View file

@ -873,7 +873,7 @@ static MY_CHARSET_HANDLER my_charset_handler=
my_mbcharlen_8bit, /* mbcharlen */
my_numchars_8bit,
my_charpos_8bit,
my_wellformedlen_8bit,
my_well_formed_len_8bit,
my_lengthsp_8bit,
my_mb_wc_tis620, /* mb_wc */
my_wc_mb_tis620, /* wc_mb */

View file

@ -985,6 +985,7 @@ cnv:
return (int) (dst-db);
}
static
uint my_numchars_ucs2(CHARSET_INFO *cs __attribute__((unused)),
const char *b, const char *e)
@ -992,6 +993,7 @@ uint my_numchars_ucs2(CHARSET_INFO *cs __attribute__((unused)),
return (e-b)/2;
}
static
uint my_charpos_ucs2(CHARSET_INFO *cs __attribute__((unused)),
const char *b __attribute__((unused)),
@ -1001,17 +1003,19 @@ uint my_charpos_ucs2(CHARSET_INFO *cs __attribute__((unused)),
return pos*2;
}
static
uint my_wellformedlen_ucs2(CHARSET_INFO *cs __attribute__((unused)),
const char *b,
const char *e,
uint nchars)
uint my_well_formed_len_ucs2(CHARSET_INFO *cs __attribute__((unused)),
const char *b,
const char *e,
uint nchars)
{
uint nbytes= (e-b) & ~ (uint)1;
nchars*= 2;
return nbytes < nchars ? nbytes : nchars;
return min(nbytes, nchars);
}
static
void my_fill_ucs2(CHARSET_INFO *cs __attribute__((unused)),
char *s, uint l, int fill)
@ -1019,6 +1023,7 @@ void my_fill_ucs2(CHARSET_INFO *cs __attribute__((unused)),
for ( ; l >= 2; s[0]= 0, s[1]= fill, s+=2, l-=2);
}
static
uint my_lengthsp_ucs2(CHARSET_INFO *cs __attribute__((unused)),
const char *ptr, uint length)
@ -1029,6 +1034,7 @@ uint my_lengthsp_ucs2(CHARSET_INFO *cs __attribute__((unused)),
return (uint) (end-ptr);
}
/*
** Compare string against string with wildcard
** 0 if matched
@ -1043,7 +1049,7 @@ int my_wildcmp_ucs2(CHARSET_INFO *cs,
int escape, int w_one, int w_many,
MY_UNICASE_INFO **weights)
{
int result= -1; /* Not found, using wildcards */
int result= -1; /* Not found, using wildcards */
my_wc_t s_wc, w_wc;
int scan, plane;
@ -1052,21 +1058,23 @@ int my_wildcmp_ucs2(CHARSET_INFO *cs,
while (1)
{
scan= my_ucs2_uni(cs,&w_wc, (const uchar*)wildstr, (const uchar*)wildend);
scan= my_ucs2_uni(cs,&w_wc, (const uchar*)wildstr,
(const uchar*)wildend);
if (scan <= 0)
return 1;
if (w_wc == (my_wc_t)escape)
{
wildstr+= scan;
scan= my_ucs2_uni(cs,&w_wc, (const uchar*)wildstr, (const uchar*)wildend);
scan= my_ucs2_uni(cs,&w_wc, (const uchar*)wildstr,
(const uchar*)wildend);
if (scan <= 0)
return 1;
}
if (w_wc == (my_wc_t)w_many)
{
result= 1; /* Found an anchor char */
result= 1; /* Found an anchor char */
break;
}
@ -1078,7 +1086,7 @@ int my_wildcmp_ucs2(CHARSET_INFO *cs,
if (w_wc == (my_wc_t)w_one)
{
result= 1; /* Found an anchor char */
result= 1; /* Found an anchor char */
}
else
{
@ -1103,7 +1111,8 @@ int my_wildcmp_ucs2(CHARSET_INFO *cs,
/* Remove any '%' and '_' from the wild search string */
for ( ; wildstr != wildend ; )
{
scan= my_ucs2_uni(cs,&w_wc, (const uchar*)wildstr, (const uchar*)wildend);
scan= my_ucs2_uni(cs,&w_wc, (const uchar*)wildstr,
(const uchar*)wildend);
if (scan <= 0)
return 1;
@ -1116,7 +1125,8 @@ int my_wildcmp_ucs2(CHARSET_INFO *cs,
if (w_wc == (my_wc_t)w_one)
{
wildstr+= scan;
scan= my_ucs2_uni(cs, &s_wc, (const uchar*)str, (const uchar*)str_end);
scan= my_ucs2_uni(cs, &s_wc, (const uchar*)str,
(const uchar*)str_end);
if (scan <=0)
return 1;
str+= scan;
@ -1131,14 +1141,16 @@ int my_wildcmp_ucs2(CHARSET_INFO *cs,
if (str == str_end)
return -1;
scan= my_ucs2_uni(cs,&w_wc, (const uchar*)wildstr, (const uchar*)wildend);
scan= my_ucs2_uni(cs,&w_wc, (const uchar*)wildstr,
(const uchar*)wildend);
if (scan <= 0)
return 1;
if (w_wc == (my_wc_t)escape)
{
wildstr+= scan;
scan= my_ucs2_uni(cs,&w_wc, (const uchar*)wildstr, (const uchar*)wildend);
scan= my_ucs2_uni(cs,&w_wc, (const uchar*)wildstr,
(const uchar*)wildend);
if (scan <= 0)
return 1;
}
@ -1148,7 +1160,8 @@ int my_wildcmp_ucs2(CHARSET_INFO *cs,
/* Skip until the first character from wildstr is found */
while (str != str_end)
{
scan= my_ucs2_uni(cs,&s_wc, (const uchar*)str, (const uchar*)str_end);
scan= my_ucs2_uni(cs,&s_wc, (const uchar*)str,
(const uchar*)str_end);
if (scan <= 0)
return 1;
if (weights)
@ -1190,6 +1203,7 @@ int my_wildcmp_ucs2_ci(CHARSET_INFO *cs,
escape,w_one,w_many,uni_plane);
}
static
int my_wildcmp_ucs2_bin(CHARSET_INFO *cs,
const char *str,const char *str_end,
@ -1232,6 +1246,7 @@ int my_strnncoll_ucs2_bin(CHARSET_INFO *cs,
return ( (se-s) - (te-t) );
}
static
int my_strcasecmp_ucs2_bin(CHARSET_INFO *cs, const char *s, const char *t)
{
@ -1241,6 +1256,7 @@ int my_strcasecmp_ucs2_bin(CHARSET_INFO *cs, const char *s, const char *t)
return my_strncasecmp_ucs2(cs, s, t, len);
}
static
int my_strnxfrm_ucs2_bin(CHARSET_INFO *cs __attribute__((unused)),
uchar *dst, uint dstlen,
@ -1251,6 +1267,7 @@ int my_strnxfrm_ucs2_bin(CHARSET_INFO *cs __attribute__((unused)),
return srclen;
}
static
void my_hash_sort_ucs2_bin(CHARSET_INFO *cs __attribute__((unused)),
const uchar *key, uint len,ulong *nr1, ulong *nr2)
@ -1280,6 +1297,7 @@ static MY_COLLATION_HANDLER my_collation_ucs2_general_ci_handler =
my_hash_sort_ucs2
};
static MY_COLLATION_HANDLER my_collation_ucs2_bin_handler =
{
my_strnncoll_ucs2_bin,
@ -1292,13 +1310,14 @@ static MY_COLLATION_HANDLER my_collation_ucs2_bin_handler =
my_hash_sort_ucs2_bin
};
static MY_CHARSET_HANDLER my_charset_ucs2_handler=
{
my_ismbchar_ucs2, /* ismbchar */
my_mbcharlen_ucs2, /* mbcharlen */
my_numchars_ucs2,
my_charpos_ucs2,
my_wellformedlen_ucs2,
my_well_formed_len_ucs2,
my_lengthsp_ucs2,
my_ucs2_uni, /* mb_wc */
my_uni_ucs2, /* wc_mb */
@ -1319,7 +1338,6 @@ static MY_CHARSET_HANDLER my_charset_ucs2_handler=
};
CHARSET_INFO my_charset_ucs2_general_ci=
{
35,0,0, /* number */

View file

@ -8444,7 +8444,7 @@ static MY_CHARSET_HANDLER my_charset_handler=
mbcharlen_ujis,
my_numchars_mb,
my_charpos_mb,
my_wellformedlen_mb,
my_well_formed_len_mb,
my_lengthsp_8bit,
my_mb_wc_euc_jp, /* mb_wc */
my_wc_mb_euc_jp, /* wc_mb */

View file

@ -1969,7 +1969,7 @@ static MY_CHARSET_HANDLER my_charset_handler=
my_mbcharlen_utf8,
my_numchars_mb,
my_charpos_mb,
my_wellformedlen_mb,
my_well_formed_len_mb,
my_lengthsp_8bit,
my_utf8_uni,
my_uni_utf8,