mirror of
https://github.com/MariaDB/server.git
synced 2025-01-15 19:42:28 +01:00
move like_range into CHARSET_INFO structure
This commit is contained in:
parent
ff3fd7e5d2
commit
5a264eb9a7
17 changed files with 151 additions and 157 deletions
|
@ -81,8 +81,11 @@ typedef struct charset_info_st
|
|||
int (*strnxfrm)(struct charset_info_st *,
|
||||
uchar *, uint, const uchar *, uint);
|
||||
my_bool (*like_range)(struct charset_info_st *,
|
||||
const char *, uint, pchar, uint,
|
||||
char *, char *, uint *, uint *);
|
||||
const char *s, uint s_length,
|
||||
int w_prefix, int w_one, int w_many,
|
||||
uint res_length,
|
||||
char *min_str, char *max_str,
|
||||
uint *min_len, uint *max_len);
|
||||
int (*wildcmp)(struct charset_info_st *,
|
||||
const char *str,const char *str_end,
|
||||
const char *wildstr,const char *wildend,
|
||||
|
@ -171,7 +174,14 @@ ulong my_strtoul_8bit(CHARSET_INFO *, const char *s, char **e, int base);
|
|||
longlong my_strtoll_8bit(CHARSET_INFO *, const char *s, char **e, int base);
|
||||
ulonglong my_strtoull_8bit(CHARSET_INFO *, const char *s, char **e, int base);
|
||||
double my_strtod_8bit(CHARSET_INFO *, const char *s, char **e);
|
||||
|
||||
|
||||
my_bool my_like_range_simple(CHARSET_INFO *cs,
|
||||
const char *ptr, uint ptr_length,
|
||||
int escape, int w_one, int w_many,
|
||||
uint res_length,
|
||||
char *min_str, char *max_str,
|
||||
uint *min_length, uint *max_length);
|
||||
|
||||
|
||||
int my_wildcmp_8bit(CHARSET_INFO *,
|
||||
const char *str,const char *str_end,
|
||||
|
@ -230,8 +240,8 @@ int my_wildcmp_mb(CHARSET_INFO *,
|
|||
#define use_strnxfrm(s) ((s)->strnxfrm != NULL)
|
||||
#define my_strnxfrm(s, a, b, c, d) ((s)->strnxfrm((s), (a), (b), (c), (d)))
|
||||
#define my_strnncoll(s, a, b, c, d) ((s)->strnncoll((s), (a), (b), (c), (d)))
|
||||
#define my_like_range(s, a, b, c, d, e, f, g, h) \
|
||||
((s)->like_range((s), (a), (b), (c), (d), (e), (f), (g), (h)))
|
||||
#define my_like_range(s, a, b, c, d, e, f, g, h, i, j) \
|
||||
((s)->like_range((s), (a), (b), (c), (d), (e), (f), (g), (h), (i), (j)))
|
||||
#define my_wildcmp(cs,s,se,w,we,e,o,m) ((cs)->wildcmp((cs),(s),(se),(w),(we),(e),(o),(m)))
|
||||
|
||||
#define use_mb(s) ((s)->ismbchar != NULL)
|
||||
|
|
|
@ -376,6 +376,7 @@ static CHARSET_INFO *add_charset(CHARSET_INFO *cs, myf flags)
|
|||
sizeof(tmp_sort_order));
|
||||
memcpy((char*) cs->tab_to_uni, (char*) tmp_to_uni, sizeof(tmp_to_uni));
|
||||
|
||||
cs->like_range = my_like_range_simple;
|
||||
cs->wildcmp = my_wildcmp_8bit;
|
||||
cs->strnncoll = my_strnncoll_simple;
|
||||
cs->caseup_str = my_caseup_str_8bit;
|
||||
|
|
|
@ -299,9 +299,6 @@ static SEL_TREE * get_mm_parts(PARAM *param,Field *field,
|
|||
Item_result cmp_type);
|
||||
static SEL_ARG *get_mm_leaf(PARAM *param,Field *field,KEY_PART *key_part,
|
||||
Item_func::Functype type,Item *value);
|
||||
static bool like_range(const char *ptr,uint length,char wild_prefix,
|
||||
uint field_length, char *min_str,char *max_str,
|
||||
char max_sort_char,uint *min_length,uint *max_length);
|
||||
static SEL_TREE *get_mm_tree(PARAM *param,COND *cond);
|
||||
static ha_rows check_quick_select(PARAM *param,uint index,SEL_ARG *key_tree);
|
||||
static ha_rows check_quick_keys(PARAM *param,uint index,SEL_ARG *key_tree,
|
||||
|
@ -970,27 +967,14 @@ get_mm_leaf(PARAM *param, Field *field, KEY_PART *key_part,
|
|||
max_str=min_str+length;
|
||||
if (maybe_null)
|
||||
max_str[0]= min_str[0]=0;
|
||||
if (field->binary())
|
||||
like_error=like_range(res->ptr(),res->length(),wild_prefix,field_length,
|
||||
min_str+offset,max_str+offset,(char) 255,
|
||||
&min_length,&max_length);
|
||||
else
|
||||
{
|
||||
CHARSET_INFO *charset=field->charset();
|
||||
#ifdef USE_STRCOLL
|
||||
if (use_strnxfrm(charset))
|
||||
like_error= my_like_range(charset,
|
||||
res->ptr(),res->length(),wild_prefix,
|
||||
field_length, min_str+maybe_null,
|
||||
max_str+maybe_null,&min_length,&max_length);
|
||||
else
|
||||
#endif
|
||||
like_error=like_range(res->ptr(),res->length(),wild_prefix,
|
||||
field_length,
|
||||
min_str+offset,max_str+offset,
|
||||
charset->max_sort_char,
|
||||
&min_length,&max_length);
|
||||
}
|
||||
|
||||
like_error= my_like_range(field->charset(),
|
||||
res->ptr(),res->length(),
|
||||
wild_prefix,wild_one,wild_many,
|
||||
field_length,
|
||||
min_str+offset, max_str+offset,
|
||||
&min_length,&max_length);
|
||||
|
||||
if (like_error) // Can't optimize with LIKE
|
||||
DBUG_RETURN(0);
|
||||
if (offset != maybe_null) // Blob
|
||||
|
@ -1119,69 +1103,6 @@ get_mm_leaf(PARAM *param, Field *field, KEY_PART *key_part,
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
** Calculate min_str and max_str that ranges a LIKE string.
|
||||
** Arguments:
|
||||
** ptr Pointer to LIKE string.
|
||||
** ptr_length Length of LIKE string.
|
||||
** escape Escape character in LIKE. (Normally '\').
|
||||
** All escape characters should be removed from min_str and max_str
|
||||
** res_length Length of min_str and max_str.
|
||||
** min_str Smallest case sensitive string that ranges LIKE.
|
||||
** Should be space padded to res_length.
|
||||
** max_str Largest case sensitive string that ranges LIKE.
|
||||
** Normally padded with the biggest character sort value.
|
||||
**
|
||||
** The function should return 0 if ok and 1 if the LIKE string can't be
|
||||
** optimized !
|
||||
*/
|
||||
|
||||
static bool like_range(const char *ptr,uint ptr_length,char escape,
|
||||
uint res_length, char *min_str,char *max_str,
|
||||
char max_sort_chr, uint *min_length, uint *max_length)
|
||||
{
|
||||
const char *end=ptr+ptr_length;
|
||||
char *min_org=min_str;
|
||||
char *min_end=min_str+res_length;
|
||||
|
||||
for (; ptr != end && min_str != min_end ; ptr++)
|
||||
{
|
||||
if (*ptr == escape && ptr+1 != end)
|
||||
{
|
||||
ptr++; // Skip escape
|
||||
*min_str++= *max_str++ = *ptr;
|
||||
continue;
|
||||
}
|
||||
if (*ptr == wild_one) // '_' in SQL
|
||||
{
|
||||
*min_str++='\0'; // This should be min char
|
||||
*max_str++=max_sort_chr;
|
||||
continue;
|
||||
}
|
||||
if (*ptr == wild_many) // '%' in SQL
|
||||
{
|
||||
*min_length= (uint) (min_str - min_org);
|
||||
*max_length=res_length;
|
||||
do {
|
||||
*min_str++ = ' '; // Because if key compression
|
||||
*max_str++ = max_sort_chr;
|
||||
} while (min_str != min_end);
|
||||
return 0;
|
||||
}
|
||||
*min_str++= *max_str++ = *ptr;
|
||||
}
|
||||
*min_length= *max_length = (uint) (min_str - min_org);
|
||||
|
||||
/* Temporary fix for handling wild_one at end of string (key compression) */
|
||||
for (char *tmp= min_str ; tmp > min_org && tmp[-1] == '\0';)
|
||||
*--tmp=' ';
|
||||
|
||||
while (min_str != min_end)
|
||||
*min_str++ = *max_str++ = ' '; // Because if key compression
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
** Tree manipulation functions
|
||||
** If tree is 0 it means that the condition can't be tested. It refers
|
||||
|
|
|
@ -331,11 +331,10 @@ static int my_strxfrm_big5(uchar * dest, const uchar * src, int len)
|
|||
*/
|
||||
|
||||
#define max_sort_char ((char) 255)
|
||||
#define wild_one '_'
|
||||
#define wild_many '%'
|
||||
|
||||
static my_bool my_like_range_big5(CHARSET_INFO *cs __attribute__((unused)),
|
||||
const char *ptr,uint ptr_length,pchar escape,
|
||||
const char *ptr,uint ptr_length,
|
||||
int escape, int w_one, int w_many,
|
||||
uint res_length, char *min_str,char *max_str,
|
||||
uint *min_length,uint *max_length)
|
||||
{
|
||||
|
@ -357,13 +356,13 @@ static my_bool my_like_range_big5(CHARSET_INFO *cs __attribute__((unused)),
|
|||
*min_str++= *max_str++ = *ptr;
|
||||
continue;
|
||||
}
|
||||
if (*ptr == wild_one) /* '_' in SQL */
|
||||
if (*ptr == w_one) /* '_' in SQL */
|
||||
{
|
||||
*min_str++='\0'; /* This should be min char */
|
||||
*max_str++=max_sort_char;
|
||||
continue;
|
||||
}
|
||||
if (*ptr == wild_many) /* '%' in SQL */
|
||||
if (*ptr == w_many) /* '%' in SQL */
|
||||
{
|
||||
*min_length= (uint) (min_str-min_org);
|
||||
*max_length= res_length;
|
||||
|
|
|
@ -251,7 +251,7 @@ static CHARSET_INFO my_charset_bin_st =
|
|||
0, /* strxfrm_multiply */
|
||||
my_strnncoll_binary, /* strnncoll */
|
||||
NULL, /* strxnfrm */
|
||||
NULL, /* like_range */
|
||||
my_like_range_simple, /* like_range */
|
||||
my_wildcmp_bin, /* wildcmp */
|
||||
1, /* mbmaxlen */
|
||||
NULL, /* ismbchar */
|
||||
|
|
|
@ -375,13 +375,12 @@ static int my_strnxfrm_czech(CHARSET_INFO *cs __attribute__((unused)),
|
|||
|
||||
#define min_sort_char ' '
|
||||
#define max_sort_char '9'
|
||||
#define wild_one '_'
|
||||
#define wild_many '%'
|
||||
|
||||
#define EXAMPLE
|
||||
|
||||
static my_bool my_like_range_czech(CHARSET_INFO *cs __attribute__((unused)),
|
||||
const char *ptr,uint ptr_length,pchar escape,
|
||||
const char *ptr,uint ptr_length,
|
||||
int escape, int w_one, int w_many,
|
||||
uint res_length, char *min_str,char *max_str,
|
||||
uint *min_length,uint *max_length)
|
||||
{
|
||||
|
@ -393,9 +392,9 @@ static my_bool my_like_range_czech(CHARSET_INFO *cs __attribute__((unused)),
|
|||
|
||||
for (; ptr != end && min_str != min_end ; ptr++)
|
||||
{
|
||||
if (*ptr == wild_one) /* '_' in SQL */
|
||||
if (*ptr == w_one) /* '_' in SQL */
|
||||
{ break; }
|
||||
if (*ptr == wild_many) /* '%' in SQL */
|
||||
if (*ptr == w_many) /* '%' in SQL */
|
||||
{ break; }
|
||||
|
||||
if (*ptr == escape && ptr+1 != end)
|
||||
|
|
|
@ -8648,7 +8648,7 @@ CHARSET_INFO my_charset_euc_kr =
|
|||
0, /* strxfrm_multiply */
|
||||
my_strnncoll_simple,/* strnncoll */
|
||||
NULL, /* strnxfrm */
|
||||
NULL, /* like_range */
|
||||
my_like_range_simple,/* like_range */
|
||||
my_wildcmp_mb, /* wildcmp */
|
||||
2, /* mbmaxlen */
|
||||
ismbchar_euc_kr,
|
||||
|
|
|
@ -5698,7 +5698,7 @@ CHARSET_INFO my_charset_gb2312 =
|
|||
0, /* strxfrm_multiply */
|
||||
my_strnncoll_simple,/* strnncoll */
|
||||
NULL, /* strnxfrm */
|
||||
NULL, /* like_range */
|
||||
my_like_range_simple,/* like_range */
|
||||
my_wildcmp_mb, /* wildcmp */
|
||||
2, /* mbmaxlen */
|
||||
ismbchar_gb2312,
|
||||
|
|
|
@ -2650,11 +2650,10 @@ int my_strnxfrm_gbk(CHARSET_INFO *cs __attribute__((unused)),
|
|||
*/
|
||||
|
||||
#define max_sort_char ((uchar) 255)
|
||||
#define wild_one '_'
|
||||
#define wild_many '%'
|
||||
|
||||
extern my_bool my_like_range_gbk(CHARSET_INFO *cs __attribute__((unused)),
|
||||
const char *ptr,uint ptr_length,pchar escape,
|
||||
const char *ptr,uint ptr_length,
|
||||
int escape, int w_one, int w_many,
|
||||
uint res_length, char *min_str,char *max_str,
|
||||
uint *min_length,uint *max_length)
|
||||
{
|
||||
|
@ -2676,13 +2675,13 @@ extern my_bool my_like_range_gbk(CHARSET_INFO *cs __attribute__((unused)),
|
|||
*min_str++= *max_str++ = *ptr;
|
||||
continue;
|
||||
}
|
||||
if (*ptr == wild_one) /* '_' in SQL */
|
||||
if (*ptr == w_one) /* '_' in SQL */
|
||||
{
|
||||
*min_str++='\0'; /* This should be min char */
|
||||
*max_str++=max_sort_char;
|
||||
continue;
|
||||
}
|
||||
if (*ptr == wild_many) /* '%' in SQL */
|
||||
if (*ptr == w_many) /* '%' in SQL */
|
||||
{
|
||||
*min_length= (uint) (min_str - min_org);
|
||||
*max_length= res_length;
|
||||
|
|
|
@ -358,12 +358,11 @@ static int my_strnxfrm_latin1_de(CHARSET_INFO *cs __attribute__((unused)),
|
|||
|
||||
#define min_sort_char ((char) 0)
|
||||
#define max_sort_char ((char) 255)
|
||||
#define wild_one '_'
|
||||
#define wild_many '%'
|
||||
|
||||
static my_bool my_like_range_latin1_de(CHARSET_INFO *cs __attribute__((unused)),
|
||||
const char *ptr, uint ptr_length,
|
||||
pchar escape, uint res_length,
|
||||
int escape, int w_one, int w_many,
|
||||
uint res_length,
|
||||
char *min_str, char *max_str,
|
||||
uint *min_length, uint *max_length)
|
||||
{
|
||||
|
@ -379,13 +378,13 @@ static my_bool my_like_range_latin1_de(CHARSET_INFO *cs __attribute__((unused)),
|
|||
*min_str++ = *max_str++ = *ptr;
|
||||
continue;
|
||||
}
|
||||
if (*ptr == wild_one) /* '_' in SQL */
|
||||
if (*ptr == w_one) /* '_' in SQL */
|
||||
{
|
||||
*min_str++ = min_sort_char;
|
||||
*max_str++ = max_sort_char;
|
||||
continue;
|
||||
}
|
||||
if (*ptr == wild_many) /* '%' in SQL */
|
||||
if (*ptr == w_many) /* '%' in SQL */
|
||||
{
|
||||
*min_length = (uint)(min_str - min_org);
|
||||
*max_length = res_length;
|
||||
|
@ -399,7 +398,7 @@ static my_bool my_like_range_latin1_de(CHARSET_INFO *cs __attribute__((unused)),
|
|||
}
|
||||
*min_length = *max_length = (uint) (min_str - min_org);
|
||||
|
||||
/* Temporary fix for handling wild_one at end of string (key compression) */
|
||||
/* Temporary fix for handling w_one at end of string (key compression) */
|
||||
{
|
||||
char *tmp;
|
||||
for (tmp= min_str ; tmp > min_org && tmp[-1] == '\0';)
|
||||
|
|
|
@ -367,3 +367,72 @@ int my_wildcmp_8bit(CHARSET_INFO *cs,
|
|||
}
|
||||
return (str != str_end ? 1 : 0);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
** Calculate min_str and max_str that ranges a LIKE string.
|
||||
** Arguments:
|
||||
** ptr Pointer to LIKE string.
|
||||
** ptr_length Length of LIKE string.
|
||||
** escape Escape character in LIKE. (Normally '\').
|
||||
** All escape characters should be removed from min_str and max_str
|
||||
** res_length Length of min_str and max_str.
|
||||
** min_str Smallest case sensitive string that ranges LIKE.
|
||||
** Should be space padded to res_length.
|
||||
** max_str Largest case sensitive string that ranges LIKE.
|
||||
** Normally padded with the biggest character sort value.
|
||||
**
|
||||
** The function should return 0 if ok and 1 if the LIKE string can't be
|
||||
** optimized !
|
||||
*/
|
||||
|
||||
my_bool my_like_range_simple(CHARSET_INFO *cs,
|
||||
const char *ptr,uint ptr_length,
|
||||
int escape, int w_one, int w_many,
|
||||
uint res_length,
|
||||
char *min_str,char *max_str,
|
||||
uint *min_length,uint *max_length)
|
||||
{
|
||||
const char *end=ptr+ptr_length;
|
||||
char *min_org=min_str;
|
||||
char *min_end=min_str+res_length;
|
||||
|
||||
for (; ptr != end && min_str != min_end ; ptr++)
|
||||
{
|
||||
if (*ptr == escape && ptr+1 != end)
|
||||
{
|
||||
ptr++; // Skip escape
|
||||
*min_str++= *max_str++ = *ptr;
|
||||
continue;
|
||||
}
|
||||
if (*ptr == w_one) // '_' in SQL
|
||||
{
|
||||
*min_str++='\0'; // This should be min char
|
||||
*max_str++=cs->max_sort_char;
|
||||
continue;
|
||||
}
|
||||
if (*ptr == w_many) // '%' in SQL
|
||||
{
|
||||
*min_length= (uint) (min_str - min_org);
|
||||
*max_length=res_length;
|
||||
do {
|
||||
*min_str++ = ' '; // Because if key compression
|
||||
*max_str++ = cs->max_sort_char;
|
||||
} while (min_str != min_end);
|
||||
return 0;
|
||||
}
|
||||
*min_str++= *max_str++ = *ptr;
|
||||
}
|
||||
*min_length= *max_length = (uint) (min_str - min_org);
|
||||
|
||||
/* Temporary fix for handling w_one at end of string (key compression) */
|
||||
{
|
||||
char *tmp;
|
||||
for (tmp= min_str ; tmp > min_org && tmp[-1] == '\0';)
|
||||
*--tmp=' ';
|
||||
}
|
||||
|
||||
while (min_str != min_end)
|
||||
*min_str++ = *max_str++ = ' '; // Because if key compression
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -263,11 +263,10 @@ static int my_strnxfrm_sjis(CHARSET_INFO *cs __attribute__((unused)),
|
|||
*/
|
||||
|
||||
#define max_sort_char ((char) 255)
|
||||
#define wild_one '_'
|
||||
#define wild_many '%'
|
||||
|
||||
static my_bool my_like_range_sjis(CHARSET_INFO *cs __attribute__((unused)),
|
||||
const char *ptr,uint ptr_length,pchar escape,
|
||||
const char *ptr,uint ptr_length,
|
||||
int escape, int w_one, int w_many,
|
||||
uint res_length, char *min_str,char *max_str,
|
||||
uint *min_length,uint *max_length)
|
||||
{
|
||||
|
@ -290,13 +289,13 @@ static my_bool my_like_range_sjis(CHARSET_INFO *cs __attribute__((unused)),
|
|||
*min_str++ = *max_str++ = *ptr++;
|
||||
continue;
|
||||
}
|
||||
if (*ptr == wild_one) { /* '_' in SQL */
|
||||
if (*ptr == w_one) { /* '_' in SQL */
|
||||
*min_str++ = '\0'; /* This should be min char */
|
||||
*max_str++ = max_sort_char;
|
||||
ptr++;
|
||||
continue;
|
||||
}
|
||||
if (*ptr == wild_many) { /* '%' in SQL */
|
||||
if (*ptr == w_many) { /* '%' in SQL */
|
||||
*min_length = (uint)(min_str - min_org);
|
||||
*max_length = res_length;
|
||||
do {
|
||||
|
|
|
@ -610,11 +610,10 @@ int my_strxfrm_tis620(uchar * dest, const uchar * src, int len)
|
|||
thai2sortable string. min_str and max_str will be use for comparison and
|
||||
converted there. */
|
||||
#define max_sort_chr ((char) 255)
|
||||
#define wild_one '_'
|
||||
#define wild_many '%'
|
||||
|
||||
my_bool my_like_range_tis620(CHARSET_INFO *cs __attribute__((unused)),
|
||||
const char *ptr, uint ptr_length, pchar escape,
|
||||
const char *ptr, uint ptr_length,
|
||||
int escape, int w_one, int w_many,
|
||||
uint res_length, char *min_str, char *max_str,
|
||||
uint *min_length, uint *max_length)
|
||||
{
|
||||
|
@ -630,13 +629,13 @@ my_bool my_like_range_tis620(CHARSET_INFO *cs __attribute__((unused)),
|
|||
*min_str++= *max_str++ = *ptr;
|
||||
continue;
|
||||
}
|
||||
if (*ptr == wild_one) /* '_' in SQL */
|
||||
if (*ptr == w_one) /* '_' in SQL */
|
||||
{
|
||||
*min_str++='\0'; /* This should be min char */
|
||||
*max_str++=max_sort_chr;
|
||||
continue;
|
||||
}
|
||||
if (*ptr == wild_many) /* '%' in SQL */
|
||||
if (*ptr == w_many) /* '%' in SQL */
|
||||
{
|
||||
*min_length= (uint) (min_str - min_org);
|
||||
*max_length=res_length;
|
||||
|
|
|
@ -8442,7 +8442,7 @@ CHARSET_INFO my_charset_ujis =
|
|||
0, /* strxfrm_multiply */
|
||||
NULL, /* strnncoll */
|
||||
NULL, /* strnxfrm */
|
||||
NULL, /* like_range */
|
||||
my_like_range_simple,/* like_range */
|
||||
my_wildcmp_mb, /* wildcmp */
|
||||
3, /* mbmaxlen */
|
||||
ismbchar_ujis,
|
||||
|
|
|
@ -1967,7 +1967,7 @@ CHARSET_INFO my_charset_utf8 =
|
|||
1, /* strxfrm_multiply */
|
||||
my_strnncoll_utf8, /* strnncoll */
|
||||
my_strnxfrm_utf8, /* strnxfrm */
|
||||
NULL, /* like_range */
|
||||
my_like_range_simple,/* like_range */
|
||||
my_wildcmp_mb, /* wildcmp */
|
||||
3, /* mbmaxlen */
|
||||
my_ismbchar_utf8, /* ismbchar */
|
||||
|
@ -2485,7 +2485,7 @@ CHARSET_INFO my_charset_ucs2 =
|
|||
1, /* strxfrm_multiply */
|
||||
my_strnncoll_ucs2, /* strnncoll */
|
||||
my_strnxfrm_ucs2, /* strnxfrm */
|
||||
NULL, /* like_range */
|
||||
my_like_range_simple,/* like_range */
|
||||
my_wildcmp_mb, /* wildcmp */
|
||||
2, /* mbmaxlen */
|
||||
my_ismbchar_ucs2, /* ismbchar */
|
||||
|
|
|
@ -555,8 +555,6 @@ static uchar NEAR like_range_prefix_max_win1250ch[] = {
|
|||
|
||||
#define min_sort_char '\x00'
|
||||
#define max_sort_char '\xff'
|
||||
#define wild_one '_'
|
||||
#define wild_many '%'
|
||||
|
||||
/*
|
||||
** Calculate min_str and max_str that ranges a LIKE string.
|
||||
|
@ -577,7 +575,8 @@ static uchar NEAR like_range_prefix_max_win1250ch[] = {
|
|||
|
||||
static my_bool my_like_range_win1250ch(CHARSET_INFO *cs __attribute__((unused)),
|
||||
const char *ptr, uint ptr_length,
|
||||
pchar escape, uint res_length,
|
||||
int escape, int w_one, int w_many,
|
||||
uint res_length,
|
||||
char *min_str, char *max_str,
|
||||
uint *min_length, uint *max_length) {
|
||||
|
||||
|
@ -589,10 +588,10 @@ static my_bool my_like_range_win1250ch(CHARSET_INFO *cs __attribute__((unused)),
|
|||
/* return 1; */
|
||||
|
||||
for (; ptr != end && min_str != min_end ; ptr++) {
|
||||
if (*ptr == wild_one) { /* '_' in SQL */
|
||||
if (*ptr == w_one) { /* '_' in SQL */
|
||||
break;
|
||||
}
|
||||
if (*ptr == wild_many) { /* '%' in SQL */
|
||||
if (*ptr == w_many) { /* '%' in SQL */
|
||||
break;
|
||||
}
|
||||
if (*ptr == escape && ptr + 1 != end) { /* Skip escape */
|
||||
|
|
|
@ -2822,7 +2822,7 @@ static CHARSET_INFO compiled_charsets[] = {
|
|||
0, /* strxfrm_multiply */
|
||||
my_strnncoll_simple,/* strnncoll */
|
||||
NULL, /* strnxfrm */
|
||||
NULL, /* like_range */
|
||||
my_like_range_simple,/* like_range */
|
||||
my_wildcmp_8bit, /* wildcmp */
|
||||
1, /* mbmaxlen */
|
||||
NULL, /* ismbchar */
|
||||
|
@ -2865,7 +2865,7 @@ static CHARSET_INFO compiled_charsets[] = {
|
|||
0, /* strxfrm_multiply */
|
||||
my_strnncoll_simple,/* strnncoll */
|
||||
NULL, /* strnxfrm */
|
||||
NULL, /* like_range */
|
||||
my_like_range_simple,/* like_range */
|
||||
my_wildcmp_8bit, /* wildcmp */
|
||||
1, /* mbmaxlen */
|
||||
NULL, /* ismbchar */
|
||||
|
@ -2907,7 +2907,7 @@ static CHARSET_INFO compiled_charsets[] = {
|
|||
0, /* strxfrm_multiply */
|
||||
my_strnncoll_simple,/* strnncoll */
|
||||
NULL, /* strnxfrm */
|
||||
NULL, /* like_range */
|
||||
my_like_range_simple,/* like_range */
|
||||
my_wildcmp_8bit, /* wildcmp */
|
||||
1, /* mbmaxlen */
|
||||
NULL, /* ismbchar */
|
||||
|
@ -2949,7 +2949,7 @@ static CHARSET_INFO compiled_charsets[] = {
|
|||
0, /* strxfrm_multiply */
|
||||
my_strnncoll_simple,/* strnncoll */
|
||||
NULL, /* strnxfrm */
|
||||
NULL, /* like_range */
|
||||
my_like_range_simple,/* like_range */
|
||||
my_wildcmp_8bit, /* wildcmp */
|
||||
1, /* mbmaxlen */
|
||||
NULL, /* ismbchar */
|
||||
|
@ -2992,7 +2992,7 @@ static CHARSET_INFO compiled_charsets[] = {
|
|||
0, /* strxfrm_multiply */
|
||||
my_strnncoll_simple,/* strnncoll */
|
||||
NULL, /* strnxfrm */
|
||||
NULL, /* like_range */
|
||||
my_like_range_simple,/* like_range */
|
||||
my_wildcmp_8bit, /* wildcmp */
|
||||
1, /* mbmaxlen */
|
||||
NULL, /* ismbchar */
|
||||
|
@ -3034,7 +3034,7 @@ static CHARSET_INFO compiled_charsets[] = {
|
|||
0, /* strxfrm_multiply */
|
||||
my_strnncoll_simple,/* strnncoll */
|
||||
NULL, /* strnxfrm */
|
||||
NULL, /* like_range */
|
||||
my_like_range_simple,/* like_range */
|
||||
my_wildcmp_8bit, /* wildcmp */
|
||||
1, /* mbmaxlen */
|
||||
NULL, /* ismbchar */
|
||||
|
@ -3076,7 +3076,7 @@ static CHARSET_INFO compiled_charsets[] = {
|
|||
0, /* strxfrm_multiply */
|
||||
my_strnncoll_simple,/* strnncoll */
|
||||
NULL, /* strnxfrm */
|
||||
NULL, /* like_range */
|
||||
my_like_range_simple,/* like_range */
|
||||
my_wildcmp_8bit, /* wildcmp */
|
||||
1, /* mbmaxlen */
|
||||
NULL, /* ismbchar */
|
||||
|
@ -3118,7 +3118,7 @@ static CHARSET_INFO compiled_charsets[] = {
|
|||
0, /* strxfrm_multiply */
|
||||
my_strnncoll_simple,/* strnncoll */
|
||||
NULL, /* strnxfrm */
|
||||
NULL, /* like_range */
|
||||
my_like_range_simple,/* like_range */
|
||||
my_wildcmp_8bit, /* wildcmp */
|
||||
1, /* mbmaxlen */
|
||||
NULL, /* ismbchar */
|
||||
|
@ -3161,7 +3161,7 @@ static CHARSET_INFO compiled_charsets[] = {
|
|||
0, /* strxfrm_multiply */
|
||||
my_strnncoll_simple,/* strnncoll */
|
||||
NULL, /* strnxfrm */
|
||||
NULL, /* like_range */
|
||||
my_like_range_simple,/* like_range */
|
||||
my_wildcmp_8bit, /* wildcmp */
|
||||
1, /* mbmaxlen */
|
||||
NULL, /* ismbchar */
|
||||
|
@ -3203,7 +3203,7 @@ static CHARSET_INFO compiled_charsets[] = {
|
|||
0, /* strxfrm_multiply */
|
||||
my_strnncoll_simple,/* strnncoll */
|
||||
NULL, /* strnxfrm */
|
||||
NULL, /* like_range */
|
||||
my_like_range_simple,/* like_range */
|
||||
my_wildcmp_8bit, /* wildcmp */
|
||||
1, /* mbmaxlen */
|
||||
NULL, /* ismbchar */
|
||||
|
@ -3245,7 +3245,7 @@ static CHARSET_INFO compiled_charsets[] = {
|
|||
0, /* strxfrm_multiply */
|
||||
my_strnncoll_simple,/* strnncoll */
|
||||
NULL, /* strnxfrm */
|
||||
NULL, /* like_range */
|
||||
my_like_range_simple,/* like_range */
|
||||
my_wildcmp_8bit, /* wildcmp */
|
||||
1, /* mbmaxlen */
|
||||
NULL, /* ismbchar */
|
||||
|
@ -3287,7 +3287,7 @@ static CHARSET_INFO compiled_charsets[] = {
|
|||
0, /* strxfrm_multiply */
|
||||
my_strnncoll_simple,/* strnncoll */
|
||||
NULL, /* strnxfrm */
|
||||
NULL, /* like_range */
|
||||
my_like_range_simple,/* like_range */
|
||||
my_wildcmp_8bit, /* wildcmp */
|
||||
1, /* mbmaxlen */
|
||||
NULL, /* ismbchar */
|
||||
|
@ -3329,7 +3329,7 @@ static CHARSET_INFO compiled_charsets[] = {
|
|||
0, /* strxfrm_multiply */
|
||||
my_strnncoll_simple,/* strnncoll */
|
||||
NULL, /* strnxfrm */
|
||||
NULL, /* like_range */
|
||||
my_like_range_simple,/* like_range */
|
||||
my_wildcmp_8bit, /* wildcmp */
|
||||
1, /* mbmaxlen */
|
||||
NULL, /* ismbchar */
|
||||
|
@ -3371,7 +3371,7 @@ static CHARSET_INFO compiled_charsets[] = {
|
|||
0, /* strxfrm_multiply */
|
||||
my_strnncoll_simple,/* strnncoll */
|
||||
NULL, /* strnxfrm */
|
||||
NULL, /* like_range */
|
||||
my_like_range_simple,/* like_range */
|
||||
my_wildcmp_8bit, /* wildcmp */
|
||||
1, /* mbmaxlen */
|
||||
NULL, /* ismbchar */
|
||||
|
@ -3413,7 +3413,7 @@ static CHARSET_INFO compiled_charsets[] = {
|
|||
0, /* strxfrm_multiply */
|
||||
my_strnncoll_simple,/* strnncoll */
|
||||
NULL, /* strnxfrm */
|
||||
NULL, /* like_range */
|
||||
my_like_range_simple,/* like_range */
|
||||
my_wildcmp_8bit, /* wildcmp */
|
||||
1, /* mbmaxlen */
|
||||
NULL, /* ismbchar */
|
||||
|
@ -3456,7 +3456,7 @@ static CHARSET_INFO compiled_charsets[] = {
|
|||
0, /* strxfrm_multiply */
|
||||
my_strnncoll_simple,/* strnncoll */
|
||||
NULL, /* strnxfrm */
|
||||
NULL, /* like_range */
|
||||
my_like_range_simple,/* like_range */
|
||||
my_wildcmp_8bit, /* wildcmp */
|
||||
1, /* mbmaxlen */
|
||||
NULL, /* ismbchar */
|
||||
|
@ -3498,7 +3498,7 @@ static CHARSET_INFO compiled_charsets[] = {
|
|||
0, /* strxfrm_multiply */
|
||||
my_strnncoll_simple,/* strnncoll */
|
||||
NULL, /* strnxfrm */
|
||||
NULL, /* like_range */
|
||||
my_like_range_simple,/* like_range */
|
||||
my_wildcmp_8bit, /* wildcmp */
|
||||
1, /* mbmaxlen */
|
||||
NULL, /* ismbchar */
|
||||
|
@ -3541,7 +3541,7 @@ static CHARSET_INFO compiled_charsets[] = {
|
|||
0, /* strxfrm_multiply */
|
||||
my_strnncoll_simple,/* strnncoll */
|
||||
NULL, /* strnxfrm */
|
||||
NULL, /* like_range */
|
||||
my_like_range_simple,/* like_range */
|
||||
my_wildcmp_8bit, /* wildcmp */
|
||||
1, /* mbmaxlen */
|
||||
NULL, /* ismbchar */
|
||||
|
@ -3584,7 +3584,7 @@ static CHARSET_INFO compiled_charsets[] = {
|
|||
0, /* strxfrm_multiply */
|
||||
my_strnncoll_simple,/* strnncoll */
|
||||
NULL, /* strnxfrm */
|
||||
NULL, /* like_range */
|
||||
my_like_range_simple,/* like_range */
|
||||
my_wildcmp_8bit, /* wildcmp */
|
||||
1, /* mbmaxlen */
|
||||
NULL, /* ismbchar */
|
||||
|
@ -3626,7 +3626,7 @@ static CHARSET_INFO compiled_charsets[] = {
|
|||
0, /* strxfrm_multiply */
|
||||
my_strnncoll_simple,/* strnncoll */
|
||||
NULL, /* strnxfrm */
|
||||
NULL, /* like_range */
|
||||
my_like_range_simple,/* like_range */
|
||||
my_wildcmp_8bit, /* wildcmp */
|
||||
1, /* mbmaxlen */
|
||||
NULL, /* ismbchar */
|
||||
|
@ -3668,7 +3668,7 @@ static CHARSET_INFO compiled_charsets[] = {
|
|||
0, /* strxfrm_multiply */
|
||||
my_strnncoll_simple,/* strnncoll */
|
||||
NULL, /* strnxfrm */
|
||||
NULL, /* like_range */
|
||||
my_like_range_simple,/* like_range */
|
||||
my_wildcmp_8bit, /* wildcmp */
|
||||
1, /* mbmaxlen */
|
||||
NULL, /* ismbchar */
|
||||
|
@ -3710,7 +3710,7 @@ static CHARSET_INFO compiled_charsets[] = {
|
|||
0, /* strxfrm_multiply */
|
||||
my_strnncoll_simple,/* strnncoll */
|
||||
NULL, /* strnxfrm */
|
||||
NULL, /* like_range */
|
||||
my_like_range_simple,/* like_range */
|
||||
my_wildcmp_8bit, /* wildcmp */
|
||||
1, /* mbmaxlen */
|
||||
NULL, /* ismbchar */
|
||||
|
@ -3752,7 +3752,7 @@ static CHARSET_INFO compiled_charsets[] = {
|
|||
0, /* strxfrm_multiply */
|
||||
my_strnncoll_simple,/* strnncoll */
|
||||
NULL, /* strnxfrm */
|
||||
NULL, /* like_range */
|
||||
my_like_range_simple,/* like_range */
|
||||
my_wildcmp_8bit, /* wildcmp */
|
||||
1, /* mbmaxlen */
|
||||
NULL, /* ismbchar */
|
||||
|
|
Loading…
Reference in a new issue