2002-03-12 21:37:58 +04:00
|
|
|
/* Copyright (C) 2000 MySQL AB
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation; either version 2 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to the Free Software
|
|
|
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
|
|
|
|
|
|
|
#include <my_global.h>
|
|
|
|
#include "m_ctype.h"
|
2003-01-21 21:07:59 +02:00
|
|
|
#include "m_string.h"
|
2002-03-12 21:37:58 +04:00
|
|
|
|
2002-03-19 20:03:10 +04:00
|
|
|
#ifdef USE_MB
|
|
|
|
|
|
|
|
|
2002-03-12 21:37:58 +04:00
|
|
|
void my_caseup_str_mb(CHARSET_INFO * cs, char *str)
|
|
|
|
{
|
|
|
|
register uint32 l;
|
|
|
|
register char *end=str+strlen(str); /* BAR TODO: remove strlen() call */
|
2002-08-15 16:42:54 +05:00
|
|
|
register uchar *map=cs->to_upper;
|
|
|
|
|
2002-03-12 21:37:58 +04:00
|
|
|
while (*str)
|
|
|
|
{
|
|
|
|
if ((l=my_ismbchar(cs, str,end)))
|
|
|
|
str+=l;
|
|
|
|
else
|
|
|
|
{
|
2002-08-15 16:42:54 +05:00
|
|
|
*str=(char) map[(uchar)*str];
|
2002-03-12 21:37:58 +04:00
|
|
|
str++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void my_casedn_str_mb(CHARSET_INFO * cs, char *str)
|
|
|
|
{
|
|
|
|
register uint32 l;
|
|
|
|
register char *end=str+strlen(str);
|
2002-08-15 16:42:54 +05:00
|
|
|
register uchar *map=cs->to_lower;
|
|
|
|
|
2002-03-12 21:37:58 +04:00
|
|
|
while (*str)
|
|
|
|
{
|
|
|
|
if ((l=my_ismbchar(cs, str,end)))
|
|
|
|
str+=l;
|
|
|
|
else
|
|
|
|
{
|
2002-08-15 16:42:54 +05:00
|
|
|
*str=(char) map[(uchar)*str];
|
2002-03-12 21:37:58 +04:00
|
|
|
str++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void my_caseup_mb(CHARSET_INFO * cs, char *str, uint length)
|
|
|
|
{
|
|
|
|
register uint32 l;
|
|
|
|
register char *end=str+length;
|
2002-08-15 16:42:54 +05:00
|
|
|
register uchar *map=cs->to_upper;
|
|
|
|
|
2002-03-12 21:37:58 +04:00
|
|
|
while (str<end)
|
|
|
|
{
|
|
|
|
if ((l=my_ismbchar(cs, str,end)))
|
|
|
|
str+=l;
|
|
|
|
else
|
|
|
|
{
|
2002-08-15 16:42:54 +05:00
|
|
|
*str=(char) map[(uchar)*str];
|
2002-03-12 21:37:58 +04:00
|
|
|
str++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void my_casedn_mb(CHARSET_INFO * cs, char *str, uint length)
|
|
|
|
{
|
|
|
|
register uint32 l;
|
|
|
|
register char *end=str+length;
|
2002-08-15 16:42:54 +05:00
|
|
|
register uchar *map=cs->to_lower;
|
|
|
|
|
2002-03-12 21:37:58 +04:00
|
|
|
while (str<end)
|
|
|
|
{
|
|
|
|
if ((l=my_ismbchar(cs, str,end)))
|
|
|
|
str+=l;
|
|
|
|
else
|
|
|
|
{
|
2002-08-15 16:42:54 +05:00
|
|
|
*str=(char) map[(uchar)*str];
|
2002-03-12 21:37:58 +04:00
|
|
|
str++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
int my_strcasecmp_mb(CHARSET_INFO * cs,const char *s, const char *t)
|
|
|
|
{
|
|
|
|
register uint32 l;
|
|
|
|
register const char *end=s+strlen(s);
|
2002-08-15 16:42:54 +05:00
|
|
|
register uchar *map=cs->to_upper;
|
|
|
|
|
2002-03-12 21:37:58 +04:00
|
|
|
while (s<end)
|
|
|
|
{
|
|
|
|
if ((l=my_ismbchar(cs, s,end)))
|
|
|
|
{
|
|
|
|
while (l--)
|
|
|
|
if (*s++ != *t++)
|
|
|
|
return 1;
|
|
|
|
}
|
2003-04-01 15:52:09 +05:00
|
|
|
else if (my_mbcharlen(cs, *t) > 1)
|
2002-03-12 21:37:58 +04:00
|
|
|
return 1;
|
2002-08-15 16:42:54 +05:00
|
|
|
else if (map[(uchar) *s++] != map[(uchar) *t++])
|
2002-03-12 21:37:58 +04:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
return *t;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-11-14 16:07:29 +04:00
|
|
|
/*
|
|
|
|
** Compare string against string with wildcard
|
|
|
|
** 0 if matched
|
|
|
|
** -1 if not matched with wildcard
|
|
|
|
** 1 if matched with wildcard
|
|
|
|
*/
|
|
|
|
|
|
|
|
#define INC_PTR(cs,A,B) A+=((use_mb_flag && \
|
|
|
|
my_ismbchar(cs,A,B)) ? my_ismbchar(cs,A,B) : 1)
|
|
|
|
|
|
|
|
#define likeconv(s,A) (uchar) (s)->sort_order[(uchar) (A)]
|
|
|
|
|
|
|
|
int my_wildcmp_mb(CHARSET_INFO *cs,
|
|
|
|
const char *str,const char *str_end,
|
|
|
|
const char *wildstr,const char *wildend,
|
|
|
|
int escape, int w_one, int w_many)
|
|
|
|
{
|
2003-03-06 13:51:37 +01:00
|
|
|
int result= -1; /* Not found, using wildcards */
|
2002-11-14 16:07:29 +04:00
|
|
|
|
|
|
|
bool use_mb_flag=use_mb(cs);
|
|
|
|
|
|
|
|
while (wildstr != wildend)
|
|
|
|
{
|
|
|
|
while (*wildstr != w_many && *wildstr != w_one)
|
|
|
|
{
|
|
|
|
int l;
|
|
|
|
if (*wildstr == escape && wildstr+1 != wildend)
|
|
|
|
wildstr++;
|
|
|
|
if (use_mb_flag &&
|
|
|
|
(l = my_ismbchar(cs, wildstr, wildend)))
|
|
|
|
{
|
|
|
|
if (str+l > str_end || memcmp(str, wildstr, l) != 0)
|
|
|
|
return 1;
|
|
|
|
str += l;
|
|
|
|
wildstr += l;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
if (str == str_end || likeconv(cs,*wildstr++) != likeconv(cs,*str++))
|
2003-03-06 13:51:37 +01:00
|
|
|
return(1); /* No match */
|
2002-11-14 16:07:29 +04:00
|
|
|
if (wildstr == wildend)
|
2003-03-06 13:51:37 +01:00
|
|
|
return (str != str_end); /* Match if both are at end */
|
|
|
|
result=1; /* Found an anchor char */
|
2002-11-14 16:07:29 +04:00
|
|
|
}
|
|
|
|
if (*wildstr == w_one)
|
|
|
|
{
|
|
|
|
do
|
|
|
|
{
|
2003-03-06 13:51:37 +01:00
|
|
|
if (str == str_end) /* Skip one char if possible */
|
2002-11-14 16:07:29 +04:00
|
|
|
return (result);
|
|
|
|
INC_PTR(cs,str,str_end);
|
|
|
|
} while (++wildstr < wildend && *wildstr == w_one);
|
|
|
|
if (wildstr == wildend)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if (*wildstr == w_many)
|
2003-03-06 13:51:37 +01:00
|
|
|
{ /* Found w_many */
|
2002-11-14 16:07:29 +04:00
|
|
|
uchar cmp;
|
|
|
|
const char* mb = wildstr;
|
2003-01-04 14:12:20 +04:00
|
|
|
int mblen=0;
|
2002-11-14 16:07:29 +04:00
|
|
|
|
|
|
|
wildstr++;
|
|
|
|
/* Remove any '%' and '_' from the wild search string */
|
|
|
|
for (; wildstr != wildend ; wildstr++)
|
|
|
|
{
|
|
|
|
if (*wildstr == w_many)
|
|
|
|
continue;
|
|
|
|
if (*wildstr == w_one)
|
|
|
|
{
|
|
|
|
if (str == str_end)
|
|
|
|
return (-1);
|
|
|
|
INC_PTR(cs,str,str_end);
|
|
|
|
continue;
|
|
|
|
}
|
2003-03-06 13:51:37 +01:00
|
|
|
break; /* Not a wild character */
|
2002-11-14 16:07:29 +04:00
|
|
|
}
|
|
|
|
if (wildstr == wildend)
|
2003-03-06 13:51:37 +01:00
|
|
|
return(0); /* Ok if w_many is last */
|
2002-11-14 16:07:29 +04:00
|
|
|
if (str == str_end)
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
if ((cmp= *wildstr) == escape && wildstr+1 != wildend)
|
|
|
|
cmp= *++wildstr;
|
|
|
|
|
|
|
|
mb=wildstr;
|
|
|
|
LINT_INIT(mblen);
|
|
|
|
if (use_mb_flag)
|
|
|
|
mblen = my_ismbchar(cs, wildstr, wildend);
|
2003-03-06 13:51:37 +01:00
|
|
|
INC_PTR(cs,wildstr,wildend); /* This is compared trough cmp */
|
2002-11-14 16:07:29 +04:00
|
|
|
cmp=likeconv(cs,cmp);
|
|
|
|
do
|
|
|
|
{
|
|
|
|
if (use_mb_flag)
|
|
|
|
{
|
|
|
|
for (;;)
|
|
|
|
{
|
|
|
|
if (str >= str_end)
|
|
|
|
return -1;
|
|
|
|
if (mblen)
|
|
|
|
{
|
|
|
|
if (str+mblen <= str_end && memcmp(str, mb, mblen) == 0)
|
|
|
|
{
|
|
|
|
str += mblen;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (!my_ismbchar(cs, str, str_end) &&
|
|
|
|
likeconv(cs,*str) == cmp)
|
|
|
|
{
|
|
|
|
str++;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
INC_PTR(cs,str, str_end);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
while (str != str_end && likeconv(cs,*str) != cmp)
|
|
|
|
str++;
|
|
|
|
if (str++ == str_end) return (-1);
|
|
|
|
}
|
|
|
|
{
|
|
|
|
int tmp=my_wildcmp_mb(cs,str,str_end,wildstr,wildend,escape,w_one,w_many);
|
|
|
|
if (tmp <= 0)
|
|
|
|
return (tmp);
|
|
|
|
}
|
|
|
|
} while (str != str_end && wildstr[0] != w_many);
|
|
|
|
return(-1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return (str != str_end ? 1 : 0);
|
|
|
|
}
|
|
|
|
|
2003-01-31 16:22:22 +04:00
|
|
|
uint my_numchars_mb(CHARSET_INFO *cs __attribute__((unused)),
|
|
|
|
const char *b, const char *e)
|
|
|
|
{
|
|
|
|
register uint32 n=0,mblen;
|
|
|
|
while (b < e)
|
|
|
|
{
|
|
|
|
b+= (mblen= my_ismbchar(cs,b,e)) ? mblen : 1;
|
|
|
|
++n;
|
|
|
|
}
|
|
|
|
return n;
|
|
|
|
}
|
|
|
|
|
|
|
|
uint my_charpos_mb(CHARSET_INFO *cs __attribute__((unused)),
|
2003-01-31 17:08:14 +04:00
|
|
|
const char *b, const char *e, uint pos)
|
2003-01-31 16:22:22 +04:00
|
|
|
{
|
2003-01-31 17:08:14 +04:00
|
|
|
uint mblen;
|
|
|
|
const char *b0=b;
|
2003-01-31 16:22:22 +04:00
|
|
|
|
|
|
|
while (pos && b<e)
|
|
|
|
{
|
|
|
|
b+= (mblen= my_ismbchar(cs,b,e)) ? mblen : 1;
|
|
|
|
pos--;
|
|
|
|
}
|
2004-01-15 13:27:20 +04:00
|
|
|
return pos ? e+2-b0 : b-b0;
|
2003-01-31 16:22:22 +04:00
|
|
|
}
|
|
|
|
|
2004-02-17 01:35:17 +02:00
|
|
|
uint my_well_formed_len_mb(CHARSET_INFO *cs,
|
|
|
|
const char *b, const char *e, uint pos)
|
2004-02-06 16:59:25 +04:00
|
|
|
{
|
2004-02-10 15:42:46 +04:00
|
|
|
my_wc_t wc;
|
|
|
|
int mblen;
|
2004-02-17 01:35:17 +02:00
|
|
|
const char *b_start= b;
|
2004-02-06 16:59:25 +04:00
|
|
|
|
2004-02-10 15:42:46 +04:00
|
|
|
while (pos)
|
2004-02-06 16:59:25 +04:00
|
|
|
{
|
2004-02-10 15:42:46 +04:00
|
|
|
if ((mblen= cs->cset->mb_wc(cs, &wc, b, e)) <0)
|
|
|
|
break;
|
|
|
|
b+= mblen;
|
2004-02-06 16:59:25 +04:00
|
|
|
pos--;
|
|
|
|
}
|
2004-02-17 01:35:17 +02:00
|
|
|
return b - b_start;
|
2004-02-06 16:59:25 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2003-09-25 13:35:21 +05:00
|
|
|
uint my_instr_mb(CHARSET_INFO *cs,
|
2003-10-15 17:34:28 +05:00
|
|
|
const char *b, uint b_length,
|
|
|
|
const char *s, uint s_length,
|
2003-09-25 13:35:21 +05:00
|
|
|
my_match_t *match, uint nmatch)
|
2003-09-19 15:18:19 +05:00
|
|
|
{
|
2003-10-15 17:34:28 +05:00
|
|
|
register const char *end, *b0;
|
2003-09-19 15:18:19 +05:00
|
|
|
int res= 0;
|
|
|
|
|
|
|
|
if (s_length <= b_length)
|
|
|
|
{
|
|
|
|
if (!s_length)
|
2003-09-25 13:35:21 +05:00
|
|
|
{
|
|
|
|
if (nmatch)
|
|
|
|
{
|
|
|
|
match->beg= 0;
|
|
|
|
match->end= 0;
|
|
|
|
match->mblen= 0;
|
|
|
|
}
|
2003-09-29 22:45:00 +02:00
|
|
|
return 1; /* Empty string is always found */
|
2003-09-25 13:35:21 +05:00
|
|
|
}
|
2003-09-19 15:18:19 +05:00
|
|
|
|
2003-10-15 17:34:28 +05:00
|
|
|
b0= b;
|
|
|
|
end= b+b_length-s_length+1;
|
2003-09-19 15:18:19 +05:00
|
|
|
|
2003-10-15 17:34:28 +05:00
|
|
|
while (b < end)
|
2003-09-19 15:18:19 +05:00
|
|
|
{
|
|
|
|
int mblen;
|
|
|
|
|
2003-10-15 17:34:28 +05:00
|
|
|
if (!cs->coll->strnncoll(cs, (unsigned char*) b, s_length,
|
|
|
|
(unsigned char*) s, s_length))
|
2003-09-25 13:35:21 +05:00
|
|
|
{
|
|
|
|
if (nmatch)
|
|
|
|
{
|
2003-10-01 11:04:19 +05:00
|
|
|
match[0].beg= 0;
|
2003-10-15 17:34:28 +05:00
|
|
|
match[0].end= b-b0;
|
2003-09-25 13:35:21 +05:00
|
|
|
match[0].mblen= res;
|
|
|
|
if (nmatch > 1)
|
|
|
|
{
|
|
|
|
match[1].beg= match[0].end;
|
|
|
|
match[1].end= match[0].end+s_length;
|
|
|
|
match[1].mblen= 0; /* Not computed */
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return 2;
|
|
|
|
}
|
2003-10-15 17:34:28 +05:00
|
|
|
mblen= (mblen= my_ismbchar(cs, b, end)) ? mblen : 1;
|
|
|
|
b+= mblen;
|
2003-09-19 15:18:19 +05:00
|
|
|
b_length-= mblen;
|
|
|
|
res++;
|
|
|
|
}
|
|
|
|
}
|
2003-09-25 13:35:21 +05:00
|
|
|
return 0;
|
2003-09-19 15:18:19 +05:00
|
|
|
}
|
|
|
|
|
|
|
|
/* BINARY collations handlers for MB charsets */
|
|
|
|
|
|
|
|
static int my_strnncoll_mb_bin(CHARSET_INFO * cs __attribute__((unused)),
|
|
|
|
const uchar *s, uint slen,
|
|
|
|
const uchar *t, uint tlen)
|
|
|
|
{
|
|
|
|
int cmp= memcmp(s,t,min(slen,tlen));
|
|
|
|
return cmp ? cmp : (int) (slen - tlen);
|
|
|
|
}
|
|
|
|
|
After merge fixes
Added more DBUG statements
Ensure that we are comparing end space with BINARY strings
Use 'any_db' instead of '' to mean any database. (For HANDLER command)
Only strip ' ' when comparing CHAR, not other space-like characters (like \t)
BitKeeper/deleted/.del-ctype_tis620.result-old~3578ceb0b8284685:
Delete: mysql-test/r/ctype_tis620.result-old
BitKeeper/deleted/.del-ctype_tis620.test-old~ffb1bbd2935d1aba:
Delete: mysql-test/t/ctype_tis620.test-old
client/mysqlbinlog.cc:
Added DBUG statements
Added call of my_end() to free all used memory on exit
heap/hp_info.c:
After merge fixes
heap/hp_open.c:
After merge fixes
include/heap.h:
After merge fixes
include/m_ctype.h:
Use pchar instead of 'int' for character parameters.
Added 'my_binary_compare()'
include/m_string.h:
Fixed wrong define
innobase/ibuf/ibuf0ibuf.c:
After merge fixes
innobase/srv/srv0start.c:
After merge fixes
mysql-test/r/alter_table.result:
Fixed results after merge
mysql-test/r/auto_increment.result:
Fixed results after merge
mysql-test/r/bdb.result:
Fixed results after merge
mysql-test/r/binary.result:
Fixed results after merge
mysql-test/r/create.result:
Fixed results after merge
mysql-test/r/ctype_mb.result:
Fixed results after merge
mysql-test/r/ctype_tis620.result:
Fixed results after merge
mysql-test/r/ctype_utf8.result:
Fixed results after merge
mysql-test/r/delete.result:
Fixed results after merge
mysql-test/r/func_compress.result:
Fixed results after merge
mysql-test/r/func_gconcat.result:
Fixed results after merge
mysql-test/r/func_group.result:
Fixed results after merge
mysql-test/r/func_str.result:
Fixed results after merge
mysql-test/r/innodb.result:
Fixed results after merge
mysql-test/r/insert.result:
Fixed results after merge
mysql-test/r/insert_select.result:
Fixed results after merge
mysql-test/r/key.result:
Fixed results after merge
mysql-test/r/loaddata.result:
Fixed results after merge
mysql-test/r/lock.result:
Fixed results after merge
mysql-test/r/myisam.result:
Fixed results after merge
mysql-test/r/null.result:
Fixed results after merge
mysql-test/r/null_key.result:
Fixed results after merge
mysql-test/r/order_by.result:
Fixed results after merge
mysql-test/r/query_cache.result:
Fixed results after merge
mysql-test/r/range.result:
Fixed results after merge
mysql-test/r/rpl_multi_delete.result:
Fixed results after merge
mysql-test/r/rpl_until.result:
Fixed results after merge
mysql-test/r/subselect.result:
Fixed results after merge
mysql-test/r/subselect_innodb.result:
Fixed results after merge
mysql-test/r/type_blob.result:
Fixed results after merge
mysql-test/r/type_datetime.result:
Fixed results after merge
mysql-test/r/type_decimal.result:
Fixed results after merge
mysql-test/r/type_enum.result:
Fixed results after merge
mysql-test/r/type_float.result:
Fixed results after merge
mysql-test/r/type_ranges.result:
Fixed results after merge
mysql-test/r/type_time.result:
Fixed results after merge
mysql-test/r/type_timestamp.result:
Fixed results after merge
mysql-test/r/type_uint.result:
Fixed results after merge
mysql-test/r/type_year.result:
Fixed results after merge
mysql-test/r/variables.result:
Fixed results after merge
mysql-test/r/warnings.result:
Fixed results after merge
mysql-test/t/case.test:
Fixed shifted error messages
mysql-test/t/create.test:
Fixed shifted error messages
mysql-test/t/ctype_collate.test:
Fixed shifted error messages
mysql-test/t/ctype_tis620.test:
Merge with 4.0 ctype_tis620 test
mysql-test/t/delete.test:
Fixed shifted error messages
mysql-test/t/derived.test:
Fixed shifted error messages
mysql-test/t/fulltext.test:
Fixed shifted error messages
mysql-test/t/func_in.test:
Fixed shifted error messages
mysql-test/t/func_str.test:
Fixed shifted error messages
mysql-test/t/func_test.test:
Fixed shifted error messages
mysql-test/t/grant.test:
Fixed shifted error messages
mysql-test/t/innodb.test:
Change to 4.1 syntax
mysql-test/t/key_cache.test:
Fixed shifted error messages
mysql-test/t/myisam.test:
New test of blob and end space
mysql-test/t/row.test:
Fixed shifted error messages
mysql-test/t/rpl_until.test:
Fixed shifted error messages
mysql-test/t/subselect.test:
Fixed shifted error messages
mysql-test/t/subselect_innodb.test:
Fix test to take into account foreign key constraints
mysql-test/t/union.test:
Fixed shifted error messages
mysql-test/t/user_var.test:
Fixed shifted error messages
mysql-test/t/variables.test:
Fixed shifted error messages
mysys/my_handler.c:
Merge with 4.0 code
sql/ha_heap.cc:
After merge fixes
sql/handler.cc:
After merge fixes
sql/item.cc:
After merge fixes
sql/item_cmpfunc.cc:
Ensure that we are comparing end space with BINARY strings
sql/item_cmpfunc.h:
Ensure that we are comparing end space with BINARY strings
sql/log_event.cc:
More DBUG statements
Ensure that we use all options to LOAD DATA in replication
sql/opt_range.cc:
After merge fixes
sql/sql_db.cc:
After merge fixes
sql/sql_handler.cc:
After merge fixes
Use 'any_db' instead of '' to mean 'no database comparison'
sql/sql_parse.cc:
After merge fixes
sql/sql_select.cc:
After merge fixes
Added function comment for setup_group()
sql/sql_string.cc:
Added stringcmp() for binary comparison.
Added function comments for sortcmp() and stringcmp()
sql/sql_string.h:
Added stringcmp()
sql/sql_table.cc:
After merge fixes
sql/sql_update.cc:
After merge fixes
sql/sql_yacc.yy:
Use 'any_db' instead of '' to mean any database. Using "" causes a 'wrong db name' error.
strings/ctype-big5.c:
Strip only end space, not other space characters.
strings/ctype-bin.c:
Removed some not needed functions.
Added function comments
Don't remove end space in comparisons
Change my_wildcmp_bin() to be 'identical' with other similar code
strings/ctype-czech.c:
Strip only end space, not other space characters.
strings/ctype-gbk.c:
Strip only end space, not other space characters.
strings/ctype-latin1.c:
Strip only end space, not other space characters.
strings/ctype-mb.c:
Strip only end space, not other space characters.
strings/ctype-simple.c:
Strip only end space, not other space characters.
strings/ctype-sjis.c:
Strip only end space, not other space characters.
strings/ctype-tis620.c:
Added usage of my_instr_simple. This needs to be cleaned up!
strings/ctype-utf8.c:
Strip only end space, not other space characters.
strings/ctype-win1250ch.c:
Strip only end space, not other space characters.
Fixed indentation
strings/strto.c:
Code cleanup
2004-02-16 10:03:25 +02:00
|
|
|
static int my_strnncollsp_mb_bin(CHARSET_INFO * cs __attribute__((unused)),
|
|
|
|
const uchar *s, uint slen,
|
|
|
|
const uchar *t, uint tlen)
|
2003-09-19 15:18:19 +05:00
|
|
|
{
|
|
|
|
int len, cmp;
|
|
|
|
|
After merge fixes
Added more DBUG statements
Ensure that we are comparing end space with BINARY strings
Use 'any_db' instead of '' to mean any database. (For HANDLER command)
Only strip ' ' when comparing CHAR, not other space-like characters (like \t)
BitKeeper/deleted/.del-ctype_tis620.result-old~3578ceb0b8284685:
Delete: mysql-test/r/ctype_tis620.result-old
BitKeeper/deleted/.del-ctype_tis620.test-old~ffb1bbd2935d1aba:
Delete: mysql-test/t/ctype_tis620.test-old
client/mysqlbinlog.cc:
Added DBUG statements
Added call of my_end() to free all used memory on exit
heap/hp_info.c:
After merge fixes
heap/hp_open.c:
After merge fixes
include/heap.h:
After merge fixes
include/m_ctype.h:
Use pchar instead of 'int' for character parameters.
Added 'my_binary_compare()'
include/m_string.h:
Fixed wrong define
innobase/ibuf/ibuf0ibuf.c:
After merge fixes
innobase/srv/srv0start.c:
After merge fixes
mysql-test/r/alter_table.result:
Fixed results after merge
mysql-test/r/auto_increment.result:
Fixed results after merge
mysql-test/r/bdb.result:
Fixed results after merge
mysql-test/r/binary.result:
Fixed results after merge
mysql-test/r/create.result:
Fixed results after merge
mysql-test/r/ctype_mb.result:
Fixed results after merge
mysql-test/r/ctype_tis620.result:
Fixed results after merge
mysql-test/r/ctype_utf8.result:
Fixed results after merge
mysql-test/r/delete.result:
Fixed results after merge
mysql-test/r/func_compress.result:
Fixed results after merge
mysql-test/r/func_gconcat.result:
Fixed results after merge
mysql-test/r/func_group.result:
Fixed results after merge
mysql-test/r/func_str.result:
Fixed results after merge
mysql-test/r/innodb.result:
Fixed results after merge
mysql-test/r/insert.result:
Fixed results after merge
mysql-test/r/insert_select.result:
Fixed results after merge
mysql-test/r/key.result:
Fixed results after merge
mysql-test/r/loaddata.result:
Fixed results after merge
mysql-test/r/lock.result:
Fixed results after merge
mysql-test/r/myisam.result:
Fixed results after merge
mysql-test/r/null.result:
Fixed results after merge
mysql-test/r/null_key.result:
Fixed results after merge
mysql-test/r/order_by.result:
Fixed results after merge
mysql-test/r/query_cache.result:
Fixed results after merge
mysql-test/r/range.result:
Fixed results after merge
mysql-test/r/rpl_multi_delete.result:
Fixed results after merge
mysql-test/r/rpl_until.result:
Fixed results after merge
mysql-test/r/subselect.result:
Fixed results after merge
mysql-test/r/subselect_innodb.result:
Fixed results after merge
mysql-test/r/type_blob.result:
Fixed results after merge
mysql-test/r/type_datetime.result:
Fixed results after merge
mysql-test/r/type_decimal.result:
Fixed results after merge
mysql-test/r/type_enum.result:
Fixed results after merge
mysql-test/r/type_float.result:
Fixed results after merge
mysql-test/r/type_ranges.result:
Fixed results after merge
mysql-test/r/type_time.result:
Fixed results after merge
mysql-test/r/type_timestamp.result:
Fixed results after merge
mysql-test/r/type_uint.result:
Fixed results after merge
mysql-test/r/type_year.result:
Fixed results after merge
mysql-test/r/variables.result:
Fixed results after merge
mysql-test/r/warnings.result:
Fixed results after merge
mysql-test/t/case.test:
Fixed shifted error messages
mysql-test/t/create.test:
Fixed shifted error messages
mysql-test/t/ctype_collate.test:
Fixed shifted error messages
mysql-test/t/ctype_tis620.test:
Merge with 4.0 ctype_tis620 test
mysql-test/t/delete.test:
Fixed shifted error messages
mysql-test/t/derived.test:
Fixed shifted error messages
mysql-test/t/fulltext.test:
Fixed shifted error messages
mysql-test/t/func_in.test:
Fixed shifted error messages
mysql-test/t/func_str.test:
Fixed shifted error messages
mysql-test/t/func_test.test:
Fixed shifted error messages
mysql-test/t/grant.test:
Fixed shifted error messages
mysql-test/t/innodb.test:
Change to 4.1 syntax
mysql-test/t/key_cache.test:
Fixed shifted error messages
mysql-test/t/myisam.test:
New test of blob and end space
mysql-test/t/row.test:
Fixed shifted error messages
mysql-test/t/rpl_until.test:
Fixed shifted error messages
mysql-test/t/subselect.test:
Fixed shifted error messages
mysql-test/t/subselect_innodb.test:
Fix test to take into account foreign key constraints
mysql-test/t/union.test:
Fixed shifted error messages
mysql-test/t/user_var.test:
Fixed shifted error messages
mysql-test/t/variables.test:
Fixed shifted error messages
mysys/my_handler.c:
Merge with 4.0 code
sql/ha_heap.cc:
After merge fixes
sql/handler.cc:
After merge fixes
sql/item.cc:
After merge fixes
sql/item_cmpfunc.cc:
Ensure that we are comparing end space with BINARY strings
sql/item_cmpfunc.h:
Ensure that we are comparing end space with BINARY strings
sql/log_event.cc:
More DBUG statements
Ensure that we use all options to LOAD DATA in replication
sql/opt_range.cc:
After merge fixes
sql/sql_db.cc:
After merge fixes
sql/sql_handler.cc:
After merge fixes
Use 'any_db' instead of '' to mean 'no database comparison'
sql/sql_parse.cc:
After merge fixes
sql/sql_select.cc:
After merge fixes
Added function comment for setup_group()
sql/sql_string.cc:
Added stringcmp() for binary comparison.
Added function comments for sortcmp() and stringcmp()
sql/sql_string.h:
Added stringcmp()
sql/sql_table.cc:
After merge fixes
sql/sql_update.cc:
After merge fixes
sql/sql_yacc.yy:
Use 'any_db' instead of '' to mean any database. Using "" causes a 'wrong db name' error.
strings/ctype-big5.c:
Strip only end space, not other space characters.
strings/ctype-bin.c:
Removed some not needed functions.
Added function comments
Don't remove end space in comparisons
Change my_wildcmp_bin() to be 'identical' with other similar code
strings/ctype-czech.c:
Strip only end space, not other space characters.
strings/ctype-gbk.c:
Strip only end space, not other space characters.
strings/ctype-latin1.c:
Strip only end space, not other space characters.
strings/ctype-mb.c:
Strip only end space, not other space characters.
strings/ctype-simple.c:
Strip only end space, not other space characters.
strings/ctype-sjis.c:
Strip only end space, not other space characters.
strings/ctype-tis620.c:
Added usage of my_instr_simple. This needs to be cleaned up!
strings/ctype-utf8.c:
Strip only end space, not other space characters.
strings/ctype-win1250ch.c:
Strip only end space, not other space characters.
Fixed indentation
strings/strto.c:
Code cleanup
2004-02-16 10:03:25 +02:00
|
|
|
for ( ; slen && s[slen-1] == ' ' ; slen--);
|
|
|
|
for ( ; tlen && t[tlen-1] == ' ' ; tlen--);
|
2003-09-19 15:18:19 +05:00
|
|
|
|
|
|
|
len = ( slen > tlen ) ? tlen : slen;
|
|
|
|
|
|
|
|
cmp= memcmp(s,t,len);
|
|
|
|
return cmp ? cmp : (int) (slen - tlen);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int my_strnxfrm_mb_bin(CHARSET_INFO *cs __attribute__((unused)),
|
|
|
|
uchar * dest, uint len,
|
|
|
|
const uchar *src,
|
|
|
|
uint srclen __attribute__((unused)))
|
|
|
|
{
|
|
|
|
if (dest != src)
|
|
|
|
memcpy(dest,src,len= min(len,srclen));
|
|
|
|
return len;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static int my_strcasecmp_mb_bin(CHARSET_INFO * cs __attribute__((unused)),
|
|
|
|
const char *s, const char *t)
|
|
|
|
{
|
|
|
|
return strcmp(s,t);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void my_hash_sort_mb_bin(CHARSET_INFO *cs __attribute__((unused)),
|
|
|
|
const uchar *key, uint len,ulong *nr1, ulong *nr2)
|
|
|
|
{
|
|
|
|
const uchar *pos = key;
|
|
|
|
|
|
|
|
key+= len;
|
|
|
|
|
|
|
|
for (; pos < (uchar*) key ; pos++)
|
|
|
|
{
|
|
|
|
nr1[0]^=(ulong) ((((uint) nr1[0] & 63)+nr2[0]) *
|
|
|
|
((uint)*pos)) + (nr1[0] << 8);
|
|
|
|
nr2[0]+=3;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static int my_wildcmp_mb_bin(CHARSET_INFO *cs,
|
|
|
|
const char *str,const char *str_end,
|
|
|
|
const char *wildstr,const char *wildend,
|
|
|
|
int escape, int w_one, int w_many)
|
|
|
|
{
|
|
|
|
int result= -1; /* Not found, using wildcards */
|
|
|
|
|
|
|
|
bool use_mb_flag=use_mb(cs);
|
|
|
|
|
|
|
|
while (wildstr != wildend)
|
|
|
|
{
|
|
|
|
while (*wildstr != w_many && *wildstr != w_one)
|
|
|
|
{
|
|
|
|
int l;
|
|
|
|
if (*wildstr == escape && wildstr+1 != wildend)
|
|
|
|
wildstr++;
|
|
|
|
if (use_mb_flag &&
|
|
|
|
(l = my_ismbchar(cs, wildstr, wildend)))
|
|
|
|
{
|
|
|
|
if (str+l > str_end || memcmp(str, wildstr, l) != 0)
|
|
|
|
return 1;
|
|
|
|
str += l;
|
|
|
|
wildstr += l;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
if (str == str_end || *wildstr++ != *str++)
|
|
|
|
return(1); /* No match */
|
|
|
|
if (wildstr == wildend)
|
|
|
|
return (str != str_end); /* Match if both are at end */
|
|
|
|
result=1; /* Found an anchor char */
|
|
|
|
}
|
|
|
|
if (*wildstr == w_one)
|
|
|
|
{
|
|
|
|
do
|
|
|
|
{
|
|
|
|
if (str == str_end) /* Skip one char if possible */
|
|
|
|
return (result);
|
|
|
|
INC_PTR(cs,str,str_end);
|
|
|
|
} while (++wildstr < wildend && *wildstr == w_one);
|
|
|
|
if (wildstr == wildend)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if (*wildstr == w_many)
|
|
|
|
{ /* Found w_many */
|
|
|
|
uchar cmp;
|
|
|
|
const char* mb = wildstr;
|
|
|
|
int mblen=0;
|
|
|
|
|
|
|
|
wildstr++;
|
|
|
|
/* Remove any '%' and '_' from the wild search string */
|
|
|
|
for (; wildstr != wildend ; wildstr++)
|
|
|
|
{
|
|
|
|
if (*wildstr == w_many)
|
|
|
|
continue;
|
|
|
|
if (*wildstr == w_one)
|
|
|
|
{
|
|
|
|
if (str == str_end)
|
|
|
|
return (-1);
|
|
|
|
INC_PTR(cs,str,str_end);
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
break; /* Not a wild character */
|
|
|
|
}
|
|
|
|
if (wildstr == wildend)
|
|
|
|
return(0); /* Ok if w_many is last */
|
|
|
|
if (str == str_end)
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
if ((cmp= *wildstr) == escape && wildstr+1 != wildend)
|
|
|
|
cmp= *++wildstr;
|
|
|
|
|
|
|
|
mb=wildstr;
|
|
|
|
LINT_INIT(mblen);
|
|
|
|
if (use_mb_flag)
|
|
|
|
mblen = my_ismbchar(cs, wildstr, wildend);
|
|
|
|
INC_PTR(cs,wildstr,wildend); /* This is compared trough cmp */
|
|
|
|
do
|
|
|
|
{
|
|
|
|
if (use_mb_flag)
|
|
|
|
{
|
|
|
|
for (;;)
|
|
|
|
{
|
|
|
|
if (str >= str_end)
|
|
|
|
return -1;
|
|
|
|
if (mblen)
|
|
|
|
{
|
|
|
|
if (str+mblen <= str_end && memcmp(str, mb, mblen) == 0)
|
|
|
|
{
|
|
|
|
str += mblen;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (!my_ismbchar(cs, str, str_end) && *str == cmp)
|
|
|
|
{
|
|
|
|
str++;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
INC_PTR(cs,str, str_end);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
while (str != str_end && *str != cmp)
|
|
|
|
str++;
|
|
|
|
if (str++ == str_end) return (-1);
|
|
|
|
}
|
|
|
|
{
|
|
|
|
int tmp=my_wildcmp_mb(cs,str,str_end,wildstr,wildend,escape,w_one,w_many);
|
|
|
|
if (tmp <= 0)
|
|
|
|
return (tmp);
|
|
|
|
}
|
|
|
|
} while (str != str_end && wildstr[0] != w_many);
|
|
|
|
return(-1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return (str != str_end ? 1 : 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
MY_COLLATION_HANDLER my_collation_mb_bin_handler =
|
|
|
|
{
|
|
|
|
my_strnncoll_mb_bin,
|
|
|
|
my_strnncollsp_mb_bin,
|
|
|
|
my_strnxfrm_mb_bin,
|
|
|
|
my_like_range_simple,
|
|
|
|
my_wildcmp_mb_bin,
|
|
|
|
my_strcasecmp_mb_bin,
|
|
|
|
my_instr_mb,
|
|
|
|
my_hash_sort_mb_bin
|
|
|
|
};
|
|
|
|
|
2002-11-14 16:07:29 +04:00
|
|
|
|
2002-03-19 20:03:10 +04:00
|
|
|
#endif
|