mirror of
https://github.com/MariaDB/server.git
synced 2025-01-15 19:42:28 +01:00
MDEV-21581 Helper functions and methods for CHARSET_INFO
This commit is contained in:
parent
dd68ba74f3
commit
f1e13fdc8d
118 changed files with 1416 additions and 1025 deletions
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
Copyright (c) 2000, 2018, Oracle and/or its affiliates.
|
||||
Copyright (c) 2009, 2019, MariaDB Corporation.
|
||||
Copyright (c) 2009, 2020, MariaDB Corporation.
|
||||
|
||||
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
|
||||
|
@ -1092,8 +1092,8 @@ inline bool is_delimiter_command(char *name, ulong len)
|
|||
only name(first DELIMITER_NAME_LEN bytes) is checked.
|
||||
*/
|
||||
return (len >= DELIMITER_NAME_LEN &&
|
||||
!my_strnncoll(&my_charset_latin1, (uchar*) name, DELIMITER_NAME_LEN,
|
||||
(uchar *) DELIMITER_NAME, DELIMITER_NAME_LEN));
|
||||
!my_charset_latin1.strnncoll(name, DELIMITER_NAME_LEN,
|
||||
DELIMITER_NAME, DELIMITER_NAME_LEN));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2254,7 +2254,7 @@ static COMMANDS *find_command(char *name)
|
|||
*/
|
||||
for (uint i= 0; commands[i].func; i++)
|
||||
{
|
||||
if (!my_strnncoll(&my_charset_latin1, (uchar*) name, len,
|
||||
if (!my_charset_latin1.strnncoll((uchar*) name, len,
|
||||
(uchar*) commands[i].name, len) &&
|
||||
(commands[i].name[len] == '\0') &&
|
||||
(!end || (commands[i].takes_params && get_arg(name, CHECK))))
|
||||
|
@ -2306,7 +2306,7 @@ static bool add_line(String &buffer, char *line, size_t line_length,
|
|||
#ifdef USE_MB
|
||||
// Accept multi-byte characters as-is
|
||||
int length;
|
||||
if (use_mb(charset_info) &&
|
||||
if (charset_info->use_mb() &&
|
||||
(length= my_ismbchar(charset_info, pos, end_of_line)))
|
||||
{
|
||||
if (!*ml_comment || preserve_comments)
|
||||
|
@ -3241,8 +3241,7 @@ com_go(String *buffer,char *line __attribute__((unused)))
|
|||
(void) com_print(buffer,0);
|
||||
|
||||
if (skip_updates &&
|
||||
(buffer->length() < 4 || my_strnncoll(charset_info,
|
||||
(const uchar*)buffer->ptr(),4,
|
||||
(buffer->length() < 4 || charset_info->strnncoll((const uchar*)buffer->ptr(),4,
|
||||
(const uchar*)"SET ",4)))
|
||||
{
|
||||
(void) put_info("Ignoring query to other database",INFO_INFO);
|
||||
|
@ -3613,8 +3612,7 @@ print_table_data(MYSQL_RES *result)
|
|||
for (uint off=0; (field = mysql_fetch_field(result)) ; off++)
|
||||
{
|
||||
size_t name_length= (uint) strlen(field->name);
|
||||
size_t numcells= charset_info->cset->numcells(charset_info,
|
||||
field->name,
|
||||
size_t numcells= charset_info->numcells(field->name,
|
||||
field->name + name_length);
|
||||
size_t display_length= field->max_length + name_length - numcells;
|
||||
tee_fprintf(PAGER, " %-*s |",(int) MY_MIN(display_length,
|
||||
|
@ -3664,7 +3662,7 @@ print_table_data(MYSQL_RES *result)
|
|||
We need to find how much screen real-estate we will occupy to know how
|
||||
many extra padding-characters we should send with the printing function.
|
||||
*/
|
||||
size_t visible_length= charset_info->cset->numcells(charset_info, buffer, buffer + data_length);
|
||||
size_t visible_length= charset_info->numcells(buffer, buffer + data_length);
|
||||
extra_padding= (uint) (data_length - visible_length);
|
||||
|
||||
if (opt_binhex && is_binary_field(field))
|
||||
|
@ -4011,7 +4009,7 @@ safe_put_field(const char *pos,ulong length)
|
|||
{
|
||||
#ifdef USE_MB
|
||||
int l;
|
||||
if (use_mb(charset_info) &&
|
||||
if (charset_info->use_mb() &&
|
||||
(l = my_ismbchar(charset_info, pos, end)))
|
||||
{
|
||||
while (l--)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
Copyright (c) 2000, 2013, Oracle and/or its affiliates.
|
||||
Copyright (c) 2010, 2019, MariaDB Corporation.
|
||||
Copyright (c) 2010, 2020, MariaDB Corporation.
|
||||
|
||||
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
|
||||
|
@ -1374,7 +1374,7 @@ static char *my_case_str(const char *str,
|
|||
{
|
||||
my_match_t match;
|
||||
|
||||
uint status= my_charset_latin1.coll->instr(&my_charset_latin1,
|
||||
uint status= my_ci_instr(&my_charset_latin1,
|
||||
str, str_len,
|
||||
token, token_len,
|
||||
&match, 1);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/* Copyright (c) 2000, 2013, Oracle and/or its affiliates.
|
||||
Copyright (c) 2009, 2019, MariaDB
|
||||
Copyright (c) 2009, 2020, MariaDB
|
||||
|
||||
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
|
||||
|
@ -6733,14 +6733,14 @@ int read_line()
|
|||
if (!skip_char)
|
||||
{
|
||||
*p++= c;
|
||||
if (use_mb(charset_info))
|
||||
if (charset_info->use_mb())
|
||||
{
|
||||
const char *mb_start= p - 1;
|
||||
/* Could be a multibyte character */
|
||||
/* See a similar code in "sql_load.cc" */
|
||||
for ( ; p < buf_end; )
|
||||
{
|
||||
int charlen= my_charlen(charset_info, mb_start, p);
|
||||
int charlen= charset_info->charlen(mb_start, p);
|
||||
if (charlen > 0)
|
||||
break; /* Full character */
|
||||
if (MY_CS_IS_TOOSMALL(charlen))
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
/*
|
||||
Copyright (c) 2000, 2013, Oracle and/or its affiliates.
|
||||
Copyright (c) 2009, 2020, MariaDB Corporation.
|
||||
|
||||
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
|
||||
|
@ -96,7 +97,7 @@ bool String::set(longlong num, CHARSET_INFO *cs)
|
|||
|
||||
if (alloc(l))
|
||||
return TRUE;
|
||||
str_length=(uint32) (cs->cset->longlong10_to_str)(cs,Ptr,l,-10,num);
|
||||
str_length=(uint32) (cs->longlong10_to_str)(Ptr,l,-10,num);
|
||||
str_charset=cs;
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -107,7 +108,7 @@ bool String::set(ulonglong num, CHARSET_INFO *cs)
|
|||
|
||||
if (alloc(l))
|
||||
return TRUE;
|
||||
str_length=(uint32) (cs->cset->longlong10_to_str)(cs,Ptr,l,10,num);
|
||||
str_length=(uint32) (cs->longlong10_to_str)(Ptr,l,10,num);
|
||||
str_charset=cs;
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -480,14 +481,14 @@ bool String::append_with_prefill(const char *s,uint32 arg_length,
|
|||
|
||||
uint32 String::numchars()
|
||||
{
|
||||
return str_charset->cset->numchars(str_charset, Ptr, Ptr+str_length);
|
||||
return str_charset->(Ptr, Ptr+str_length);
|
||||
}
|
||||
|
||||
int String::charpos(longlong i,uint32 offset)
|
||||
{
|
||||
if (i <= 0)
|
||||
return (int)i;
|
||||
return (int)str_charset->cset->charpos(str_charset,Ptr+offset,Ptr+str_length,(size_t)i);
|
||||
return (int)str_charset->charpos(Ptr+offset,Ptr+str_length,(size_t)i);
|
||||
}
|
||||
|
||||
int String::strstr(const String &s,uint32 offset)
|
||||
|
@ -655,9 +656,8 @@ void String::qs_append(uint i)
|
|||
|
||||
int sortcmp(const String *s,const String *t, CHARSET_INFO *cs)
|
||||
{
|
||||
return cs->coll->strnncollsp(cs,
|
||||
(unsigned char *) s->ptr(),s->length(),
|
||||
(unsigned char *) t->ptr(),t->length(), 0);
|
||||
return cs->strnncollsp(s->ptr(), s->length(),
|
||||
t->ptr(), t->length());
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
/* Copyright (c) 2000, 2013, Oracle and/or its affiliates.
|
||||
Copyright (c) 2009, 2020, MariaDB Corporation.
|
||||
|
||||
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
|
||||
|
@ -537,7 +538,7 @@ struct my_charset_handler_st
|
|||
- MB3 native code is ((b0 <<16) + (b1 << 8) + b2)
|
||||
Note, CHARSET_INFO::min_sort_char and CHARSET_INFO::max_sort_char
|
||||
are defined in native notation and should be written using
|
||||
cs->cset->native_to_mb() rather than cs->cset->wc_mb().
|
||||
my_ci_native_to_mb() rather than my_ci_wc_mb().
|
||||
*/
|
||||
my_charset_conv_wc_mb native_to_mb;
|
||||
};
|
||||
|
@ -553,6 +554,7 @@ extern MY_CHARSET_HANDLER my_charset_utf8mb3_handler;
|
|||
*/
|
||||
#define CHARSET_INFO_DEFINED
|
||||
|
||||
|
||||
/* See strings/CHARSET_INFO.txt about information on this structure */
|
||||
struct charset_info_st
|
||||
{
|
||||
|
@ -564,7 +566,7 @@ struct charset_info_st
|
|||
const char *name;
|
||||
const char *comment;
|
||||
const char *tailoring;
|
||||
const uchar *ctype;
|
||||
const uchar *m_ctype;
|
||||
const uchar *to_lower;
|
||||
const uchar *to_upper;
|
||||
const uchar *sort_order;
|
||||
|
@ -588,7 +590,501 @@ struct charset_info_st
|
|||
MY_CHARSET_HANDLER *cset;
|
||||
MY_COLLATION_HANDLER *coll;
|
||||
|
||||
#ifdef __cplusplus
|
||||
/* Character set routines */
|
||||
bool use_mb() const
|
||||
{
|
||||
return mbmaxlen > 1;
|
||||
}
|
||||
|
||||
size_t numchars(const char *b, const char *e) const
|
||||
{
|
||||
return (cset->numchars)(this, b, e);
|
||||
}
|
||||
|
||||
size_t charpos(const char *b, const char *e, size_t pos) const
|
||||
{
|
||||
return (cset->charpos)(this, b, e, pos);
|
||||
}
|
||||
size_t charpos(const uchar *b, const uchar *e, size_t pos) const
|
||||
{
|
||||
return (cset->charpos)(this, (const char *) b, (const char*) e, pos);
|
||||
}
|
||||
|
||||
size_t lengthsp(const char *str, size_t length) const
|
||||
{
|
||||
return (cset->lengthsp)(this, str, length);
|
||||
}
|
||||
|
||||
size_t numcells(const char *b, const char *e) const
|
||||
{
|
||||
return (cset->numcells)(this, b, e);
|
||||
}
|
||||
|
||||
size_t caseup(const char *src, size_t srclen,
|
||||
char *dst, size_t dstlen) const
|
||||
{
|
||||
return (cset->caseup)(this, src, srclen, dst, dstlen);
|
||||
}
|
||||
|
||||
size_t casedn(const char *src, size_t srclen,
|
||||
char *dst, size_t dstlen) const
|
||||
{
|
||||
return (cset->casedn)(this, src, srclen, dst, dstlen);
|
||||
}
|
||||
|
||||
size_t long10_to_str(char *dst, size_t dstlen,
|
||||
int radix, long int val) const
|
||||
{
|
||||
return (cset->long10_to_str)(this, dst, dstlen, radix, val);
|
||||
}
|
||||
|
||||
size_t (longlong10_to_str)(char *dst, size_t dstlen,
|
||||
int radix, longlong val) const
|
||||
{
|
||||
return (cset->longlong10_to_str)(this, dst, dstlen, radix, val);
|
||||
}
|
||||
|
||||
int mb_wc(my_wc_t *wc, const uchar *b, const uchar *e) const
|
||||
{
|
||||
return (cset->mb_wc)(this, wc, b, e);
|
||||
}
|
||||
|
||||
int wc_mb(my_wc_t wc, uchar *s, uchar *e) const
|
||||
{
|
||||
return (cset->wc_mb)(this, wc, s, e);
|
||||
}
|
||||
|
||||
int native_to_mb(my_wc_t wc, uchar *s, uchar *e) const
|
||||
{
|
||||
return (cset->native_to_mb)(this, wc, s, e);
|
||||
}
|
||||
|
||||
int ctype(int *to, const uchar *s, const uchar *e) const
|
||||
{
|
||||
return (cset->ctype)(this, to, s, e);
|
||||
}
|
||||
|
||||
void fill(char *to, size_t len, int ch) const
|
||||
{
|
||||
(cset->fill)(this, to, len, ch);
|
||||
}
|
||||
|
||||
long strntol(const char *str, size_t length,
|
||||
int base, char **endptr, int *error) const
|
||||
{
|
||||
return (cset->strntol)(this, str, length, base, endptr, error);
|
||||
}
|
||||
|
||||
ulong strntoul(const char *str, size_t length,
|
||||
int base, char **endptr, int *error) const
|
||||
{
|
||||
return (cset->strntoul)(this, str, length, base, endptr, error);
|
||||
}
|
||||
|
||||
longlong strntoll(const char *str, size_t length,
|
||||
int base, char **endptr, int *error) const
|
||||
{
|
||||
return (cset->strntoll)(this, str, length, base, endptr, error);
|
||||
}
|
||||
|
||||
ulonglong strntoull(const char *str, size_t length,
|
||||
int base, char **endptr, int *error) const
|
||||
{
|
||||
return (cset->strntoull)(this, str, length, base, endptr, error);
|
||||
}
|
||||
|
||||
double strntod(char *str, size_t length,
|
||||
char **endptr, int *error) const
|
||||
{
|
||||
return (cset->strntod)(this, str, length, endptr, error);
|
||||
}
|
||||
|
||||
longlong strtoll10(const char *str, char **endptr, int *error) const
|
||||
{
|
||||
return (cset->strtoll10)(this, str, endptr, error);
|
||||
}
|
||||
|
||||
ulonglong strntoull10rnd(const char *str, size_t length, int unsigned_fl,
|
||||
char **endptr, int *error) const
|
||||
{
|
||||
return (cset->strntoull10rnd)(this, str, length, unsigned_fl, endptr, error);
|
||||
}
|
||||
|
||||
size_t scan(const char *b, const char *e, int seq) const
|
||||
{
|
||||
return (cset->scan)(this, b, e, seq);
|
||||
}
|
||||
|
||||
int charlen(const uchar *str, const uchar *end) const
|
||||
{
|
||||
return (cset->charlen)(this, str, end);
|
||||
}
|
||||
int charlen(const char *str, const char *end) const
|
||||
{
|
||||
return (cset->charlen)(this, (const uchar *) str, (const uchar *) end);
|
||||
}
|
||||
|
||||
uint charlen_fix(const uchar *str, const uchar *end) const
|
||||
{
|
||||
int char_length= (cset->charlen)(this, str, end);
|
||||
DBUG_ASSERT(str < end);
|
||||
return char_length > 0 ? (uint) char_length : (uint) 1U;
|
||||
}
|
||||
uint charlen_fix(const char *str, const char *end) const
|
||||
{
|
||||
return charlen_fix((const uchar *) str, (const uchar *) end);
|
||||
}
|
||||
|
||||
size_t well_formed_char_length(const char *str, const char *end,
|
||||
size_t nchars,
|
||||
MY_STRCOPY_STATUS *status) const
|
||||
{
|
||||
return (cset->well_formed_char_length)(this, str, end, nchars, status);
|
||||
}
|
||||
|
||||
size_t copy_fix(char *dst, size_t dst_length,
|
||||
const char *src, size_t src_length,
|
||||
size_t nchars, MY_STRCOPY_STATUS *status) const
|
||||
{
|
||||
return (cset->copy_fix)(this, dst, dst_length, src, src_length, nchars,
|
||||
status);
|
||||
}
|
||||
|
||||
/* Collation routines */
|
||||
int strnncoll(const uchar *a, size_t alen,
|
||||
const uchar *b, size_t blen, my_bool b_is_prefix= FALSE) const
|
||||
{
|
||||
return (coll->strnncoll)(this, a, alen, b, blen, b_is_prefix);
|
||||
}
|
||||
int strnncoll(const char *a, size_t alen,
|
||||
const char *b, size_t blen, my_bool b_is_prefix= FALSE) const
|
||||
{
|
||||
return (coll->strnncoll)(this,
|
||||
(const uchar *) a, alen,
|
||||
(const uchar *) b, blen, b_is_prefix);
|
||||
}
|
||||
|
||||
int strnncollsp(const uchar *a, size_t alen,
|
||||
const uchar *b, size_t blen) const
|
||||
{
|
||||
return (coll->strnncollsp)(this, a, alen, b, blen);
|
||||
}
|
||||
int strnncollsp(const char *a, size_t alen,
|
||||
const char *b, size_t blen) const
|
||||
{
|
||||
return (coll->strnncollsp)(this, (uchar *) a, alen, (uchar *) b, blen);
|
||||
}
|
||||
|
||||
size_t strnxfrm(char *dst, size_t dstlen, uint nweights,
|
||||
const char *src, size_t srclen, uint flags) const
|
||||
{
|
||||
return (coll->strnxfrm)(this,
|
||||
(uchar *) dst, dstlen, nweights,
|
||||
(const uchar *) src, srclen, flags);
|
||||
}
|
||||
size_t strnxfrm(uchar *dst, size_t dstlen, uint nweights,
|
||||
const uchar *src, size_t srclen, uint flags) const
|
||||
{
|
||||
return (coll->strnxfrm)(this,
|
||||
dst, dstlen, nweights,
|
||||
src, srclen, flags);
|
||||
}
|
||||
size_t strnxfrm(uchar *dst, size_t dstlen,
|
||||
const uchar *src, size_t srclen) const
|
||||
{
|
||||
return (coll->strnxfrm)(this,
|
||||
dst, dstlen, dstlen,
|
||||
src, srclen, MY_STRXFRM_PAD_WITH_SPACE);
|
||||
}
|
||||
|
||||
size_t strnxfrmlen(size_t length) const
|
||||
{
|
||||
return (coll->strnxfrmlen)(this, length);
|
||||
}
|
||||
|
||||
my_bool like_range(const char *s, size_t s_length,
|
||||
pchar w_prefix, pchar w_one, pchar w_many,
|
||||
size_t res_length,
|
||||
char *min_str, char *max_str,
|
||||
size_t *min_len, size_t *max_len) const
|
||||
{
|
||||
return (coll->like_range)(this, s, s_length,
|
||||
w_prefix, w_one, w_many,
|
||||
res_length, min_str, max_str,
|
||||
min_len, max_len);
|
||||
}
|
||||
|
||||
int wildcmp(const char *str,const char *str_end,
|
||||
const char *wildstr,const char *wildend,
|
||||
int escape,int w_one, int w_many) const
|
||||
{
|
||||
return (coll->wildcmp)(this, str, str_end, wildstr, wildend, escape, w_one, w_many);
|
||||
}
|
||||
|
||||
uint instr(const char *b, size_t b_length,
|
||||
const char *s, size_t s_length,
|
||||
my_match_t *match, uint nmatch) const
|
||||
{
|
||||
return (coll->instr)(this, b, b_length, s, s_length, match, nmatch);
|
||||
}
|
||||
|
||||
void hash_sort(const uchar *key, size_t len, ulong *nr1, ulong *nr2) const
|
||||
{
|
||||
(coll->hash_sort)(this, key, len, nr1, nr2);
|
||||
}
|
||||
|
||||
my_bool propagate(const uchar *str, size_t len) const
|
||||
{
|
||||
return (coll->propagate)(this, str, len);
|
||||
}
|
||||
|
||||
#endif /* __cplusplus */
|
||||
};
|
||||
|
||||
|
||||
/* Character set routines */
|
||||
|
||||
static inline my_bool
|
||||
my_ci_init_charset(struct charset_info_st *ci, MY_CHARSET_LOADER *loader)
|
||||
{
|
||||
if (!ci->cset->init)
|
||||
return FALSE;
|
||||
return (ci->cset->init)(ci, loader);
|
||||
}
|
||||
|
||||
|
||||
static inline my_bool
|
||||
my_ci_use_mb(CHARSET_INFO *ci)
|
||||
{
|
||||
return ci->mbmaxlen > 1 ? TRUE : FALSE;
|
||||
}
|
||||
|
||||
static inline size_t
|
||||
my_ci_numchars(CHARSET_INFO *cs, const char *b, const char *e)
|
||||
{
|
||||
return (cs->cset->numchars)(cs, b, e);
|
||||
}
|
||||
|
||||
static inline size_t
|
||||
my_ci_charpos(CHARSET_INFO *cs, const char *b, const char *e, size_t pos)
|
||||
{
|
||||
return (cs->cset->charpos)(cs, b, e, pos);
|
||||
}
|
||||
|
||||
static inline size_t
|
||||
my_ci_lengthsp(CHARSET_INFO *cs, const char *str, size_t length)
|
||||
{
|
||||
return (cs->cset->lengthsp)(cs, str, length);
|
||||
}
|
||||
|
||||
static inline size_t
|
||||
my_ci_numcells(CHARSET_INFO *cs, const char *b, const char *e)
|
||||
{
|
||||
return (cs->cset->numcells)(cs, b, e);
|
||||
}
|
||||
|
||||
static inline size_t
|
||||
my_ci_caseup(CHARSET_INFO *ci,
|
||||
const char *src, size_t srclen,
|
||||
char *dst, size_t dstlen)
|
||||
{
|
||||
return (ci->cset->caseup)(ci, src, srclen, dst, dstlen);
|
||||
}
|
||||
|
||||
static inline size_t
|
||||
my_ci_casedn(CHARSET_INFO *ci,
|
||||
const char *src, size_t srclen,
|
||||
char *dst, size_t dstlen)
|
||||
{
|
||||
return (ci->cset->casedn)(ci, src, srclen, dst, dstlen);
|
||||
}
|
||||
|
||||
static inline size_t
|
||||
my_ci_long10_to_str(CHARSET_INFO *cs, char *dst, size_t dstlen,
|
||||
int radix, long int val)
|
||||
{
|
||||
return (cs->cset->long10_to_str)(cs, dst, dstlen, radix, val);
|
||||
}
|
||||
|
||||
static inline size_t
|
||||
my_ci_longlong10_to_str(CHARSET_INFO *cs, char *dst, size_t dstlen,
|
||||
int radix, longlong val)
|
||||
{
|
||||
return (cs->cset->longlong10_to_str)(cs, dst, dstlen, radix, val);
|
||||
}
|
||||
|
||||
#define my_ci_mb_wc(s, pwc, b, e) ((s)->cset->mb_wc)(s, pwc, b, e)
|
||||
#define my_ci_wc_mb(s, wc, b, e) ((s)->cset->wc_mb)(s, wc, b, e)
|
||||
#define my_ci_native_to_mb(s, wc, b, e) ((s)->cset->native_to_mb)(s, wc, b, e)
|
||||
#define my_ci_ctype(s, pctype, b, e) ((s)->cset->ctype)(s, pctype, b, e)
|
||||
|
||||
static inline void
|
||||
my_ci_fill(CHARSET_INFO *cs, char *to, size_t len, int ch)
|
||||
{
|
||||
(cs->cset->fill)(cs, to, len, ch);
|
||||
}
|
||||
|
||||
static inline long
|
||||
my_ci_strntol(CHARSET_INFO *cs, const char *str, size_t length,
|
||||
int base, char **endptr, int *error)
|
||||
{
|
||||
return (cs->cset->strntol)(cs, str, length, base, endptr, error);
|
||||
}
|
||||
|
||||
static inline ulong
|
||||
my_ci_strntoul(CHARSET_INFO *cs, const char *str, size_t length,
|
||||
int base, char **endptr, int *error)
|
||||
{
|
||||
return (cs->cset->strntoul)(cs, str, length, base, endptr, error);
|
||||
}
|
||||
|
||||
static inline longlong
|
||||
my_ci_strntoll(CHARSET_INFO *cs, const char *str, size_t length,
|
||||
int base, char **endptr, int *error)
|
||||
{
|
||||
return (cs->cset->strntoll)(cs, str, length, base, endptr, error);
|
||||
}
|
||||
|
||||
static inline ulonglong
|
||||
my_ci_strntoull(CHARSET_INFO *cs, const char *str, size_t length,
|
||||
int base, char **endptr, int *error)
|
||||
{
|
||||
return (cs->cset->strntoull)(cs, str, length, base, endptr, error);
|
||||
}
|
||||
|
||||
static inline double
|
||||
my_ci_strntod(CHARSET_INFO *cs, char *str, size_t length,
|
||||
char **endptr, int *error)
|
||||
{
|
||||
return (cs->cset->strntod)(cs, str, length, endptr, error);
|
||||
}
|
||||
|
||||
static inline longlong
|
||||
my_ci_strtoll10(CHARSET_INFO *cs, const char *str, char **endptr, int *error)
|
||||
{
|
||||
return (cs->cset->strtoll10)(cs, str, endptr, error);
|
||||
}
|
||||
|
||||
static inline ulonglong
|
||||
my_ci_strntoull10rnd(CHARSET_INFO *cs,
|
||||
const char *str, size_t length, int unsigned_fl,
|
||||
char **endptr, int *error)
|
||||
{
|
||||
return (cs->cset->strntoull10rnd)(cs, str, length, unsigned_fl, endptr, error);
|
||||
}
|
||||
|
||||
|
||||
static inline size_t
|
||||
my_ci_scan(CHARSET_INFO *cs, const char *b, const char *e, int seq)
|
||||
{
|
||||
return (cs->cset->scan)(cs, b, e, seq);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Return length of the leftmost character in a string.
|
||||
@param cs - character set
|
||||
@param str - the beginning of the string
|
||||
@param end - the string end (the next byte after the string)
|
||||
@return <=0 on errors (EOL, wrong byte sequence)
|
||||
@return 1 on a single byte character
|
||||
@return >1 on a multi-byte character
|
||||
|
||||
Note, inlike my_ismbchar(), 1 is returned for a single byte character.
|
||||
*/
|
||||
|
||||
static inline int
|
||||
my_ci_charlen(CHARSET_INFO *cs, const uchar *str, const uchar *end)
|
||||
{
|
||||
return (cs->cset->charlen)(cs, str, end);
|
||||
}
|
||||
|
||||
|
||||
static inline size_t
|
||||
my_ci_well_formed_char_length(CHARSET_INFO *cs,
|
||||
const char *str, const char *end,
|
||||
size_t nchars,
|
||||
MY_STRCOPY_STATUS *status)
|
||||
{
|
||||
return (cs->cset->well_formed_char_length)(cs, str, end, nchars, status);
|
||||
}
|
||||
|
||||
|
||||
static inline size_t
|
||||
my_ci_copy_fix(CHARSET_INFO *cs,
|
||||
char *dst, size_t dst_length,
|
||||
const char *src, size_t src_length,
|
||||
size_t nchars, MY_STRCOPY_STATUS *status)
|
||||
{
|
||||
return (cs->cset->copy_fix)(cs, dst, dst_length, src, src_length, nchars,
|
||||
status);
|
||||
}
|
||||
|
||||
|
||||
/* Collation routines */
|
||||
|
||||
static inline my_bool
|
||||
my_ci_init_collation(struct charset_info_st *ci, MY_CHARSET_LOADER *loader)
|
||||
{
|
||||
if (!ci->coll->init)
|
||||
return FALSE;
|
||||
return (ci->coll->init)(ci, loader);
|
||||
}
|
||||
|
||||
|
||||
static inline int
|
||||
my_ci_strnncoll(CHARSET_INFO *ci,
|
||||
const uchar *a, size_t alen,
|
||||
const uchar *b, size_t blen,
|
||||
my_bool b_is_prefix)
|
||||
{
|
||||
return (ci->coll->strnncoll)(ci, a, alen, b, blen, b_is_prefix);
|
||||
}
|
||||
|
||||
static inline int
|
||||
my_ci_strnncollsp(CHARSET_INFO *ci,
|
||||
const uchar *a, size_t alen,
|
||||
const uchar *b, size_t blen)
|
||||
{
|
||||
return (ci->coll->strnncollsp)(ci, a, alen, b, blen);
|
||||
}
|
||||
|
||||
|
||||
static inline my_bool
|
||||
my_ci_like_range(CHARSET_INFO *ci,
|
||||
const char *s, size_t s_length,
|
||||
pchar w_prefix, pchar w_one, pchar w_many,
|
||||
size_t res_length,
|
||||
char *min_str, char *max_str,
|
||||
size_t *min_len, size_t *max_len)
|
||||
{
|
||||
return (ci->coll->like_range)(ci, s, s_length,
|
||||
w_prefix, w_one, w_many,
|
||||
res_length, min_str, max_str,
|
||||
min_len, max_len);
|
||||
}
|
||||
|
||||
|
||||
static inline uint
|
||||
my_ci_instr(CHARSET_INFO *ci,
|
||||
const char *b, size_t b_length,
|
||||
const char *s, size_t s_length,
|
||||
my_match_t *match, uint nmatch)
|
||||
{
|
||||
return (ci->coll->instr)(ci, b, b_length, s, s_length, match, nmatch);
|
||||
}
|
||||
|
||||
|
||||
static inline void
|
||||
my_ci_hash_sort(CHARSET_INFO *ci,
|
||||
const uchar *key, size_t len,
|
||||
ulong *nr1, ulong *nr2)
|
||||
{
|
||||
(ci->coll->hash_sort)(ci, key, len, nr1, nr2);
|
||||
}
|
||||
|
||||
|
||||
#define ILLEGAL_CHARSET_INFO_NUMBER (~0U)
|
||||
|
||||
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_bin;
|
||||
|
@ -1013,17 +1509,17 @@ size_t my_convert_fix(CHARSET_INFO *dstcs, char *dst, size_t dst_length,
|
|||
#define my_toprint(c) ((c) | 64)
|
||||
#define my_toupper(s,c) (char) ((s)->to_upper[(uchar) (c)])
|
||||
#define my_tolower(s,c) (char) ((s)->to_lower[(uchar) (c)])
|
||||
#define my_isalpha(s, c) (((s)->ctype+1)[(uchar) (c)] & (_MY_U | _MY_L))
|
||||
#define my_isupper(s, c) (((s)->ctype+1)[(uchar) (c)] & _MY_U)
|
||||
#define my_islower(s, c) (((s)->ctype+1)[(uchar) (c)] & _MY_L)
|
||||
#define my_isdigit(s, c) (((s)->ctype+1)[(uchar) (c)] & _MY_NMR)
|
||||
#define my_isxdigit(s, c) (((s)->ctype+1)[(uchar) (c)] & _MY_X)
|
||||
#define my_isalnum(s, c) (((s)->ctype+1)[(uchar) (c)] & (_MY_U | _MY_L | _MY_NMR))
|
||||
#define my_isspace(s, c) (((s)->ctype+1)[(uchar) (c)] & _MY_SPC)
|
||||
#define my_ispunct(s, c) (((s)->ctype+1)[(uchar) (c)] & _MY_PNT)
|
||||
#define my_isprint(s, c) (((s)->ctype+1)[(uchar) (c)] & (_MY_PNT | _MY_U | _MY_L | _MY_NMR | _MY_B))
|
||||
#define my_isgraph(s, c) (((s)->ctype+1)[(uchar) (c)] & (_MY_PNT | _MY_U | _MY_L | _MY_NMR))
|
||||
#define my_iscntrl(s, c) (((s)->ctype+1)[(uchar) (c)] & _MY_CTR)
|
||||
#define my_isalpha(s, c) (((s)->m_ctype+1)[(uchar) (c)] & (_MY_U | _MY_L))
|
||||
#define my_isupper(s, c) (((s)->m_ctype+1)[(uchar) (c)] & _MY_U)
|
||||
#define my_islower(s, c) (((s)->m_ctype+1)[(uchar) (c)] & _MY_L)
|
||||
#define my_isdigit(s, c) (((s)->m_ctype+1)[(uchar) (c)] & _MY_NMR)
|
||||
#define my_isxdigit(s, c) (((s)->m_ctype+1)[(uchar) (c)] & _MY_X)
|
||||
#define my_isalnum(s, c) (((s)->m_ctype+1)[(uchar) (c)] & (_MY_U | _MY_L | _MY_NMR))
|
||||
#define my_isspace(s, c) (((s)->m_ctype+1)[(uchar) (c)] & _MY_SPC)
|
||||
#define my_ispunct(s, c) (((s)->m_ctype+1)[(uchar) (c)] & _MY_PNT)
|
||||
#define my_isprint(s, c) (((s)->m_ctype+1)[(uchar) (c)] & (_MY_PNT | _MY_U | _MY_L | _MY_NMR | _MY_B))
|
||||
#define my_isgraph(s, c) (((s)->m_ctype+1)[(uchar) (c)] & (_MY_PNT | _MY_U | _MY_L | _MY_NMR))
|
||||
#define my_iscntrl(s, c) (((s)->m_ctype+1)[(uchar) (c)] & _MY_CTR)
|
||||
|
||||
/* Some macros that should be cleaned up a little */
|
||||
#define my_isvar(s,c) (my_isalnum(s,c) || (c) == '_')
|
||||
|
@ -1031,16 +1527,9 @@ size_t my_convert_fix(CHARSET_INFO *dstcs, char *dst, size_t dst_length,
|
|||
|
||||
#define my_binary_compare(s) ((s)->state & MY_CS_BINSORT)
|
||||
#define use_strnxfrm(s) ((s)->state & MY_CS_STRNXFRM)
|
||||
#define my_strnxfrm(cs, d, dl, s, sl) \
|
||||
((cs)->coll->strnxfrm((cs), (d), (dl), (dl), (s), (sl), MY_STRXFRM_PAD_WITH_SPACE))
|
||||
#define my_strnncoll(s, a, b, c, d) ((s)->coll->strnncoll((s), (a), (b), (c), (d), 0))
|
||||
#define my_like_range(s, a, b, c, d, e, f, g, h, i, j) \
|
||||
((s)->coll->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)->coll->wildcmp((cs),(s),(se),(w),(we),(e),(o),(m)))
|
||||
#define my_strcasecmp(s, a, b) ((s)->coll->strcasecmp((s), (a), (b)))
|
||||
#define my_charpos(cs, b, e, num) (cs)->cset->charpos((cs), (const char*) (b), (const char *)(e), (num))
|
||||
|
||||
#define use_mb(s) ((s)->mbmaxlen > 1)
|
||||
/**
|
||||
Detect if the leftmost character in a string is a valid multi-byte character
|
||||
and return its length, or return 0 otherwise.
|
||||
|
@ -1059,32 +1548,13 @@ uint my_ismbchar(CHARSET_INFO *cs, const char *str, const char *end)
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
Return length of the leftmost character in a string.
|
||||
@param cs - character set
|
||||
@param str - the beginning of the string
|
||||
@param end - the string end (the next byte after the string)
|
||||
@return <=0 on errors (EOL, wrong byte sequence)
|
||||
@return 1 on a single byte character
|
||||
@return >1 on a multi-byte character
|
||||
|
||||
Note, inlike my_ismbchar(), 1 is returned for a single byte character.
|
||||
*/
|
||||
static inline
|
||||
int my_charlen(CHARSET_INFO *cs, const char *str, const char *end)
|
||||
{
|
||||
return (cs->cset->charlen)(cs, (const uchar *) str,
|
||||
(const uchar *) end);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Convert broken and incomplete byte sequences to 1 byte.
|
||||
*/
|
||||
static inline
|
||||
uint my_charlen_fix(CHARSET_INFO *cs, const char *str, const char *end)
|
||||
uint my_ci_charlen_fix(CHARSET_INFO *cs, const uchar *str, const uchar *end)
|
||||
{
|
||||
int char_length= my_charlen(cs, str, end);
|
||||
int char_length= my_ci_charlen(cs, str, end);
|
||||
DBUG_ASSERT(str < end);
|
||||
return char_length > 0 ? (uint) char_length : (uint) 1U;
|
||||
}
|
||||
|
@ -1100,7 +1570,7 @@ my_well_formed_length(CHARSET_INFO *cs, const char *b, const char *e,
|
|||
size_t nchars, int *error)
|
||||
{
|
||||
MY_STRCOPY_STATUS status;
|
||||
(void) cs->cset->well_formed_char_length(cs, b, e, nchars, &status);
|
||||
(void) my_ci_well_formed_char_length(cs, b, e, nchars, &status);
|
||||
*error= status.m_well_formed_error_pos == NULL ? 0 : 1;
|
||||
return (size_t) (status.m_source_end_pos - b);
|
||||
}
|
||||
|
@ -1108,12 +1578,6 @@ my_well_formed_length(CHARSET_INFO *cs, const char *b, const char *e,
|
|||
|
||||
#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)))
|
||||
#define my_strntoul(s, a, b, c, d, e) ((s)->cset->strntoul((s),(a),(b),(c),(d),(e)))
|
||||
#define my_strntoll(s, a, b, c, d, e) ((s)->cset->strntoll((s),(a),(b),(c),(d),(e)))
|
||||
#define my_strntoull(s, a, b, c,d, e) ((s)->cset->strntoull((s),(a),(b),(c),(d),(e)))
|
||||
#define my_strntod(s, a, b, c, d) ((s)->cset->strntod((s),(a),(b),(c),(d)))
|
||||
|
||||
|
||||
/* XXX: still need to take care of this one */
|
||||
#ifdef MY_CHARSET_TIS620
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/* Copyright (c) 2000, 2014, Oracle and/or its affiliates
|
||||
Copyright (c) 2009, 2017, MariaDB Corporation
|
||||
Copyright (c) 2009, 2020, MariaDB Corporation
|
||||
|
||||
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
|
||||
|
@ -1206,7 +1206,7 @@ myodbc_remove_escape(MYSQL *mysql,char *name)
|
|||
{
|
||||
char *to;
|
||||
#ifdef USE_MB
|
||||
my_bool use_mb_flag=use_mb(mysql->charset);
|
||||
my_bool use_mb_flag= my_ci_use_mb(mysql->charset);
|
||||
char *UNINIT_VAR(end);
|
||||
if (use_mb_flag)
|
||||
for (end=name; *end ; end++) ;
|
||||
|
@ -3198,7 +3198,7 @@ static void fetch_string_with_conversion(MYSQL_BIND *param, char *value, size_t
|
|||
}
|
||||
case MYSQL_TYPE_FLOAT:
|
||||
{
|
||||
double data= my_strntod(&my_charset_latin1, value, length, &endptr, &err);
|
||||
double data= my_ci_strntod(&my_charset_latin1, value, length, &endptr, &err);
|
||||
float fdata= (float) data;
|
||||
*param->error= (fdata != data) | MY_TEST(err);
|
||||
floatstore(buffer, fdata);
|
||||
|
@ -3206,7 +3206,7 @@ static void fetch_string_with_conversion(MYSQL_BIND *param, char *value, size_t
|
|||
}
|
||||
case MYSQL_TYPE_DOUBLE:
|
||||
{
|
||||
double data= my_strntod(&my_charset_latin1, value, length, &endptr, &err);
|
||||
double data= my_ci_strntod(&my_charset_latin1, value, length, &endptr, &err);
|
||||
*param->error= MY_TEST(err);
|
||||
doublestore(buffer, data);
|
||||
break;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
--echo #
|
||||
--echo # Test that cs->coll->hash_sort() ignores trailing spaces
|
||||
--echo # Test that hash_sort() ignores trailing spaces
|
||||
--echo #
|
||||
SELECT @@collation_connection;
|
||||
CREATE TABLE t1 ENGINE=HEAP AS SELECT REPEAT (' ', 10) AS a LIMIT 0;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
--echo #
|
||||
--echo # Testing cs->cset->strtoll10()
|
||||
--echo # Testing strtoll10()
|
||||
--echo #
|
||||
|
||||
SELECT @@character_set_connection;
|
||||
|
|
|
@ -483,7 +483,7 @@ set names utf8;
|
|||
--echo # Start of 5.5 tests
|
||||
--echo #
|
||||
#
|
||||
# Test my_like_range and contractions
|
||||
# Test like_range and contractions
|
||||
#
|
||||
SET collation_connection=utf8_czech_ci;
|
||||
--source include/ctype_czech.inc
|
||||
|
|
|
@ -1086,7 +1086,7 @@ select left('aaa','1');
|
|||
left('aaa','1')
|
||||
a
|
||||
#
|
||||
# Testing cs->cset->strtoll10()
|
||||
# Testing strtoll10()
|
||||
#
|
||||
SELECT @@character_set_connection;
|
||||
@@character_set_connection
|
||||
|
|
|
@ -511,12 +511,12 @@ drop table t1;
|
|||
set names latin1;
|
||||
set collation_connection=utf16_general_ci;
|
||||
#
|
||||
# Testing cs->coll->instr()
|
||||
# Testing instr()
|
||||
#
|
||||
select position('bb' in 'abba');
|
||||
|
||||
#
|
||||
# Testing cs->coll->hash_sort()
|
||||
# Testing hash_sort()
|
||||
#
|
||||
create table t1 (a varchar(10) character set utf16) engine=heap;
|
||||
insert into t1 values ('a'),('A'),('b'),('B');
|
||||
|
@ -525,21 +525,21 @@ select hex(min(binary a)),count(*) from t1 group by a;
|
|||
drop table t1;
|
||||
|
||||
#
|
||||
# Testing cs->cset->numchars()
|
||||
# Testing numchars()
|
||||
#
|
||||
select char_length('abcd'), octet_length('abcd');
|
||||
select char_length(_utf16 0xD800DC00), octet_length(_utf16 0xD800DC00);
|
||||
select char_length(_utf16 0xD87FDFFF), octet_length(_utf16 0xD87FDFFF);
|
||||
|
||||
#
|
||||
# Testing cs->cset->charpos()
|
||||
# Testing charpos()
|
||||
#
|
||||
select left('abcd',2);
|
||||
select hex(left(_utf16 0xD800DC00D87FDFFF, 1));
|
||||
select hex(right(_utf16 0xD800DC00D87FDFFF, 1));
|
||||
|
||||
#
|
||||
# Testing cs->cset->well_formed_length()
|
||||
# Testing well_formed_length()
|
||||
#
|
||||
create table t1 (a varchar(10) character set utf16);
|
||||
# Bad sequences
|
||||
|
@ -564,7 +564,7 @@ drop table t1;
|
|||
#
|
||||
# Bug#32393 Character sets: illegal characters in utf16 columns
|
||||
#
|
||||
# Tests that cs->cset->wc_mb() doesn't accept surrogate parts
|
||||
# Tests that my_ci_wc_mb() doesn't accept surrogate parts
|
||||
#
|
||||
# via alter
|
||||
#
|
||||
|
@ -586,7 +586,7 @@ drop table t1;
|
|||
|
||||
|
||||
#
|
||||
# Testing cs->cset->lengthsp()
|
||||
# Testing lengthsp()
|
||||
#
|
||||
create table t1 (a char(10)) character set utf16;
|
||||
insert into t1 values ('a ');
|
||||
|
@ -594,13 +594,13 @@ select hex(a) from t1;
|
|||
drop table t1;
|
||||
|
||||
#
|
||||
# Testing cs->cset->caseup() and cs->cset->casedn()
|
||||
# Testing caseup() and casedn()
|
||||
#
|
||||
select upper('abcd'), lower('ABCD');
|
||||
|
||||
#
|
||||
# TODO: str_to_datetime() is broken and doesn't work with ucs2 and utf16
|
||||
# Testing cs->cset->snprintf()
|
||||
# Testing snprintf()
|
||||
#
|
||||
#create table t1 (a date);
|
||||
#insert into t1 values ('2007-09-16');
|
||||
|
@ -608,11 +608,11 @@ select upper('abcd'), lower('ABCD');
|
|||
#drop table t1;
|
||||
|
||||
#
|
||||
# Testing cs->cset->l10tostr
|
||||
# Testing l10tostr
|
||||
# !!! Not used in the code
|
||||
|
||||
#
|
||||
# Testing cs->cset->ll10tostr
|
||||
# Testing ll10tostr
|
||||
#
|
||||
create table t1 (a varchar(10) character set utf16);
|
||||
insert into t1 values (123456);
|
||||
|
@ -620,16 +620,16 @@ select a, hex(a) from t1;
|
|||
drop table t1;
|
||||
|
||||
|
||||
# Testing cs->cset->fill
|
||||
# Testing fill
|
||||
# SOUNDEX fills strings with DIGIT ZERO up to four characters
|
||||
select hex(soundex('a'));
|
||||
|
||||
#
|
||||
# Testing cs->cset->strntol
|
||||
# Testing strntol
|
||||
# !!! Not used in the code
|
||||
|
||||
#
|
||||
# Testing cs->cset->strntoul
|
||||
# Testing strntoul
|
||||
#
|
||||
create table t1 (a enum ('a','b','c')) character set utf16;
|
||||
insert into t1 values ('1');
|
||||
|
@ -637,14 +637,14 @@ select * from t1;
|
|||
drop table t1;
|
||||
|
||||
#
|
||||
# Testing cs->cset->strntoll and cs->cset->strntoull
|
||||
# Testing strntoll and strntoull
|
||||
#
|
||||
set names latin1;
|
||||
select hex(conv(convert('123' using utf16), -10, 16));
|
||||
select hex(conv(convert('123' using utf16), 10, 16));
|
||||
|
||||
#
|
||||
# Testing cs->cset->strntod
|
||||
# Testing strntod
|
||||
#
|
||||
set names latin1;
|
||||
set character_set_connection=utf16;
|
||||
|
@ -652,12 +652,12 @@ select 1.1 + '1.2';
|
|||
select 1.1 + '1.2xxx';
|
||||
|
||||
# Testing strntoll10_utf16
|
||||
# Testing cs->cset->strtoll10
|
||||
# Testing strtoll10
|
||||
select left('aaa','1');
|
||||
--source include/ctype_strtoll10.inc
|
||||
|
||||
#
|
||||
# Testing cs->cset->strntoull10rnd
|
||||
# Testing strntoull10rnd
|
||||
#
|
||||
create table t1 (a int);
|
||||
insert into t1 values ('-1234.1e2');
|
||||
|
@ -667,7 +667,7 @@ select * from t1;
|
|||
drop table t1;
|
||||
|
||||
#
|
||||
# Testing cs->cset->scan
|
||||
# Testing scan
|
||||
#
|
||||
create table t1 (a int);
|
||||
insert into t1 values ('1 ');
|
||||
|
|
|
@ -143,7 +143,7 @@ set collation_connection=utf16_unicode_ci;
|
|||
--source include/ctype_regex.inc
|
||||
|
||||
#
|
||||
# Test my_like_range and contractions
|
||||
# Test like_range and contractions
|
||||
#
|
||||
SET collation_connection=utf16_czech_ci;
|
||||
--source include/ctype_czech.inc
|
||||
|
|
|
@ -1027,17 +1027,17 @@ text 65535 32767
|
|||
DROP TABLE t1;
|
||||
SET NAMES utf8, collation_connection=utf16le_general_ci;
|
||||
#
|
||||
# Testing cs->coll->instr()
|
||||
# Testing instr()
|
||||
#
|
||||
SELECT POSITION('bb' IN 'abba');
|
||||
POSITION('bb' IN 'abba')
|
||||
2
|
||||
#
|
||||
# Testing cs->coll->hash_sort()
|
||||
# Testing hash_sort()
|
||||
#
|
||||
SET NAMES utf8, collation_connection=utf16le_bin;
|
||||
#
|
||||
# Test that cs->coll->hash_sort() ignores trailing spaces
|
||||
# Test that hash_sort() ignores trailing spaces
|
||||
#
|
||||
SELECT @@collation_connection;
|
||||
@@collation_connection
|
||||
|
@ -1056,7 +1056,7 @@ a 61002000
|
|||
DROP TABLE t1;
|
||||
SET NAMES utf8, collation_connection=utf16le_general_ci;
|
||||
#
|
||||
# Test that cs->coll->hash_sort() ignores trailing spaces
|
||||
# Test that hash_sort() ignores trailing spaces
|
||||
#
|
||||
SELECT @@collation_connection;
|
||||
@@collation_connection
|
||||
|
@ -1074,7 +1074,7 @@ a HEX(a)
|
|||
a 61002000
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# Testing cs->cset->numchars()
|
||||
# Testing numchars()
|
||||
#
|
||||
SELECT CHAR_LENGTH('abcd'), OCTET_LENGTH('abcd');
|
||||
CHAR_LENGTH('abcd') OCTET_LENGTH('abcd')
|
||||
|
@ -1086,7 +1086,7 @@ SELECT CHAR_LENGTH(_utf16le 0x7DD8FFDF), OCTET_LENGTH(_utf16le 0x7FD8DDDF);
|
|||
CHAR_LENGTH(_utf16le 0x7DD8FFDF) OCTET_LENGTH(_utf16le 0x7FD8DDDF)
|
||||
1 4
|
||||
#
|
||||
# Testing cs->cset->charpos()
|
||||
# Testing charpos()
|
||||
#
|
||||
SELECT LEFT('abcd',2);
|
||||
LEFT('abcd',2)
|
||||
|
@ -1098,7 +1098,7 @@ SELECT HEX(RIGHT(_utf16le 0x00D800DC7FD8FFDF, 1));
|
|||
HEX(RIGHT(_utf16le 0x00D800DC7FD8FFDF, 1))
|
||||
7FD8FFDF
|
||||
#
|
||||
# Testing cs->cset->well_formed_length()
|
||||
# Testing well_formed_length()
|
||||
#
|
||||
CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET utf16le);
|
||||
# Bad sequences
|
||||
|
@ -1127,7 +1127,7 @@ DROP TABLE t1;
|
|||
#
|
||||
# Bug#32393 Character sets: illegal characters in utf16le columns
|
||||
#
|
||||
# Tests that cs->cset->wc_mb() doesn't accept surrogate parts
|
||||
# Tests that my_ci_wc_mb() doesn't accept surrogate parts
|
||||
#
|
||||
# via ALTER
|
||||
#
|
||||
|
@ -1154,7 +1154,7 @@ HEX(s2)
|
|||
3F00
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# Testing cs->cset->lengthsp()
|
||||
# Testing lengthsp()
|
||||
#
|
||||
CREATE TABLE t1 (a CHAR(10)) CHARACTER SET utf16le;
|
||||
INSERT INTO t1 VALUES ('a ');
|
||||
|
@ -1163,7 +1163,7 @@ HEX(a)
|
|||
6100
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# Testing cs->cset->caseup() and cs->cset->casedn()
|
||||
# Testing caseup() and casedn()
|
||||
#
|
||||
SELECT UPPER('abcd'), LOWER('ABCD');
|
||||
UPPER('abcd') LOWER('ABCD')
|
||||
|
@ -1181,7 +1181,7 @@ a
|
|||
2007-09-16
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# Testing cs->cset->ll10tostr
|
||||
# Testing ll10tostr
|
||||
#
|
||||
CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET utf16le);
|
||||
INSERT INTO t1 VALUES (123456);
|
||||
|
@ -1190,14 +1190,14 @@ a HEX(a)
|
|||
123456 310032003300340035003600
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# Testing cs->cset->fill
|
||||
# Testing fill
|
||||
# SOUNDEX fills strings with DIGIT ZERO up to four characters
|
||||
#
|
||||
SELECT SOUNDEX('a'), HEX(SOUNDEX('a'));
|
||||
SOUNDEX('a') HEX(SOUNDEX('a'))
|
||||
A000 4100300030003000
|
||||
#
|
||||
# Testing cs->cset->strntoul
|
||||
# Testing strntoul
|
||||
#
|
||||
CREATE TABLE t1 (a enum ('a','b','c')) CHARACTER SET utf16le;
|
||||
INSERT INTO t1 VALUES ('1');
|
||||
|
@ -1206,7 +1206,7 @@ a
|
|||
a
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# Testing cs->cset->strntoll and cs->cset->strntoull
|
||||
# Testing strntoll and strntoull
|
||||
#
|
||||
SET NAMES latin1;
|
||||
SELECT HEX(CONV(CONVERT('123' USING utf16le), -10, 16));
|
||||
|
@ -1217,7 +1217,7 @@ HEX(CONV(CONVERT('123' USING utf16le), 10, 16))
|
|||
3742
|
||||
SET NAMES utf8, collation_connection=utf16le_general_ci;
|
||||
#
|
||||
# Testing cs->cset->strntod
|
||||
# Testing strntod
|
||||
#
|
||||
SET NAMES utf8, collation_connection=utf16le_general_ci;
|
||||
SELECT 1.1 + '1.2';
|
||||
|
@ -1229,7 +1229,7 @@ SELECT 1.1 + '1.2xxx';
|
|||
Warnings:
|
||||
Warning 1292 Truncated incorrect DOUBLE value: '1.2xxx'
|
||||
#
|
||||
# Testing cs->cset->strtoll10
|
||||
# Testing strtoll10
|
||||
#
|
||||
SELECT LEFT('aaa','1');
|
||||
LEFT('aaa','1')
|
||||
|
@ -1303,7 +1303,7 @@ Warning 1292 Truncated incorrect INTEGER value: '-18446744073709551614'
|
|||
Warning 1292 Truncated incorrect INTEGER value: '-18446744073709551615'
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# Testing cs->cset->strtoll10()
|
||||
# Testing strtoll10()
|
||||
#
|
||||
SELECT @@character_set_connection;
|
||||
@@character_set_connection
|
||||
|
@ -1479,7 +1479,7 @@ CAST('123456789123456789123x' AS UNSIGNED)
|
|||
Warnings:
|
||||
Warning 1292 Truncated incorrect INTEGER value: '123456789123456789123x'
|
||||
#
|
||||
# Testing cs->cset->strntoull10rnd
|
||||
# Testing strntoull10rnd
|
||||
#
|
||||
CREATE TABLE t1 (a int);
|
||||
INSERT INTO t1 VALUES ('-1234.1e2');
|
||||
|
@ -1531,7 +1531,7 @@ a
|
|||
18446744073709551615
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# Testing cs->cset->scan
|
||||
# Testing scan
|
||||
#
|
||||
CREATE TABLE t1 (a int);
|
||||
INSERT INTO t1 VALUES ('1 ');
|
||||
|
|
|
@ -434,12 +434,12 @@ DROP TABLE t1;
|
|||
SET NAMES utf8, collation_connection=utf16le_general_ci;
|
||||
|
||||
--echo #
|
||||
--echo # Testing cs->coll->instr()
|
||||
--echo # Testing instr()
|
||||
--echo #
|
||||
SELECT POSITION('bb' IN 'abba');
|
||||
|
||||
--echo #
|
||||
--echo # Testing cs->coll->hash_sort()
|
||||
--echo # Testing hash_sort()
|
||||
--echo #
|
||||
SET NAMES utf8, collation_connection=utf16le_bin;
|
||||
--source include/ctype_heap.inc
|
||||
|
@ -447,21 +447,21 @@ SET NAMES utf8, collation_connection=utf16le_general_ci;
|
|||
--source include/ctype_heap.inc
|
||||
|
||||
--echo #
|
||||
--echo # Testing cs->cset->numchars()
|
||||
--echo # Testing numchars()
|
||||
--echo #
|
||||
SELECT CHAR_LENGTH('abcd'), OCTET_LENGTH('abcd');
|
||||
SELECT CHAR_LENGTH(_utf16le 0x00D800DC), OCTET_LENGTH(_utf16le 0x00D800DC);
|
||||
SELECT CHAR_LENGTH(_utf16le 0x7DD8FFDF), OCTET_LENGTH(_utf16le 0x7FD8DDDF);
|
||||
|
||||
--echo #
|
||||
--echo # Testing cs->cset->charpos()
|
||||
--echo # Testing charpos()
|
||||
--echo #
|
||||
SELECT LEFT('abcd',2);
|
||||
SELECT HEX(LEFT(_utf16le 0x00D800DC7FD8FFDF, 1));
|
||||
SELECT HEX(RIGHT(_utf16le 0x00D800DC7FD8FFDF, 1));
|
||||
|
||||
--echo #
|
||||
--echo # Testing cs->cset->well_formed_length()
|
||||
--echo # Testing well_formed_length()
|
||||
--echo #
|
||||
CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET utf16le);
|
||||
--echo # Bad sequences
|
||||
|
@ -486,7 +486,7 @@ DROP TABLE t1;
|
|||
--echo #
|
||||
--echo # Bug#32393 Character sets: illegal characters in utf16le columns
|
||||
--echo #
|
||||
--echo # Tests that cs->cset->wc_mb() doesn't accept surrogate parts
|
||||
--echo # Tests that my_ci_wc_mb() doesn't accept surrogate parts
|
||||
--echo #
|
||||
--echo # via ALTER
|
||||
--echo #
|
||||
|
@ -508,7 +508,7 @@ DROP TABLE t1;
|
|||
|
||||
|
||||
--echo #
|
||||
--echo # Testing cs->cset->lengthsp()
|
||||
--echo # Testing lengthsp()
|
||||
--echo #
|
||||
CREATE TABLE t1 (a CHAR(10)) CHARACTER SET utf16le;
|
||||
INSERT INTO t1 VALUES ('a ');
|
||||
|
@ -517,7 +517,7 @@ DROP TABLE t1;
|
|||
|
||||
|
||||
--echo #
|
||||
--echo # Testing cs->cset->caseup() and cs->cset->casedn()
|
||||
--echo # Testing caseup() and casedn()
|
||||
--echo #
|
||||
SELECT UPPER('abcd'), LOWER('ABCD');
|
||||
|
||||
|
@ -532,7 +532,7 @@ DROP TABLE t1;
|
|||
|
||||
|
||||
--echo #
|
||||
--echo # Testing cs->cset->ll10tostr
|
||||
--echo # Testing ll10tostr
|
||||
--echo #
|
||||
CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET utf16le);
|
||||
INSERT INTO t1 VALUES (123456);
|
||||
|
@ -540,14 +540,14 @@ SELECT a, HEX(a) FROM t1;
|
|||
DROP TABLE t1;
|
||||
|
||||
--echo #
|
||||
--echo # Testing cs->cset->fill
|
||||
--echo # Testing fill
|
||||
--echo # SOUNDEX fills strings with DIGIT ZERO up to four characters
|
||||
--echo #
|
||||
SELECT SOUNDEX('a'), HEX(SOUNDEX('a'));
|
||||
|
||||
|
||||
--echo #
|
||||
--echo # Testing cs->cset->strntoul
|
||||
--echo # Testing strntoul
|
||||
--echo #
|
||||
CREATE TABLE t1 (a enum ('a','b','c')) CHARACTER SET utf16le;
|
||||
INSERT INTO t1 VALUES ('1');
|
||||
|
@ -556,7 +556,7 @@ DROP TABLE t1;
|
|||
|
||||
|
||||
--echo #
|
||||
--echo # Testing cs->cset->strntoll and cs->cset->strntoull
|
||||
--echo # Testing strntoll and strntoull
|
||||
--echo #
|
||||
SET NAMES latin1;
|
||||
SELECT HEX(CONV(CONVERT('123' USING utf16le), -10, 16));
|
||||
|
@ -565,7 +565,7 @@ SET NAMES utf8, collation_connection=utf16le_general_ci;
|
|||
|
||||
|
||||
--echo #
|
||||
--echo # Testing cs->cset->strntod
|
||||
--echo # Testing strntod
|
||||
--echo #
|
||||
SET NAMES utf8, collation_connection=utf16le_general_ci;
|
||||
SELECT 1.1 + '1.2';
|
||||
|
@ -573,7 +573,7 @@ SELECT 1.1 + '1.2xxx';
|
|||
|
||||
|
||||
--echo #
|
||||
--echo # Testing cs->cset->strtoll10
|
||||
--echo # Testing strtoll10
|
||||
--echo #
|
||||
SELECT LEFT('aaa','1');
|
||||
CREATE TABLE t1 AS SELECT REPEAT('abcd', 128) AS a;
|
||||
|
@ -600,7 +600,7 @@ DROP TABLE t1;
|
|||
--source include/ctype_strtoll10.inc
|
||||
|
||||
--echo #
|
||||
--echo # Testing cs->cset->strntoull10rnd
|
||||
--echo # Testing strntoull10rnd
|
||||
--echo #
|
||||
CREATE TABLE t1 (a int);
|
||||
INSERT INTO t1 VALUES ('-1234.1e2');
|
||||
|
@ -626,7 +626,7 @@ DROP TABLE t1;
|
|||
|
||||
|
||||
--echo #
|
||||
--echo # Testing cs->cset->scan
|
||||
--echo # Testing scan
|
||||
--echo #
|
||||
CREATE TABLE t1 (a int);
|
||||
INSERT INTO t1 VALUES ('1 ');
|
||||
|
|
|
@ -1083,7 +1083,7 @@ select left('aaa','1');
|
|||
left('aaa','1')
|
||||
a
|
||||
#
|
||||
# Testing cs->cset->strtoll10()
|
||||
# Testing strtoll10()
|
||||
#
|
||||
SELECT @@character_set_connection;
|
||||
@@character_set_connection
|
||||
|
|
|
@ -554,12 +554,12 @@ drop table t1;
|
|||
set names latin1;
|
||||
set collation_connection=utf32_general_ci;
|
||||
#
|
||||
# Testing cs->coll->instr()
|
||||
# Testing instr()
|
||||
#
|
||||
select position('bb' in 'abba');
|
||||
|
||||
#
|
||||
# Testing cs->coll->hash_sort()
|
||||
# Testing hash_sort()
|
||||
#
|
||||
create table t1 (a varchar(10) character set utf32) engine=heap;
|
||||
insert into t1 values ('a'),('A'),('b'),('B');
|
||||
|
@ -568,17 +568,17 @@ select hex(min(binary a)),count(*) from t1 group by a;
|
|||
drop table t1;
|
||||
|
||||
#
|
||||
# Testing cs->cset->numchars()
|
||||
# Testing numchars()
|
||||
#
|
||||
select char_length('abcd'), octet_length('abcd');
|
||||
|
||||
#
|
||||
# Testing cs->cset->charpos()
|
||||
# Testing charpos()
|
||||
#
|
||||
select left('abcd',2);
|
||||
|
||||
#
|
||||
# Testing cs->cset->well_formed_length()
|
||||
# Testing well_formed_length()
|
||||
#
|
||||
create table t1 (a varchar(10) character set utf32);
|
||||
insert into t1 values (_utf32 0x0010FFFF);
|
||||
|
@ -625,7 +625,7 @@ select hex(s1) from t1 where s1 = 0xfffd;
|
|||
drop table t1;
|
||||
|
||||
#
|
||||
# Testing cs->cset->lengthsp()
|
||||
# Testing lengthsp()
|
||||
#
|
||||
create table t1 (a char(10)) character set utf32;
|
||||
insert into t1 values ('a ');
|
||||
|
@ -633,13 +633,13 @@ select hex(a) from t1;
|
|||
drop table t1;
|
||||
|
||||
#
|
||||
# Testing cs->cset->caseup() and cs->cset->casedn()
|
||||
# Testing caseup() and casedn()
|
||||
#
|
||||
select upper('abcd'), lower('ABCD');
|
||||
|
||||
#
|
||||
# TODO: str_to_datetime() is broken and doesn't work with ucs2 and utf32
|
||||
# Testing cs->cset->snprintf()
|
||||
# Testing snprintf()
|
||||
#
|
||||
#create table t1 (a date);
|
||||
#insert into t1 values ('2007-09-16');
|
||||
|
@ -647,11 +647,11 @@ select upper('abcd'), lower('ABCD');
|
|||
#drop table t1;
|
||||
|
||||
#
|
||||
# Testing cs->cset->l10tostr
|
||||
# Testing l10tostr
|
||||
# !!! Not used in the code
|
||||
|
||||
#
|
||||
# Testing cs->cset->ll10tostr
|
||||
# Testing ll10tostr
|
||||
#
|
||||
create table t1 (a varchar(10) character set utf32);
|
||||
insert into t1 values (123456);
|
||||
|
@ -659,16 +659,16 @@ select a, hex(a) from t1;
|
|||
drop table t1;
|
||||
|
||||
#
|
||||
# Testing cs->cset->fill
|
||||
# Testing fill
|
||||
# SOUNDEX fills strings with DIGIT ZERO up to four characters
|
||||
select hex(soundex('a'));
|
||||
|
||||
#
|
||||
# Testing cs->cset->strntol
|
||||
# Testing strntol
|
||||
# !!! Not used in the code
|
||||
|
||||
#
|
||||
# Testing cs->cset->strntoul
|
||||
# Testing strntoul
|
||||
#
|
||||
create table t1 (a enum ('a','b','c')) character set utf32;
|
||||
insert into t1 values ('1');
|
||||
|
@ -676,14 +676,14 @@ select * from t1;
|
|||
drop table t1;
|
||||
|
||||
#
|
||||
# Testing cs->cset->strntoll and cs->cset->strntoull
|
||||
# Testing strntoll and strntoull
|
||||
#
|
||||
set names latin1;
|
||||
select hex(conv(convert('123' using utf32), -10, 16));
|
||||
select hex(conv(convert('123' using utf32), 10, 16));
|
||||
|
||||
#
|
||||
# Testing cs->cset->strntod
|
||||
# Testing strntod
|
||||
#
|
||||
set names latin1;
|
||||
set character_set_connection=utf32;
|
||||
|
@ -691,12 +691,12 @@ select 1.1 + '1.2';
|
|||
select 1.1 + '1.2xxx';
|
||||
|
||||
# Testing strntoll10_utf32
|
||||
# Testing cs->cset->strtoll10
|
||||
# Testing strtoll10
|
||||
select left('aaa','1');
|
||||
--source include/ctype_strtoll10.inc
|
||||
|
||||
#
|
||||
# Testing cs->cset->strntoull10rnd
|
||||
# Testing strntoull10rnd
|
||||
#
|
||||
create table t1 (a int);
|
||||
insert into t1 values ('-1234.1e2');
|
||||
|
@ -706,7 +706,7 @@ select * from t1;
|
|||
drop table t1;
|
||||
|
||||
#
|
||||
# Testing cs->cset->scan
|
||||
# Testing scan
|
||||
#
|
||||
create table t1 (a int);
|
||||
insert into t1 values ('1 ');
|
||||
|
|
|
@ -144,7 +144,7 @@ set collation_connection=utf32_unicode_ci;
|
|||
|
||||
|
||||
#
|
||||
# Test my_like_range and contractions
|
||||
# Test like_range and contractions
|
||||
#
|
||||
SET collation_connection=utf32_czech_ci;
|
||||
--source include/ctype_czech.inc
|
||||
|
|
|
@ -45,7 +45,7 @@ DROP TABLE t1;
|
|||
--echo #
|
||||
#
|
||||
# Bug#57737 Character sets: search fails with like, contraction, index
|
||||
# Test my_like_range and contractions
|
||||
# Test like_range and contractions
|
||||
#
|
||||
SET collation_connection=utf8mb4_czech_ci;
|
||||
--source include/ctype_czech.inc
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
/*
|
||||
Copyright (c) 2000, 2011, Oracle and/or its affiliates
|
||||
Copyright (c) 2009, 2020, MariaDB Corporation.
|
||||
|
||||
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
|
||||
|
@ -61,7 +62,7 @@ get_collation_number_internal(const char *name)
|
|||
|
||||
static my_bool is_multi_byte_ident(CHARSET_INFO *cs, uchar ch)
|
||||
{
|
||||
int chlen= my_charlen(cs, (const char *) &ch, (const char *) &ch + 1);
|
||||
int chlen= my_ci_charlen(cs, &ch, &ch + 1);
|
||||
return MY_CS_IS_TOOSMALL(chlen) ? TRUE : FALSE;
|
||||
}
|
||||
|
||||
|
@ -164,9 +165,9 @@ static int cs_copy_data(struct charset_info_st *to, CHARSET_INFO *from)
|
|||
if (!(to->comment= my_once_strdup(from->comment,MYF(MY_WME))))
|
||||
goto err;
|
||||
|
||||
if (from->ctype)
|
||||
if (from->m_ctype)
|
||||
{
|
||||
if (!(to->ctype= (uchar*) my_once_memdup((char*) from->ctype,
|
||||
if (!(to->m_ctype= (uchar*) my_once_memdup((char*) from->m_ctype,
|
||||
MY_CS_CTYPE_TABLE_SIZE,
|
||||
MYF(MY_WME))))
|
||||
goto err;
|
||||
|
@ -212,7 +213,7 @@ err:
|
|||
|
||||
static my_bool simple_8bit_charset_data_is_full(CHARSET_INFO *cs)
|
||||
{
|
||||
return cs->ctype && cs->to_upper && cs->to_lower && cs->tab_to_uni;
|
||||
return cs->m_ctype && cs->to_upper && cs->to_lower && cs->tab_to_uni;
|
||||
}
|
||||
|
||||
|
||||
|
@ -228,8 +229,8 @@ inherit_charset_data(struct charset_info_st *cs, CHARSET_INFO *refcs)
|
|||
cs->to_upper= refcs->to_upper;
|
||||
if (!cs->to_lower)
|
||||
cs->to_lower= refcs->to_lower;
|
||||
if (!cs->ctype)
|
||||
cs->ctype= refcs->ctype;
|
||||
if (!cs->m_ctype)
|
||||
cs->m_ctype= refcs->m_ctype;
|
||||
if (!cs->tab_to_uni)
|
||||
cs->tab_to_uni= refcs->tab_to_uni;
|
||||
}
|
||||
|
@ -355,7 +356,7 @@ static int add_collation(struct charset_info_st *cs)
|
|||
&my_charset_utf8mb3_unicode_nopad_ci :
|
||||
&my_charset_utf8mb3_unicode_ci,
|
||||
cs);
|
||||
newcs->ctype= my_charset_utf8mb3_unicode_ci.ctype;
|
||||
newcs->m_ctype= my_charset_utf8mb3_unicode_ci.m_ctype;
|
||||
if (init_state_maps(newcs))
|
||||
return MY_XML_ERROR;
|
||||
#endif
|
||||
|
@ -367,7 +368,7 @@ static int add_collation(struct charset_info_st *cs)
|
|||
&my_charset_utf8mb4_unicode_nopad_ci :
|
||||
&my_charset_utf8mb4_unicode_ci,
|
||||
cs);
|
||||
newcs->ctype= my_charset_utf8mb4_unicode_ci.ctype;
|
||||
newcs->m_ctype= my_charset_utf8mb4_unicode_ci.m_ctype;
|
||||
newcs->state|= MY_CS_AVAILABLE | MY_CS_LOADED;
|
||||
#endif
|
||||
}
|
||||
|
@ -630,7 +631,7 @@ static void init_available_charsets(void)
|
|||
if (*cs)
|
||||
{
|
||||
DBUG_ASSERT(cs[0]->mbmaxlen <= MY_CS_MBMAXLEN);
|
||||
if (cs[0]->ctype)
|
||||
if (cs[0]->m_ctype)
|
||||
if (init_state_maps(*cs))
|
||||
*cs= NULL;
|
||||
}
|
||||
|
@ -807,8 +808,8 @@ get_internal_charset(MY_CHARSET_LOADER *loader, uint cs_number, myf flags)
|
|||
inherit_collation_data(cs, refcl);
|
||||
}
|
||||
|
||||
if ((cs->cset->init && cs->cset->init(cs, loader)) ||
|
||||
(cs->coll->init && cs->coll->init(cs, loader)))
|
||||
if (my_ci_init_charset(cs, loader) ||
|
||||
my_ci_init_collation(cs, loader))
|
||||
{
|
||||
cs= NULL;
|
||||
}
|
||||
|
@ -1036,8 +1037,7 @@ size_t escape_string_for_mysql(CHARSET_INFO *charset_info,
|
|||
{
|
||||
char escape= 0;
|
||||
#ifdef USE_MB
|
||||
int tmp_length= use_mb(charset_info) ? my_charlen(charset_info, from, end) :
|
||||
1;
|
||||
int tmp_length= my_ci_charlen(charset_info, (const uchar *) from, (const uchar *) end);
|
||||
if (tmp_length > 1)
|
||||
{
|
||||
if (to + tmp_length > to_end)
|
||||
|
@ -1174,7 +1174,7 @@ size_t escape_quotes_for_mysql(CHARSET_INFO *charset_info,
|
|||
const char *end, *to_end=to_start + (to_length ? to_length-1 : 2*length);
|
||||
my_bool overflow= FALSE;
|
||||
#ifdef USE_MB
|
||||
my_bool use_mb_flag= use_mb(charset_info);
|
||||
my_bool use_mb_flag= my_ci_use_mb(charset_info);
|
||||
#endif
|
||||
for (end= from + length; from < end; from++)
|
||||
{
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/* Copyright (c) 2000, 2010, Oracle and/or its affiliates.
|
||||
Copyright (c) 2011, 2013, Monty Program Ab.
|
||||
Copyright (c) 2011, 2020, MariaDB Corporation.
|
||||
|
||||
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
|
||||
|
@ -45,7 +45,7 @@ my_hash_value_type my_hash_sort(CHARSET_INFO *cs, const uchar *key,
|
|||
size_t length)
|
||||
{
|
||||
ulong nr1= 1, nr2= 4;
|
||||
cs->coll->hash_sort(cs, (uchar*) key, length, &nr1, &nr2);
|
||||
my_ci_hash_sort(cs, (uchar*) key, length, &nr1, &nr2);
|
||||
return (my_hash_value_type) nr1;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/* Copyright (c) 2006, 2018, Oracle and/or its affiliates.
|
||||
Copyright (c) 2009, 2018, MariaDB
|
||||
Copyright (c) 2009, 2020, MariaDB
|
||||
|
||||
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
|
||||
|
@ -313,7 +313,7 @@ static inline my_hash_value_type calc_hash(CHARSET_INFO *cs,
|
|||
size_t keylen)
|
||||
{
|
||||
ulong nr1= 1, nr2= 4;
|
||||
cs->coll->hash_sort(cs, (uchar*) key, keylen, &nr1, &nr2);
|
||||
my_ci_hash_sort(cs, (uchar*) key, keylen, &nr1, &nr2);
|
||||
return nr1;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
/* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
Copyright (c) 2009, 2020, MariaDB Corporation.
|
||||
|
||||
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
|
||||
|
@ -34,7 +35,7 @@ size_t dirname_length(const char *name)
|
|||
{
|
||||
#ifdef BASKSLASH_MBTAIL
|
||||
uint l;
|
||||
if (use_mb(fs) && (l= my_ismbchar(fs, pos, pos + 3)))
|
||||
if (my_ci_use_mb(fs) && (l= my_ismbchar(fs, pos, pos + 3)))
|
||||
{
|
||||
pos+= l - 1;
|
||||
continue;
|
||||
|
@ -123,7 +124,7 @@ char *convert_dirname(char *to, const char *from, const char *from_end)
|
|||
{
|
||||
#ifdef BACKSLASH_MBTAIL
|
||||
uint l;
|
||||
if (use_mb(fs) && (l= my_ismbchar(fs, from, from + 3)))
|
||||
if (my_ci_use_mb(fs) && (l= my_ismbchar(fs, from, from + 3)))
|
||||
{
|
||||
memmove(to, from, l);
|
||||
to+= l;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/* Copyright (c) 2000, 2013, Oracle and/or its affiliates.
|
||||
Copyright (c) 2012, 2013, Monty Program Ab.
|
||||
Copyright (c) 2012, 2020, MariaDB Corporation.
|
||||
|
||||
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
|
||||
|
@ -152,7 +152,7 @@ size_t cleanup_dirname(register char *to, const char *from)
|
|||
{
|
||||
#ifdef BACKSLASH_MBTAIL
|
||||
uint l;
|
||||
if (use_mb(fs) && (l= my_ismbchar(fs, from_ptr - 1, from_ptr + 2)))
|
||||
if (my_ci_use_mb(fs) && (l= my_ismbchar(fs, from_ptr - 1, from_ptr + 2)))
|
||||
{
|
||||
for (l-- ; l ; *++pos= *from_ptr++, l--);
|
||||
start= pos + 1; /* Don't look inside multi-byte char */
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/* Copyright (c) 2011, Oracle and/or its affiliates.
|
||||
Copyright (C) 2009-2011 Monty Program Ab
|
||||
Copyright (c) 2009, 2020, MariaDB Corporation.
|
||||
|
||||
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
|
||||
|
@ -24,9 +24,9 @@ int ha_compare_text(CHARSET_INFO *charset_info, const uchar *a, size_t a_length,
|
|||
const uchar *b, size_t b_length, my_bool part_key)
|
||||
{
|
||||
if (!part_key)
|
||||
return charset_info->coll->strnncollsp(charset_info, a, a_length,
|
||||
return my_ci_strnncollsp(charset_info, a, a_length,
|
||||
b, b_length);
|
||||
return charset_info->coll->strnncoll(charset_info, a, a_length,
|
||||
return my_ci_strnncoll(charset_info, a, a_length,
|
||||
b, b_length, part_key);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2010, 2019, MariaDB Corporation.
|
||||
/* Copyright (C) 2010, 2020, MariaDB Corporation.
|
||||
|
||||
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
|
||||
|
@ -44,9 +44,8 @@ void engine_option_value::link(engine_option_value **start,
|
|||
/* check duplicates to avoid writing them to frm*/
|
||||
for(opt= *start;
|
||||
opt && ((opt->parsed && !opt->value.str) ||
|
||||
my_strnncoll(system_charset_info,
|
||||
(uchar *)name.str, name.length,
|
||||
(uchar*)opt->name.str, opt->name.length));
|
||||
system_charset_info->strnncoll(name.str, name.length,
|
||||
opt->name.str, opt->name.length));
|
||||
opt= opt->next) /* no-op */;
|
||||
if (opt)
|
||||
{
|
||||
|
@ -187,9 +186,8 @@ static bool set_one_value(ha_create_table_option *opt,
|
|||
for (end=start;
|
||||
*end && *end != ',';
|
||||
end++) /* no-op */;
|
||||
if (!my_strnncoll(system_charset_info,
|
||||
(uchar*)start, end-start,
|
||||
(uchar*)value->str, value->length))
|
||||
if (!system_charset_info->strnncoll(start, end-start,
|
||||
value->str, value->length))
|
||||
{
|
||||
*val= num;
|
||||
DBUG_RETURN(0);
|
||||
|
@ -211,29 +209,17 @@ static bool set_one_value(ha_create_table_option *opt,
|
|||
if (!value->str)
|
||||
DBUG_RETURN(0);
|
||||
|
||||
if (!my_strnncoll(system_charset_info,
|
||||
(const uchar*)"NO", 2,
|
||||
(uchar *)value->str, value->length) ||
|
||||
!my_strnncoll(system_charset_info,
|
||||
(const uchar*)"OFF", 3,
|
||||
(uchar *)value->str, value->length) ||
|
||||
!my_strnncoll(system_charset_info,
|
||||
(const uchar*)"0", 1,
|
||||
(uchar *)value->str, value->length))
|
||||
if (!system_charset_info->strnncoll("NO", 2, value->str, value->length) ||
|
||||
!system_charset_info->strnncoll("OFF", 3, value->str, value->length) ||
|
||||
!system_charset_info->strnncoll("0", 1, value->str, value->length))
|
||||
{
|
||||
*val= FALSE;
|
||||
DBUG_RETURN(FALSE);
|
||||
}
|
||||
|
||||
if (!my_strnncoll(system_charset_info,
|
||||
(const uchar*)"YES", 3,
|
||||
(uchar *)value->str, value->length) ||
|
||||
!my_strnncoll(system_charset_info,
|
||||
(const uchar*)"ON", 2,
|
||||
(uchar *)value->str, value->length) ||
|
||||
!my_strnncoll(system_charset_info,
|
||||
(const uchar*)"1", 1,
|
||||
(uchar *)value->str, value->length))
|
||||
if (!system_charset_info->strnncoll("YES", 3, value->str, value->length) ||
|
||||
!system_charset_info->strnncoll("ON", 2, value->str, value->length) ||
|
||||
!system_charset_info->strnncoll("1", 1, value->str, value->length))
|
||||
{
|
||||
*val= TRUE;
|
||||
DBUG_RETURN(FALSE);
|
||||
|
@ -295,9 +281,8 @@ bool parse_option_list(THD* thd, handlerton *hton, void *option_struct_arg,
|
|||
for (val= *option_list; val; val= val->next)
|
||||
{
|
||||
last= val;
|
||||
if (my_strnncoll(system_charset_info,
|
||||
(uchar*)opt->name, opt->name_length,
|
||||
(uchar*)val->name.str, val->name.length))
|
||||
if (system_charset_info->strnncoll(opt->name, opt->name_length,
|
||||
val->name.str, val->name.length))
|
||||
continue;
|
||||
|
||||
/* skip duplicates (see engine_option_value constructor above) */
|
||||
|
@ -809,9 +794,8 @@ bool is_engine_option_known(engine_option_value *opt,
|
|||
|
||||
for (; rules->name; rules++)
|
||||
{
|
||||
if (!my_strnncoll(system_charset_info,
|
||||
(uchar*)rules->name, rules->name_length,
|
||||
(uchar*)opt->name.str, opt->name.length))
|
||||
if (!system_charset_info->strnncoll(rules->name, rules->name_length,
|
||||
opt->name.str, opt->name.length))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
/* Copyright (c) 2009, 2013, Oracle and/or its affiliates.
|
||||
Copyright (c) 2009, 2020, MariaDB Corporation.
|
||||
|
||||
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
|
||||
|
@ -855,8 +856,7 @@ static char *debug_sync_token(char **token_p, uint *token_length_p,
|
|||
DBUG_ASSERT(ptr);
|
||||
|
||||
/* Skip leading space */
|
||||
ptr+= system_charset_info->cset->scan(system_charset_info,
|
||||
ptr, ptrend, MY_SEQ_SPACES);
|
||||
ptr+= system_charset_info->scan(ptr, ptrend, MY_SEQ_SPACES);
|
||||
if (!*ptr)
|
||||
{
|
||||
ptr= NULL;
|
||||
|
@ -867,8 +867,7 @@ static char *debug_sync_token(char **token_p, uint *token_length_p,
|
|||
*token_p= ptr;
|
||||
|
||||
/* Find token end. */
|
||||
ptr+= system_charset_info->cset->scan(system_charset_info,
|
||||
ptr, ptrend, MY_SEQ_NONSPACES);
|
||||
ptr+= system_charset_info->scan(ptr, ptrend, MY_SEQ_NONSPACES);
|
||||
|
||||
/* Get token length. */
|
||||
*token_length_p= (uint)(ptr - *token_p);
|
||||
|
@ -878,7 +877,7 @@ static char *debug_sync_token(char **token_p, uint *token_length_p,
|
|||
{
|
||||
DBUG_ASSERT(ptr < ptrend);
|
||||
/* Get terminator character length. */
|
||||
uint mbspacelen= my_charlen_fix(system_charset_info, ptr, ptrend);
|
||||
uint mbspacelen= system_charset_info->charlen_fix(ptr, ptrend);
|
||||
|
||||
/* Terminate token. */
|
||||
*ptr= '\0';
|
||||
|
@ -887,8 +886,7 @@ static char *debug_sync_token(char **token_p, uint *token_length_p,
|
|||
ptr+= mbspacelen;
|
||||
|
||||
/* Skip trailing space */
|
||||
ptr+= system_charset_info->cset->scan(system_charset_info,
|
||||
ptr, ptrend, MY_SEQ_SPACES);
|
||||
ptr+= system_charset_info->scan(ptr, ptrend, MY_SEQ_SPACES);
|
||||
}
|
||||
|
||||
end:
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
/* Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
Copyright (c) 2009, 2020, MariaDB Corporation.
|
||||
|
||||
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
|
||||
|
@ -206,12 +207,12 @@ int extension_based_table_discovery(MY_DIR *dirp, const char *ext_meta,
|
|||
size_t len= (octothorp ? octothorp : ext) - cur->name;
|
||||
if (from != cur &&
|
||||
(strlen(from->name) <= len ||
|
||||
my_strnncoll(cs, (uchar*)from->name, len, (uchar*)cur->name, len) ||
|
||||
cs->strnncoll(from->name, len, cur->name, len) ||
|
||||
(from->name[len] != FN_EXTCHAR && from->name[len] != '#')))
|
||||
advance(from, to, cur, skip);
|
||||
|
||||
if (my_strnncoll(cs, (uchar*)ext, strlen(ext),
|
||||
(uchar*)ext_meta, ext_meta_len) == 0)
|
||||
if (cs->strnncoll(ext, strlen(ext),
|
||||
ext_meta, ext_meta_len) == 0)
|
||||
{
|
||||
*ext = 0;
|
||||
if (result->add_file(cur->name))
|
||||
|
@ -255,8 +256,8 @@ int ext_table_discovery_simple(MY_DIR *dirp,
|
|||
|
||||
if (ext)
|
||||
{
|
||||
if (my_strnncoll(cs, (uchar*)ext, strlen(ext),
|
||||
(uchar*)reg_ext, reg_ext_length) == 0)
|
||||
if (cs->strnncoll(ext, strlen(ext),
|
||||
reg_ext, reg_ext_length) == 0)
|
||||
{
|
||||
*ext = 0;
|
||||
if (result->add_file(cur->name))
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
Copyright (c) 2005, 2013, Oracle and/or its affiliates.
|
||||
Copyright (c) 2017, MariaDB Corporation.
|
||||
Copyright (c) 2017, 2020, MariaDB Corporation.
|
||||
|
||||
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
|
||||
|
@ -103,8 +103,8 @@ ulong Events::inited;
|
|||
int sortcmp_lex_string(const LEX_CSTRING *s, const LEX_CSTRING *t,
|
||||
const CHARSET_INFO *cs)
|
||||
{
|
||||
return cs->coll->strnncollsp(cs, (uchar *) s->str, s->length,
|
||||
(uchar *) t->str, t->length);
|
||||
return cs->strnncollsp(s->str, s->length,
|
||||
t->str, t->length);
|
||||
}
|
||||
|
||||
|
||||
|
|
140
sql/field.cc
140
sql/field.cc
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
Copyright (c) 2000, 2017, Oracle and/or its affiliates.
|
||||
Copyright (c) 2008, 2019, MariaDB
|
||||
Copyright (c) 2008, 2020, MariaDB
|
||||
|
||||
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
|
||||
|
@ -984,7 +984,7 @@ static bool
|
|||
test_if_important_data(CHARSET_INFO *cs, const char *str, const char *strend)
|
||||
{
|
||||
if (cs != &my_charset_bin)
|
||||
str+= cs->cset->scan(cs, str, strend, MY_SEQ_SPACES);
|
||||
str+= cs->scan(str, strend, MY_SEQ_SPACES);
|
||||
return (str < strend);
|
||||
}
|
||||
|
||||
|
@ -1120,13 +1120,13 @@ double Field::pos_in_interval_val_str(Field *min, Field *max, uint data_offset)
|
|||
uchar minp_prefix[sizeof(ulonglong)];
|
||||
uchar maxp_prefix[sizeof(ulonglong)];
|
||||
ulonglong mp, minp, maxp;
|
||||
my_strnxfrm(charset(), mp_prefix, sizeof(mp),
|
||||
charset()->strnxfrm(mp_prefix, sizeof(mp),
|
||||
ptr + data_offset,
|
||||
data_length());
|
||||
my_strnxfrm(charset(), minp_prefix, sizeof(minp),
|
||||
charset()->strnxfrm(minp_prefix, sizeof(minp),
|
||||
min->ptr + data_offset,
|
||||
min->data_length());
|
||||
my_strnxfrm(charset(), maxp_prefix, sizeof(maxp),
|
||||
charset()->strnxfrm(maxp_prefix, sizeof(maxp),
|
||||
max->ptr + data_offset,
|
||||
max->data_length());
|
||||
mp= char_prefix_to_ulonglong(mp_prefix);
|
||||
|
@ -1582,7 +1582,7 @@ Value_source::Converter_string_to_number::check_edom_and_truncation(THD *thd,
|
|||
@note
|
||||
This is called after one has called one of the following functions:
|
||||
- strntoull10rnd()
|
||||
- my_strntod()
|
||||
- strntod()
|
||||
- str2my_decimal()
|
||||
|
||||
@retval
|
||||
|
@ -1662,7 +1662,7 @@ bool Field_num::get_int(CHARSET_INFO *cs, const char *from, size_t len,
|
|||
char *end;
|
||||
int error;
|
||||
|
||||
*rnd= (longlong) cs->cset->strntoull10rnd(cs, from, len,
|
||||
*rnd= (longlong) cs->strntoull10rnd(from, len,
|
||||
unsigned_flag, &end,
|
||||
&error);
|
||||
if (unsigned_flag)
|
||||
|
@ -1703,7 +1703,7 @@ double Field_real::get_double(const char *str, size_t length, CHARSET_INFO *cs,
|
|||
int *error)
|
||||
{
|
||||
char *end;
|
||||
double nr= my_strntod(cs,(char*) str, length, &end, error);
|
||||
double nr= cs->strntod((char*) str, length, &end, error);
|
||||
if (unlikely(*error))
|
||||
{
|
||||
set_warning(ER_WARN_DATA_OUT_OF_RANGE, 1);
|
||||
|
@ -1760,7 +1760,7 @@ String *Field::val_int_as_str(String *val_buffer, bool unsigned_val)
|
|||
|
||||
if (val_buffer->alloc(MY_INT64_NUM_DECIMAL_DIGITS))
|
||||
return 0;
|
||||
length= (uint) (*cs->cset->longlong10_to_str)(cs, (char*) val_buffer->ptr(),
|
||||
length= (uint) (cs->longlong10_to_str)((char*) val_buffer->ptr(),
|
||||
MY_INT64_NUM_DECIMAL_DIGITS,
|
||||
unsigned_val ? 10 : -10,
|
||||
value);
|
||||
|
@ -1801,8 +1801,7 @@ void Field::hash(ulong *nr, ulong *nr2)
|
|||
else
|
||||
{
|
||||
uint len= pack_length();
|
||||
CHARSET_INFO *cs= sort_charset();
|
||||
cs->coll->hash_sort(cs, ptr, len, nr, nr2);
|
||||
sort_charset()->hash_sort(ptr, len, nr, nr2);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2207,7 +2206,7 @@ bool Field_str::test_if_equality_guarantees_uniqueness(const Item *item) const
|
|||
SELECT * FROM t1 WHERE varchar_column=DATE'2001-01-01'
|
||||
return non-unuque values, e.g. '2001-01-01' and '2001-01-01x'.
|
||||
*/
|
||||
if (!field_charset()->coll->propagate(field_charset(), 0, 0) ||
|
||||
if (!field_charset()->propagate(0, 0) ||
|
||||
item->cmp_type() != STRING_RESULT)
|
||||
return false;
|
||||
/*
|
||||
|
@ -3035,8 +3034,7 @@ double Field_decimal::val_real(void)
|
|||
DBUG_ASSERT(marked_for_read());
|
||||
int not_used;
|
||||
char *end_not_used;
|
||||
return my_strntod(&my_charset_bin, (char*) ptr, field_length, &end_not_used,
|
||||
¬_used);
|
||||
return my_charset_bin.strntod((char*) ptr, field_length, &end_not_used, ¬_used);
|
||||
}
|
||||
|
||||
longlong Field_decimal::val_int(void)
|
||||
|
@ -3044,10 +3042,8 @@ longlong Field_decimal::val_int(void)
|
|||
DBUG_ASSERT(marked_for_read());
|
||||
int not_used;
|
||||
if (unsigned_flag)
|
||||
return my_strntoull(&my_charset_bin, (char*) ptr, field_length, 10, NULL,
|
||||
¬_used);
|
||||
return my_strntoll(&my_charset_bin, (char*) ptr, field_length, 10, NULL,
|
||||
¬_used);
|
||||
return my_charset_bin.strntoull((char*) ptr, field_length, 10, NULL, ¬_used);
|
||||
return my_charset_bin.strntoll((char*) ptr, field_length, 10, NULL, ¬_used);
|
||||
}
|
||||
|
||||
|
||||
|
@ -4115,7 +4111,7 @@ String *Field_int::val_str_from_long(String *val_buffer,
|
|||
uint mlength= MY_MAX(field_length + 1, max_char_length * cs->mbmaxlen);
|
||||
val_buffer->alloc(mlength);
|
||||
char *to=(char*) val_buffer->ptr();
|
||||
length= (uint) cs->cset->long10_to_str(cs, to, mlength, radix, nr);
|
||||
length= (uint) cs->long10_to_str(to, mlength, radix, nr);
|
||||
val_buffer->length(length);
|
||||
if (zerofill)
|
||||
prepend_zeros(val_buffer); /* purecov: inspected */
|
||||
|
@ -4334,7 +4330,7 @@ int Field_longlong::store(const char *from,size_t len,CHARSET_INFO *cs)
|
|||
char *end;
|
||||
ulonglong tmp;
|
||||
|
||||
tmp= cs->cset->strntoull10rnd(cs,from,len,unsigned_flag,&end,&error);
|
||||
tmp= cs->strntoull10rnd(from, len, unsigned_flag, &end, &error);
|
||||
if (unlikely(error == MY_ERRNO_ERANGE))
|
||||
{
|
||||
set_warning(ER_WARN_DATA_OUT_OF_RANGE, 1);
|
||||
|
@ -4422,7 +4418,7 @@ String *Field_longlong::val_str(String *val_buffer,
|
|||
longlong j;
|
||||
j=sint8korr(ptr);
|
||||
|
||||
length=(uint) (cs->cset->longlong10_to_str)(cs,to,mlength,
|
||||
length=(uint) (cs->longlong10_to_str)(to, mlength,
|
||||
unsigned_flag ? 10 : -10, j);
|
||||
val_buffer->length(length);
|
||||
if (zerofill)
|
||||
|
@ -6240,7 +6236,7 @@ int Field_year::store(const char *from, size_t len,CHARSET_INFO *cs)
|
|||
DBUG_ASSERT(marked_for_write_or_computed());
|
||||
char *end;
|
||||
int error;
|
||||
longlong nr= cs->cset->strntoull10rnd(cs, from, len, 0, &end, &error);
|
||||
longlong nr= cs->strntoull10rnd(from, len, 0, &end, &error);
|
||||
|
||||
if (nr < 0 || (nr >= 100 && nr <= 1900) || nr > 2155 ||
|
||||
error == MY_ERRNO_ERANGE)
|
||||
|
@ -7052,8 +7048,7 @@ int Field_string::store(const char *from, size_t length,CHARSET_INFO *cs)
|
|||
|
||||
/* Append spaces if the string was shorter than the field. */
|
||||
if (copy_length < field_length)
|
||||
field_charset()->cset->fill(field_charset(),
|
||||
(char*) ptr + copy_length,
|
||||
field_charset()->fill((char*) ptr + copy_length,
|
||||
field_length - copy_length,
|
||||
field_charset()->pad_char);
|
||||
|
||||
|
@ -7065,11 +7060,8 @@ int Field_str::store(longlong nr, bool unsigned_val)
|
|||
{
|
||||
char buff[64];
|
||||
uint length;
|
||||
length= (uint) (field_charset()->cset->longlong10_to_str)(field_charset(),
|
||||
buff,
|
||||
sizeof(buff),
|
||||
(unsigned_val ? 10:
|
||||
-10),
|
||||
length= (uint) (field_charset()->longlong10_to_str)(buff, sizeof(buff),
|
||||
(unsigned_val ? 10: -10),
|
||||
nr);
|
||||
return store(buff, length, field_charset());
|
||||
}
|
||||
|
@ -7244,12 +7236,10 @@ String *Field_string::val_str(String *val_buffer __attribute__((unused)),
|
|||
size_t length;
|
||||
if (get_thd()->variables.sql_mode &
|
||||
MODE_PAD_CHAR_TO_FULL_LENGTH)
|
||||
length= my_charpos(field_charset(), ptr, ptr + field_length,
|
||||
length= field_charset()->charpos(ptr, ptr + field_length,
|
||||
Field_string::char_length());
|
||||
else
|
||||
length= field_charset()->cset->lengthsp(field_charset(),
|
||||
(const char*) ptr,
|
||||
field_length);
|
||||
length= field_charset()->lengthsp((const char*) ptr, field_length);
|
||||
val_ptr->set((const char*) ptr, length, field_charset());
|
||||
return val_ptr;
|
||||
}
|
||||
|
@ -7310,8 +7300,8 @@ int Field_string::cmp(const uchar *a_ptr, const uchar *b_ptr) const
|
|||
if (mbmaxlen() != 1)
|
||||
{
|
||||
size_t char_len= Field_string::char_length();
|
||||
a_len= my_charpos(field_charset(), a_ptr, a_ptr + field_length, char_len);
|
||||
b_len= my_charpos(field_charset(), b_ptr, b_ptr + field_length, char_len);
|
||||
a_len= field_charset()->charpos(a_ptr, a_ptr + field_length, char_len);
|
||||
b_len= field_charset()->charpos(b_ptr, b_ptr + field_length, char_len);
|
||||
}
|
||||
else
|
||||
a_len= b_len= field_length;
|
||||
|
@ -7319,8 +7309,7 @@ int Field_string::cmp(const uchar *a_ptr, const uchar *b_ptr) const
|
|||
We have to remove end space to be able to compare multi-byte-characters
|
||||
like in latin_de 'ae' and 0xe4
|
||||
*/
|
||||
return field_charset()->coll->strnncollsp(field_charset(),
|
||||
a_ptr, a_len,
|
||||
return field_charset()->strnncollsp(a_ptr, a_len,
|
||||
b_ptr, b_len);
|
||||
}
|
||||
|
||||
|
@ -7330,10 +7319,8 @@ void Field_string::sort_string(uchar *to,uint length)
|
|||
#ifdef DBUG_ASSERT_EXISTS
|
||||
size_t tmp=
|
||||
#endif
|
||||
field_charset()->coll->strnxfrm(field_charset(),
|
||||
to, length,
|
||||
char_length() *
|
||||
field_charset()->strxfrm_multiply,
|
||||
field_charset()->strnxfrm(to, length,
|
||||
char_length() * field_charset()->strxfrm_multiply,
|
||||
ptr, field_length,
|
||||
MY_STRXFRM_PAD_WITH_SPACE |
|
||||
MY_STRXFRM_PAD_TO_MAXLEN);
|
||||
|
@ -7484,13 +7471,12 @@ uint Field_string::max_packed_col_length(uint max_length)
|
|||
|
||||
uint Field_string::get_key_image(uchar *buff, uint length, imagetype type_arg)
|
||||
{
|
||||
size_t bytes= my_charpos(field_charset(), (char*) ptr,
|
||||
size_t bytes= field_charset()->charpos((char*) ptr,
|
||||
(char*) ptr + field_length,
|
||||
length / mbmaxlen());
|
||||
memcpy(buff, ptr, bytes);
|
||||
if (bytes < length)
|
||||
field_charset()->cset->fill(field_charset(),
|
||||
(char*) buff + bytes,
|
||||
field_charset()->fill((char*) buff + bytes,
|
||||
length - bytes,
|
||||
field_charset()->pad_char);
|
||||
return (uint)bytes;
|
||||
|
@ -7650,8 +7636,7 @@ int Field_varstring::cmp_max(const uchar *a_ptr, const uchar *b_ptr,
|
|||
}
|
||||
set_if_smaller(a_length, max_len);
|
||||
set_if_smaller(b_length, max_len);
|
||||
diff= field_charset()->coll->strnncollsp(field_charset(),
|
||||
a_ptr + length_bytes, a_length,
|
||||
diff= field_charset()->strnncollsp(a_ptr + length_bytes, a_length,
|
||||
b_ptr + length_bytes, b_length);
|
||||
return diff;
|
||||
}
|
||||
|
@ -7667,11 +7652,11 @@ int Field_varstring::key_cmp(const uchar *key_ptr, uint max_key_length) const
|
|||
size_t length= length_bytes == 1 ? (uint) *ptr : uint2korr(ptr);
|
||||
size_t local_char_length= max_key_length / mbmaxlen();
|
||||
|
||||
local_char_length= my_charpos(field_charset(), ptr + length_bytes,
|
||||
ptr + length_bytes + length, local_char_length);
|
||||
local_char_length= field_charset()->charpos(ptr + length_bytes,
|
||||
ptr + length_bytes + length,
|
||||
local_char_length);
|
||||
set_if_smaller(length, local_char_length);
|
||||
return field_charset()->coll->strnncollsp(field_charset(),
|
||||
ptr + length_bytes,
|
||||
return field_charset()->strnncollsp(ptr + length_bytes,
|
||||
length,
|
||||
key_ptr + HA_KEY_BLOB_LENGTH,
|
||||
uint2korr(key_ptr));
|
||||
|
@ -7688,11 +7673,8 @@ int Field_varstring::key_cmp(const uchar *key_ptr, uint max_key_length) const
|
|||
|
||||
int Field_varstring::key_cmp(const uchar *a,const uchar *b) const
|
||||
{
|
||||
return field_charset()->coll->strnncollsp(field_charset(),
|
||||
a + HA_KEY_BLOB_LENGTH,
|
||||
uint2korr(a),
|
||||
b + HA_KEY_BLOB_LENGTH,
|
||||
uint2korr(b));
|
||||
return field_charset()->strnncollsp(a + HA_KEY_BLOB_LENGTH, uint2korr(a),
|
||||
b + HA_KEY_BLOB_LENGTH, uint2korr(b));
|
||||
}
|
||||
|
||||
|
||||
|
@ -7715,11 +7697,9 @@ void Field_varstring::sort_string(uchar *to,uint length)
|
|||
#ifdef DBUG_ASSERT_EXISTS
|
||||
size_t rc=
|
||||
#endif
|
||||
field_charset()->coll->strnxfrm(field_charset(),
|
||||
to, length,
|
||||
char_length() *
|
||||
field_charset()->strxfrm_multiply,
|
||||
(const uchar*) buf.ptr(), buf.length(),
|
||||
field_charset()->strnxfrm(to, length,
|
||||
char_length() * field_charset()->strxfrm_multiply,
|
||||
(const uchar *) buf.ptr(), buf.length(),
|
||||
MY_STRXFRM_PAD_WITH_SPACE |
|
||||
MY_STRXFRM_PAD_TO_MAXLEN);
|
||||
DBUG_ASSERT(rc == length);
|
||||
|
@ -7979,8 +7959,7 @@ void Field_varstring::hash(ulong *nr, ulong *nr2)
|
|||
else
|
||||
{
|
||||
uint len= length_bytes == 1 ? (uint) *ptr : uint2korr(ptr);
|
||||
CHARSET_INFO *cs= charset();
|
||||
cs->coll->hash_sort(cs, ptr + length_bytes, len, nr, nr2);
|
||||
charset()->hash_sort(ptr + length_bytes, len, nr, nr2);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -8421,8 +8400,7 @@ my_decimal *Field_blob::val_decimal(my_decimal *decimal_value)
|
|||
int Field_blob::cmp(const uchar *a,uint32 a_length, const uchar *b,
|
||||
uint32 b_length) const
|
||||
{
|
||||
return field_charset()->coll->strnncollsp(field_charset(),
|
||||
a, a_length, b, b_length);
|
||||
return field_charset()->strnncollsp(a, a_length, b, b_length);
|
||||
}
|
||||
|
||||
|
||||
|
@ -8465,7 +8443,7 @@ uint Field_blob::get_key_image_itRAW(uchar *buff, uint length)
|
|||
size_t blob_length= get_length(ptr);
|
||||
uchar *blob= get_ptr();
|
||||
size_t local_char_length= length / mbmaxlen();
|
||||
local_char_length= my_charpos(field_charset(), blob, blob + blob_length,
|
||||
local_char_length= field_charset()->charpos(blob, blob + blob_length,
|
||||
local_char_length);
|
||||
set_if_smaller(blob_length, local_char_length);
|
||||
|
||||
|
@ -8499,7 +8477,7 @@ int Field_blob::key_cmp(const uchar *key_ptr, uint max_key_length) const
|
|||
memcpy(&blob1, ptr+packlength, sizeof(char*));
|
||||
CHARSET_INFO *cs= charset();
|
||||
size_t local_char_length= max_key_length / cs->mbmaxlen;
|
||||
local_char_length= my_charpos(cs, blob1, blob1+blob_length,
|
||||
local_char_length= cs->charpos(blob1, blob1+blob_length,
|
||||
local_char_length);
|
||||
set_if_smaller(blob_length, local_char_length);
|
||||
return Field_blob::cmp(blob1, (uint32)blob_length,
|
||||
|
@ -8574,8 +8552,8 @@ void Field_blob::sort_string(uchar *to,uint length)
|
|||
#ifdef DBUG_ASSERT_EXISTS
|
||||
size_t rc=
|
||||
#endif
|
||||
field_charset()->coll->strnxfrm(field_charset(), to, length, length,
|
||||
(const uchar*) buf.ptr(), buf.length(),
|
||||
field_charset()->strnxfrm(to, length, length,
|
||||
(const uchar *) buf.ptr(), buf.length(),
|
||||
MY_STRXFRM_PAD_WITH_SPACE |
|
||||
MY_STRXFRM_PAD_TO_MAXLEN);
|
||||
DBUG_ASSERT(rc == length);
|
||||
|
@ -8855,7 +8833,7 @@ int Field_enum::store(const char *from,size_t length,CHARSET_INFO *cs)
|
|||
}
|
||||
|
||||
/* Remove end space */
|
||||
length= (uint)field_charset()->cset->lengthsp(field_charset(), from, length);
|
||||
length= (uint) field_charset()->lengthsp(from, length);
|
||||
uint tmp=find_type2(typelib, from, length, field_charset());
|
||||
if (!tmp)
|
||||
{
|
||||
|
@ -8863,7 +8841,7 @@ int Field_enum::store(const char *from,size_t length,CHARSET_INFO *cs)
|
|||
{
|
||||
/* This is for reading numbers with LOAD DATA INFILE */
|
||||
char *end;
|
||||
tmp=(uint) my_strntoul(cs,from,length,10,&end,&err);
|
||||
tmp=(uint) cs->strntoul(from,length,10,&end,&err);
|
||||
if (err || end != from+length || tmp > typelib->count)
|
||||
{
|
||||
tmp=0;
|
||||
|
@ -9045,7 +9023,7 @@ int Field_set::store(const char *from,size_t length,CHARSET_INFO *cs)
|
|||
{
|
||||
/* This is for reading numbers with LOAD DATA INFILE */
|
||||
char *end;
|
||||
tmp=my_strntoull(cs,from,length,10,&end,&err);
|
||||
tmp= cs->strntoull(from,length,10,&end,&err);
|
||||
if (err || end != from+length ||
|
||||
tmp > (ulonglong) (((longlong) 1 << typelib->count) - (longlong) 1))
|
||||
{
|
||||
|
@ -9176,11 +9154,8 @@ static bool compare_type_names(CHARSET_INFO *charset, const TYPELIB *t1,
|
|||
const TYPELIB *t2)
|
||||
{
|
||||
for (uint i= 0; i < t1->count; i++)
|
||||
if (my_strnncoll(charset,
|
||||
(const uchar*) t1->type_names[i],
|
||||
t1->type_lengths[i],
|
||||
(const uchar*) t2->type_names[i],
|
||||
t2->type_lengths[i]))
|
||||
if (charset->strnncoll(t1->type_names[i], t1->type_lengths[i],
|
||||
t2->type_names[i], t2->type_lengths[i]))
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -9420,7 +9395,7 @@ void Field_bit::hash(ulong *nr, ulong *nr2)
|
|||
longlong value= Field_bit::val_int();
|
||||
uchar tmp[8];
|
||||
mi_int8store(tmp,value);
|
||||
cs->coll->hash_sort(cs, tmp, 8, nr, nr2);
|
||||
cs->hash_sort(tmp, 8, nr, nr2);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -9940,10 +9915,9 @@ bool Column_definition::create_interval_from_interval_list(MEM_ROOT *mem_root,
|
|||
StringBuffer<64> conv;
|
||||
char comma_buf[5]; /* 5 bytes for 'filename' charset */
|
||||
DBUG_ASSERT(sizeof(comma_buf) >= charset->mbmaxlen);
|
||||
int comma_length= charset->cset->wc_mb(charset, ',',
|
||||
int comma_length= charset->wc_mb(',',
|
||||
(uchar*) comma_buf,
|
||||
(uchar*) comma_buf +
|
||||
sizeof(comma_buf));
|
||||
(uchar*) comma_buf + sizeof(comma_buf));
|
||||
DBUG_ASSERT(comma_length >= 0 && comma_length <= (int) sizeof(comma_buf));
|
||||
|
||||
if (!multi_alloc_root(mem_root,
|
||||
|
@ -9982,12 +9956,12 @@ bool Column_definition::create_interval_from_interval_list(MEM_ROOT *mem_root,
|
|||
goto err; // EOM
|
||||
|
||||
// Strip trailing spaces.
|
||||
value.length= charset->cset->lengthsp(charset, value.str, value.length);
|
||||
value.length= charset->lengthsp(value.str, value.length);
|
||||
((char*) value.str)[value.length]= '\0';
|
||||
|
||||
if (real_field_type() == MYSQL_TYPE_SET)
|
||||
{
|
||||
if (charset->coll->instr(charset, value.str, value.length,
|
||||
if (charset->instr(value.str, value.length,
|
||||
comma_buf, comma_length, NULL, 0))
|
||||
{
|
||||
ErrConvString err(tmp);
|
||||
|
@ -10989,7 +10963,7 @@ void Field_string::print_key_value(String *out, uint32 length)
|
|||
{
|
||||
if (charset() == &my_charset_bin)
|
||||
{
|
||||
size_t len= field_charset()->cset->lengthsp(field_charset(), (const char*) ptr, length);
|
||||
size_t len= field_charset()->lengthsp((const char*) ptr, length);
|
||||
print_key_value_binary(out, ptr, static_cast<uint32>(len));
|
||||
}
|
||||
else
|
||||
|
|
13
sql/field.h
13
sql/field.h
|
@ -1,7 +1,7 @@
|
|||
#ifndef FIELD_INCLUDED
|
||||
#define FIELD_INCLUDED
|
||||
/* Copyright (c) 2000, 2015, Oracle and/or its affiliates.
|
||||
Copyright (c) 2008, 2019, MariaDB Corporation.
|
||||
Copyright (c) 2008, 2020, MariaDB Corporation.
|
||||
|
||||
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
|
||||
|
@ -204,7 +204,7 @@ protected:
|
|||
public:
|
||||
Converter_strntod(CHARSET_INFO *cs, const char *str, size_t length)
|
||||
{
|
||||
m_result= my_strntod(cs, (char *) str, length, &m_end_of_num, &m_error);
|
||||
m_result= cs->strntod((char *) str, length, &m_end_of_num, &m_error);
|
||||
// strntod() does not set an error if the input string was empty
|
||||
m_edom= m_error !=0 || str == m_end_of_num;
|
||||
}
|
||||
|
@ -224,7 +224,7 @@ protected:
|
|||
public:
|
||||
Converter_strntoll(CHARSET_INFO *cs, const char *str, size_t length)
|
||||
{
|
||||
m_result= my_strntoll(cs, str, length, 10, &m_end_of_num, &m_error);
|
||||
m_result= cs->strntoll(str, length, 10, &m_end_of_num, &m_error);
|
||||
/*
|
||||
All non-zero errors means EDOM error.
|
||||
strntoll() does not set an error if the input string was empty.
|
||||
|
@ -241,7 +241,7 @@ protected:
|
|||
Converter_strtoll10(CHARSET_INFO *cs, const char *str, size_t length)
|
||||
{
|
||||
m_end_of_num= (char *) str + length;
|
||||
m_result= (*(cs->cset->strtoll10))(cs, str, &m_end_of_num, &m_error);
|
||||
m_result= cs->strtoll10(str, &m_end_of_num, &m_error);
|
||||
/*
|
||||
Negative error means "good negative number".
|
||||
Only a positive m_error value means a real error.
|
||||
|
@ -3924,8 +3924,7 @@ public:
|
|||
Copy_func *get_copy_func(const Field *from) const override;
|
||||
int reset() override
|
||||
{
|
||||
charset()->cset->fill(charset(),(char*) ptr, field_length,
|
||||
(has_charset() ? ' ' : 0));
|
||||
charset()->fill((char*) ptr, field_length, (has_charset() ? ' ' : 0));
|
||||
return 0;
|
||||
}
|
||||
int store(const char *to,size_t length,CHARSET_INFO *charset) override;
|
||||
|
@ -5016,7 +5015,7 @@ class Column_definition: public Sql_alloc,
|
|||
for (pos= interval->type_names, len= interval->type_lengths;
|
||||
*pos ; pos++, len++)
|
||||
{
|
||||
size_t length= charset->cset->numchars(charset, *pos, *pos + *len);
|
||||
size_t length= charset->numchars(*pos, *pos + *len);
|
||||
DBUG_ASSERT(length < UINT_MAX32);
|
||||
*tot_length+= (uint) length;
|
||||
set_if_bigger(*max_length, (uint32)length);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/* Copyright (c) 2000, 2016, Oracle and/or its affiliates.
|
||||
Copyright (c) 2010, 2018, MariaDB Corporation
|
||||
Copyright (c) 2010, 2020, MariaDB Corporation
|
||||
|
||||
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
|
||||
|
@ -465,8 +465,7 @@ static void do_cut_string(Copy_field *copy)
|
|||
memcpy(copy->to_ptr,copy->from_ptr,copy->to_length);
|
||||
|
||||
/* Check if we loosed any important characters */
|
||||
if (cs->cset->scan(cs,
|
||||
(char*) copy->from_ptr + copy->to_length,
|
||||
if (cs->scan((char*) copy->from_ptr + copy->to_length,
|
||||
(char*) copy->from_ptr + copy->from_length,
|
||||
MY_SEQ_SPACES) < copy->from_length - copy->to_length)
|
||||
{
|
||||
|
@ -496,7 +495,7 @@ static void do_cut_string_complex(Copy_field *copy)
|
|||
|
||||
/* Check if we lost any important characters */
|
||||
if (unlikely(prefix.well_formed_error_pos() ||
|
||||
cs->cset->scan(cs, (char*) copy->from_ptr + copy_length,
|
||||
cs->scan((char*) copy->from_ptr + copy_length,
|
||||
(char*) from_end,
|
||||
MY_SEQ_SPACES) <
|
||||
(copy->from_length - copy_length)))
|
||||
|
@ -506,7 +505,7 @@ static void do_cut_string_complex(Copy_field *copy)
|
|||
}
|
||||
|
||||
if (copy_length < copy->to_length)
|
||||
cs->cset->fill(cs, (char*) copy->to_ptr + copy_length,
|
||||
cs->fill((char*) copy->to_ptr + copy_length,
|
||||
copy->to_length - copy_length, ' ');
|
||||
}
|
||||
|
||||
|
@ -517,7 +516,7 @@ static void do_expand_binary(Copy_field *copy)
|
|||
{
|
||||
CHARSET_INFO *cs= copy->from_field->charset();
|
||||
memcpy(copy->to_ptr,copy->from_ptr,copy->from_length);
|
||||
cs->cset->fill(cs, (char*) copy->to_ptr+copy->from_length,
|
||||
cs->fill((char*) copy->to_ptr+copy->from_length,
|
||||
copy->to_length-copy->from_length, '\0');
|
||||
}
|
||||
|
||||
|
@ -527,7 +526,7 @@ static void do_expand_string(Copy_field *copy)
|
|||
{
|
||||
CHARSET_INFO *cs= copy->from_field->charset();
|
||||
memcpy(copy->to_ptr,copy->from_ptr,copy->from_length);
|
||||
cs->cset->fill(cs, (char*) copy->to_ptr+copy->from_length,
|
||||
cs->fill((char*) copy->to_ptr+copy->from_length,
|
||||
copy->to_length-copy->from_length, ' ');
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/* Copyright (c) 2000, 2015, Oracle and/or its affiliates.
|
||||
Copyright (c) 2009, 2015, MariaDB
|
||||
Copyright (c) 2009, 2020, MariaDB
|
||||
|
||||
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
|
||||
|
@ -1072,9 +1072,8 @@ Type_handler_string_result::make_sort_key(uchar *to, Item *item,
|
|||
#ifdef DBUG_ASSERT_EXISTS
|
||||
size_t tmp_length=
|
||||
#endif
|
||||
cs->coll->strnxfrm(cs, to, sort_field->length,
|
||||
item->max_char_length() *
|
||||
cs->strxfrm_multiply,
|
||||
cs->strnxfrm(to, sort_field->length,
|
||||
item->max_char_length() * cs->strxfrm_multiply,
|
||||
(uchar*) res->ptr(), res->length(),
|
||||
MY_STRXFRM_PAD_WITH_SPACE |
|
||||
MY_STRXFRM_PAD_TO_MAXLEN);
|
||||
|
@ -1098,9 +1097,9 @@ Type_handler_string_result::make_sort_key(uchar *to, Item *item,
|
|||
store_length(to + sort_field_length, length, sort_field->suffix_length);
|
||||
}
|
||||
/* apply cs->sort_order for case-insensitive comparison if needed */
|
||||
my_strnxfrm(cs,(uchar*)to,length,(const uchar*)res->ptr(),length);
|
||||
cs->strnxfrm((uchar*)to, length, (const uchar*) res->ptr(), length);
|
||||
char fill_char= ((cs->state & MY_CS_BINSORT) ? (char) 0 : ' ');
|
||||
cs->cset->fill(cs, (char *)to+length,diff,fill_char);
|
||||
cs->fill((char *) to + length, diff, fill_char);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2017,7 +2016,7 @@ Type_handler_string_result::sortlength(THD *thd,
|
|||
set_if_smaller(sortorder->length, thd->variables.max_sort_length);
|
||||
if (use_strnxfrm((cs= item->collation.collation)))
|
||||
{
|
||||
sortorder->length= (uint)cs->coll->strnxfrmlen(cs, sortorder->length);
|
||||
sortorder->length= (uint) cs->strnxfrmlen(sortorder->length);
|
||||
}
|
||||
else if (cs == &my_charset_bin)
|
||||
{
|
||||
|
@ -2109,7 +2108,7 @@ sortlength(THD *thd, SORT_FIELD *sortorder, uint s_length,
|
|||
if (use_strnxfrm((cs=sortorder->field->sort_charset())))
|
||||
{
|
||||
*multi_byte_charset= true;
|
||||
sortorder->length= (uint)cs->coll->strnxfrmlen(cs, sortorder->length);
|
||||
sortorder->length= (uint) cs->strnxfrmlen(sortorder->length);
|
||||
}
|
||||
if (sortorder->field->maybe_null())
|
||||
length++; // Place for NULL marker
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
/* Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
Copyright (c) 2009, 2020, MariaDB Corporation.
|
||||
|
||||
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
|
||||
|
@ -107,8 +108,7 @@ bool Gis_read_stream::get_next_number(double *d)
|
|||
return 1;
|
||||
}
|
||||
|
||||
*d = my_strntod(m_charset, (char *)m_cur,
|
||||
(uint) (m_limit-m_cur), &endptr, &err);
|
||||
*d = m_charset->strntod((char *)m_cur, (uint) (m_limit-m_cur), &endptr, &err);
|
||||
if (err)
|
||||
return 1;
|
||||
if (endptr)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
Copyright (c) 2005, 2019, Oracle and/or its affiliates.
|
||||
Copyright (c) 2009, 2019, MariaDB
|
||||
Copyright (c) 2009, 2020, MariaDB
|
||||
|
||||
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
|
||||
|
@ -9697,8 +9697,7 @@ uint32 ha_partition::calculate_key_hash_value(Field **field_array)
|
|||
}
|
||||
/* Force this to my_hash_sort_bin, which was used in 5.1! */
|
||||
uint len= field->pack_length();
|
||||
my_charset_bin.coll->hash_sort(&my_charset_bin, field->ptr, len,
|
||||
&nr1, &nr2);
|
||||
my_charset_bin.hash_sort(field->ptr, len, &nr1, &nr2);
|
||||
/* Done with this field, continue with next one. */
|
||||
continue;
|
||||
}
|
||||
|
@ -9721,8 +9720,7 @@ uint32 ha_partition::calculate_key_hash_value(Field **field_array)
|
|||
}
|
||||
/* Force this to my_hash_sort_bin, which was used in 5.1! */
|
||||
uint len= field->pack_length();
|
||||
my_charset_latin1.coll->hash_sort(&my_charset_latin1, field->ptr,
|
||||
len, &nr1, &nr2);
|
||||
my_charset_latin1.hash_sort(field->ptr, len, &nr1, &nr2);
|
||||
continue;
|
||||
}
|
||||
/* New types in mysql-5.6. */
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/* Copyright (c) 2000, 2016, Oracle and/or its affiliates.
|
||||
Copyright (c) 2009, 2019, MariaDB Corporation.
|
||||
Copyright (c) 2009, 2020, MariaDB Corporation.
|
||||
|
||||
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
|
||||
|
@ -182,8 +182,7 @@ plugin_ref ha_resolve_by_name(THD *thd, const LEX_CSTRING *name,
|
|||
plugin_ref plugin;
|
||||
|
||||
redo:
|
||||
/* my_strnncoll is a macro and gcc doesn't do early expansion of macro */
|
||||
if (thd && !my_charset_latin1.coll->strnncoll(&my_charset_latin1,
|
||||
if (thd && !my_charset_latin1.strnncoll(
|
||||
(const uchar *)name->str, name->length,
|
||||
(const uchar *)STRING_WITH_LEN("DEFAULT"), 0))
|
||||
return tmp_table ? ha_default_tmp_plugin(thd) : ha_default_plugin(thd);
|
||||
|
@ -205,7 +204,7 @@ redo:
|
|||
*/
|
||||
for (table_alias= sys_table_aliases; table_alias->str; table_alias+= 2)
|
||||
{
|
||||
if (!my_strnncoll(&my_charset_latin1,
|
||||
if (!my_charset_latin1.strnncoll(
|
||||
(const uchar *)name->str, name->length,
|
||||
(const uchar *)table_alias->str, table_alias->length))
|
||||
{
|
||||
|
@ -5587,13 +5586,13 @@ static int cmp_file_names(const void *a, const void *b)
|
|||
CHARSET_INFO *cs= character_set_filesystem;
|
||||
char *aa= ((FILEINFO *)a)->name;
|
||||
char *bb= ((FILEINFO *)b)->name;
|
||||
return my_strnncoll(cs, (uchar*)aa, strlen(aa), (uchar*)bb, strlen(bb));
|
||||
return cs->strnncoll(aa, strlen(aa), bb, strlen(bb));
|
||||
}
|
||||
|
||||
static int cmp_table_names(LEX_CSTRING * const *a, LEX_CSTRING * const *b)
|
||||
{
|
||||
return my_strnncoll(&my_charset_bin, (uchar*)((*a)->str), (*a)->length,
|
||||
(uchar*)((*b)->str), (*b)->length);
|
||||
return my_charset_bin.strnncoll((*a)->str, (*a)->length,
|
||||
(*b)->str, (*b)->length);
|
||||
}
|
||||
|
||||
#ifndef DBUG_OFF
|
||||
|
@ -5627,7 +5626,7 @@ bool Discovered_table_list::add_table(const char *tname, size_t tlen)
|
|||
custom discover_table_names() method, that calls add_table() directly).
|
||||
Note: avoid comparing the same name twice (here and in add_file).
|
||||
*/
|
||||
if (wild && my_wildcmp(table_alias_charset, tname, tname + tlen, wild, wend,
|
||||
if (wild && table_alias_charset->wildcmp(tname, tname + tlen, wild, wend,
|
||||
wild_prefix, wild_one, wild_many))
|
||||
return 0;
|
||||
|
||||
|
|
17
sql/item.cc
17
sql/item.cc
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
Copyright (c) 2000, 2018, Oracle and/or its affiliates.
|
||||
Copyright (c) 2010, 2019, MariaDB Corporation
|
||||
Copyright (c) 2010, 2020, MariaDB Corporation
|
||||
|
||||
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
|
||||
|
@ -1100,9 +1100,9 @@ void Item::set_name(THD *thd, const char *str, size_t length, CHARSET_INFO *cs)
|
|||
}
|
||||
|
||||
const char *str_start= str;
|
||||
if (!cs->ctype || cs->mbminlen > 1)
|
||||
if (!cs->m_ctype || cs->mbminlen > 1)
|
||||
{
|
||||
str+= cs->cset->scan(cs, str, str + length, MY_SEQ_SPACES);
|
||||
str+= cs->scan(str, str + length, MY_SEQ_SPACES);
|
||||
length-= (uint)(str - str_start);
|
||||
}
|
||||
else
|
||||
|
@ -4826,14 +4826,14 @@ double Item_copy_string::val_real()
|
|||
int err_not_used;
|
||||
char *end_not_used;
|
||||
return (null_value ? 0.0 :
|
||||
my_strntod(str_value.charset(), (char*) str_value.ptr(),
|
||||
str_value.length(), &end_not_used, &err_not_used));
|
||||
str_value.charset()->strntod((char*) str_value.ptr(), str_value.length(),
|
||||
&end_not_used, &err_not_used));
|
||||
}
|
||||
|
||||
longlong Item_copy_string::val_int()
|
||||
{
|
||||
int err;
|
||||
return null_value ? 0 : my_strntoll(str_value.charset(),str_value.ptr(),
|
||||
return null_value ? 0 : str_value.charset()->strntoll(str_value.ptr(),
|
||||
str_value.length(), 10, (char**) 0,
|
||||
&err);
|
||||
}
|
||||
|
@ -6285,7 +6285,7 @@ String_copier_for_item::copy_with_warn(CHARSET_INFO *dstcs, String *dst,
|
|||
if (unlikely(pos= cannot_convert_error_pos()))
|
||||
{
|
||||
char buf[16];
|
||||
int mblen= my_charlen(srccs, pos, src + src_length);
|
||||
int mblen= srccs->charlen(pos, src + src_length);
|
||||
DBUG_ASSERT(mblen > 0 && mblen * 2 + 1 <= (int) sizeof(buf));
|
||||
octet2hex(buf, pos, mblen);
|
||||
push_warning_printf(m_thd, Sql_condition::WARN_LEVEL_WARN,
|
||||
|
@ -6810,8 +6810,7 @@ Item_float::Item_float(THD *thd, const char *str_arg, size_t length):
|
|||
{
|
||||
int error;
|
||||
char *end_not_used;
|
||||
value= my_strntod(&my_charset_bin, (char*) str_arg, length, &end_not_used,
|
||||
&error);
|
||||
value= my_charset_bin.strntod((char*) str_arg, length, &end_not_used, &error);
|
||||
if (unlikely(error))
|
||||
{
|
||||
char tmp[NAME_LEN + 1];
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/* Copyright (c) 2000, 2013, Oracle and/or its affiliates.
|
||||
Copyright (c) 2009, 2019, MariaDB
|
||||
Copyright (c) 2009, 2020, MariaDB
|
||||
|
||||
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
|
||||
|
@ -5603,7 +5603,7 @@ longlong Item_func_like::val_int()
|
|||
null_value=0;
|
||||
if (canDoTurboBM)
|
||||
return turboBM_matches(res->ptr(), res->length()) ? !negated : negated;
|
||||
return my_wildcmp(cmp_collation.collation,
|
||||
return cmp_collation.collation->wildcmp(
|
||||
res->ptr(),res->ptr()+res->length(),
|
||||
res2->ptr(),res2->ptr()+res2->length(),
|
||||
escape,wild_one,wild_many) ? negated : !negated;
|
||||
|
@ -5696,11 +5696,11 @@ bool fix_escape_item(THD *thd, Item *escape_item, String *tmp_str,
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
if (use_mb(cmp_cs))
|
||||
if (cmp_cs->use_mb())
|
||||
{
|
||||
CHARSET_INFO *cs= escape_str->charset();
|
||||
my_wc_t wc;
|
||||
int rc= cs->cset->mb_wc(cs, &wc,
|
||||
int rc= cs->mb_wc(&wc,
|
||||
(const uchar*) escape_str_ptr,
|
||||
(const uchar*) escape_str_ptr +
|
||||
escape_str->length());
|
||||
|
@ -5771,7 +5771,7 @@ bool Item_func_like::fix_fields(THD *thd, Item **ref)
|
|||
{
|
||||
const char* tmp = first + 1;
|
||||
for (; *tmp != wild_many && *tmp != wild_one && *tmp != escape; tmp++) ;
|
||||
canDoTurboBM = (tmp == last) && !use_mb(args[0]->collation.collation);
|
||||
canDoTurboBM = (tmp == last) && !args[0]->collation.collation->use_mb();
|
||||
}
|
||||
if (canDoTurboBM)
|
||||
{
|
||||
|
@ -6018,8 +6018,7 @@ bool Regexp_processor_pcre::exec(String *str, int offset,
|
|||
/*
|
||||
Convert byte offset into character offset.
|
||||
*/
|
||||
m_SubStrVec[i]= (int) str->charset()->cset->numchars(str->charset(),
|
||||
str->ptr(),
|
||||
m_SubStrVec[i]= (int) str->charset()->numchars(str->ptr(),
|
||||
str->ptr() +
|
||||
m_SubStrVec[i]);
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/* Copyright (c) 2000, 2015, Oracle and/or its affiliates.
|
||||
Copyright (c) 2009, 2019, MariaDB
|
||||
Copyright (c) 2009, 2020, MariaDB
|
||||
|
||||
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
|
||||
|
@ -1753,9 +1753,9 @@ static void calc_hash_for_unique(ulong &nr1, ulong &nr2, String *str)
|
|||
uchar l[4];
|
||||
int4store(l, str->length());
|
||||
cs= str->charset();
|
||||
cs->coll->hash_sort(cs, l, sizeof(l), &nr1, &nr2);
|
||||
cs->hash_sort(l, sizeof(l), &nr1, &nr2);
|
||||
cs= str->charset();
|
||||
cs->coll->hash_sort(cs, (uchar *)str->ptr(), str->length(), &nr1, &nr2);
|
||||
cs->hash_sort((uchar *)str->ptr(), str->length(), &nr1, &nr2);
|
||||
}
|
||||
|
||||
longlong Item_func_hash::val_int()
|
||||
|
@ -2962,9 +2962,8 @@ longlong Item_func_locate::val_int()
|
|||
if (!b->length()) // Found empty string at start
|
||||
return start + 1;
|
||||
|
||||
if (!cmp_collation.collation->coll->instr(cmp_collation.collation,
|
||||
a->ptr()+start,
|
||||
(uint) (a->length()-start),
|
||||
if (!cmp_collation.collation->instr(a->ptr() + start,
|
||||
(uint) (a->length() - start),
|
||||
b->ptr(), b->length(),
|
||||
&match, 1))
|
||||
return 0;
|
||||
|
@ -3079,7 +3078,7 @@ longlong Item_func_ord::val_int()
|
|||
null_value=0;
|
||||
if (!res->length()) return 0;
|
||||
#ifdef USE_MB
|
||||
if (use_mb(res->charset()))
|
||||
if (res->use_mb())
|
||||
{
|
||||
const char *str=res->ptr();
|
||||
uint32 n=0, l=my_ismbchar(res->charset(),str,str+res->length());
|
||||
|
@ -3165,13 +3164,13 @@ longlong Item_func_find_in_set::val_int()
|
|||
const char *str_begin= buffer->ptr();
|
||||
const char *str_end= buffer->ptr();
|
||||
const char *real_end= str_end+buffer->length();
|
||||
const uchar *find_str= (const uchar *) find->ptr();
|
||||
const char *find_str= find->ptr();
|
||||
uint find_str_len= find->length();
|
||||
int position= 0;
|
||||
while (1)
|
||||
{
|
||||
int symbol_len;
|
||||
if ((symbol_len= cs->cset->mb_wc(cs, &wc, (uchar*) str_end,
|
||||
if ((symbol_len= cs->mb_wc(&wc, (uchar*) str_end,
|
||||
(uchar*) real_end)) > 0)
|
||||
{
|
||||
const char *substr_end= str_end + symbol_len;
|
||||
|
@ -3182,8 +3181,7 @@ longlong Item_func_find_in_set::val_int()
|
|||
position++;
|
||||
if (is_last_item && !is_separator)
|
||||
str_end= substr_end;
|
||||
if (!my_strnncoll(cs, (const uchar *) str_begin,
|
||||
(uint) (str_end - str_begin),
|
||||
if (!cs->strnncoll(str_begin, (uint) (str_end - str_begin),
|
||||
find_str, find_str_len))
|
||||
return (longlong) position;
|
||||
else
|
||||
|
@ -5645,8 +5643,7 @@ bool Item_func_get_system_var::fix_length_and_dec()
|
|||
(char*) var->value_ptr(current_thd, var_type, &component) :
|
||||
*(char**) var->value_ptr(current_thd, var_type, &component);
|
||||
if (cptr)
|
||||
max_length= (uint32)system_charset_info->cset->numchars(system_charset_info,
|
||||
cptr,
|
||||
max_length= (uint32) system_charset_info->numchars(cptr,
|
||||
cptr + strlen(cptr));
|
||||
mysql_mutex_unlock(&LOCK_global_system_variables);
|
||||
collation.set(system_charset_info, DERIVATION_SYSCONST);
|
||||
|
@ -5657,8 +5654,7 @@ bool Item_func_get_system_var::fix_length_and_dec()
|
|||
{
|
||||
mysql_mutex_lock(&LOCK_global_system_variables);
|
||||
LEX_STRING *ls= ((LEX_STRING*)var->value_ptr(current_thd, var_type, &component));
|
||||
max_length= (uint32)system_charset_info->cset->numchars(system_charset_info,
|
||||
ls->str,
|
||||
max_length= (uint32) system_charset_info->numchars(ls->str,
|
||||
ls->str + ls->length);
|
||||
mysql_mutex_unlock(&LOCK_global_system_variables);
|
||||
collation.set(system_charset_info, DERIVATION_SYSCONST);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#ifndef ITEM_FUNC_INCLUDED
|
||||
#define ITEM_FUNC_INCLUDED
|
||||
/* Copyright (c) 2000, 2016, Oracle and/or its affiliates.
|
||||
Copyright (c) 2009, 2016, MariaDB
|
||||
Copyright (c) 2009, 2020, MariaDB
|
||||
|
||||
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
|
||||
|
@ -2574,14 +2574,14 @@ public:
|
|||
char *end_not_used;
|
||||
String *res;
|
||||
res= val_str(&str_value);
|
||||
return res ? my_strntod(res->charset(),(char*) res->ptr(),
|
||||
res->length(), &end_not_used, &err_not_used) : 0.0;
|
||||
return res ? res->charset()->strntod((char*) res->ptr(), res->length(),
|
||||
&end_not_used, &err_not_used) : 0.0;
|
||||
}
|
||||
longlong val_int()
|
||||
{
|
||||
int err_not_used;
|
||||
String *res; res=val_str(&str_value);
|
||||
return res ? my_strntoll(res->charset(),res->ptr(),res->length(),10,
|
||||
return res ? res->charset()->strntoll(res->ptr(),res->length(),10,
|
||||
(char**) 0, &err_not_used) : (longlong) 0;
|
||||
}
|
||||
my_decimal *val_decimal(my_decimal *dec_buf)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (c) 2016, Monty Program Ab.
|
||||
/* Copyright (c) 2016, 2020, MariaDB Corporation.
|
||||
|
||||
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
|
||||
|
@ -36,7 +36,7 @@ static bool eq_ascii_string(const CHARSET_INFO *cs,
|
|||
my_wc_t wc;
|
||||
int wc_len;
|
||||
|
||||
wc_len= cs->cset->mb_wc(cs, &wc, (uchar *) s, (uchar *) s_end);
|
||||
wc_len= cs->mb_wc(&wc, (uchar *) s, (uchar *) s_end);
|
||||
if (wc_len <= 0 || (wc | 0x20) != (my_wc_t) *ascii)
|
||||
return 0;
|
||||
|
||||
|
@ -905,7 +905,7 @@ longlong Item_func_json_extract::val_int()
|
|||
{
|
||||
char *end;
|
||||
int err;
|
||||
i= my_strntoll(collation.collation, value, value_len, 10, &end, &err);
|
||||
i= collation.collation->strntoll(value, value_len, 10, &end, &err);
|
||||
break;
|
||||
}
|
||||
case JSON_VALUE_TRUE:
|
||||
|
@ -936,7 +936,7 @@ double Item_func_json_extract::val_real()
|
|||
{
|
||||
char *end;
|
||||
int err;
|
||||
d= my_strntod(collation.collation, value, value_len, &end, &err);
|
||||
d= collation.collation->strntod(value, value_len, &end, &err);
|
||||
break;
|
||||
}
|
||||
case JSON_VALUE_TRUE:
|
||||
|
@ -1092,10 +1092,8 @@ static int check_contains(json_engine_t *js, json_engine_t *value)
|
|||
char *end;
|
||||
int err;
|
||||
|
||||
d_j= my_strntod(js->s.cs, (char *) js->value, js->value_len,
|
||||
&end, &err);;
|
||||
d_v= my_strntod(value->s.cs, (char *) value->value, value->value_len,
|
||||
&end, &err);;
|
||||
d_j= js->s.cs->strntod((char *) js->value, js->value_len, &end, &err);;
|
||||
d_v= value->s.cs->strntod((char *) value->value, value->value_len, &end, &err);;
|
||||
|
||||
return (fabs(d_j - d_v) < 1e-12);
|
||||
}
|
||||
|
@ -3316,7 +3314,7 @@ int Item_func_json_search::compare_json_value_wild(json_engine_t *je,
|
|||
const String *cmp_str)
|
||||
{
|
||||
if (je->value_type != JSON_VALUE_STRING || !je->value_escaped)
|
||||
return my_wildcmp(collation.collation,
|
||||
return collation.collation->wildcmp(
|
||||
(const char *) je->value, (const char *) (je->value + je->value_len),
|
||||
cmp_str->ptr(), cmp_str->end(), escape, wild_one, wild_many) ? 0 : 1;
|
||||
|
||||
|
@ -3333,7 +3331,7 @@ int Item_func_json_search::compare_json_value_wild(json_engine_t *je,
|
|||
if (esc_len <= 0)
|
||||
return 0;
|
||||
|
||||
return my_wildcmp(collation.collation,
|
||||
return collation.collation->wildcmp(
|
||||
esc_value.ptr(), esc_value.ptr() + esc_len,
|
||||
cmp_str->ptr(), cmp_str->end(), escape, wild_one, wild_many) ? 0 : 1;
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
Copyright (c) 2000, 2017, Oracle and/or its affiliates.
|
||||
Copyright (c) 2009, 2019, MariaDB Corporation
|
||||
Copyright (c) 2009, 2020, MariaDB Corporation
|
||||
|
||||
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
|
||||
|
@ -1099,7 +1099,7 @@ String *Item_func_reverse::val_str(String *str)
|
|||
end= res->end();
|
||||
tmp= (char *) str->end();
|
||||
#ifdef USE_MB
|
||||
if (use_mb(res->charset()))
|
||||
if (res->use_mb())
|
||||
{
|
||||
uint32 l;
|
||||
while (ptr < end)
|
||||
|
@ -1172,7 +1172,7 @@ String *Item_func_replace::val_str_internal(String *str,
|
|||
res->set_charset(collation.collation);
|
||||
|
||||
#ifdef USE_MB
|
||||
binary_cmp = ((res->charset()->state & MY_CS_BINSORT) || !use_mb(res->charset()));
|
||||
binary_cmp = ((res->charset()->state & MY_CS_BINSORT) || !res->use_mb());
|
||||
#endif
|
||||
|
||||
if (res2->length() == 0)
|
||||
|
@ -1331,7 +1331,7 @@ bool Item_func_regexp_replace::append_replacement(String *str,
|
|||
my_wc_t wc;
|
||||
int cnv, n;
|
||||
|
||||
if ((cnv= cs->cset->mb_wc(cs, &wc, (const uchar *) beg,
|
||||
if ((cnv= cs->mb_wc(&wc, (const uchar *) beg,
|
||||
(const uchar *) end)) < 1)
|
||||
break; /* End of line */
|
||||
beg+= cnv;
|
||||
|
@ -1343,7 +1343,7 @@ bool Item_func_regexp_replace::append_replacement(String *str,
|
|||
continue;
|
||||
}
|
||||
|
||||
if ((cnv= cs->cset->mb_wc(cs, &wc, (const uchar *) beg,
|
||||
if ((cnv= cs->mb_wc(&wc, (const uchar *) beg,
|
||||
(const uchar *) end)) < 1)
|
||||
break; /* End of line */
|
||||
beg+= cnv;
|
||||
|
@ -1801,7 +1801,7 @@ String *Item_func_substr_index::val_str(String *str)
|
|||
res->set_charset(collation.collation);
|
||||
|
||||
#ifdef USE_MB
|
||||
if (use_mb(res->charset()))
|
||||
if (res->use_mb())
|
||||
{
|
||||
const char *ptr= res->ptr();
|
||||
const char *strend= ptr+res->length();
|
||||
|
@ -2006,7 +2006,7 @@ String *Item_func_rtrim::val_str(String *str)
|
|||
{
|
||||
char chr=(*remove_str)[0];
|
||||
#ifdef USE_MB
|
||||
if (use_mb(collation.collation))
|
||||
if (collation.collation->use_mb())
|
||||
{
|
||||
while (ptr < end)
|
||||
{
|
||||
|
@ -2023,7 +2023,7 @@ String *Item_func_rtrim::val_str(String *str)
|
|||
{
|
||||
const char *r_ptr=remove_str->ptr();
|
||||
#ifdef USE_MB
|
||||
if (use_mb(collation.collation))
|
||||
if (collation.collation->use_mb())
|
||||
{
|
||||
loop:
|
||||
while (ptr + remove_length < end)
|
||||
|
@ -2082,7 +2082,7 @@ String *Item_func_trim::val_str(String *str)
|
|||
while (ptr+remove_length <= end && !memcmp(ptr,r_ptr,remove_length))
|
||||
ptr+=remove_length;
|
||||
#ifdef USE_MB
|
||||
if (use_mb(collation.collation))
|
||||
if (collation.collation->use_mb())
|
||||
{
|
||||
char *p=ptr;
|
||||
uint32 l;
|
||||
|
@ -2553,10 +2553,10 @@ String *Item_func_soundex::val_str(String *str)
|
|||
|
||||
for ( ; ; ) /* Skip pre-space */
|
||||
{
|
||||
if ((rc= cs->cset->mb_wc(cs, &wc, (uchar*) from, (uchar*) end)) <= 0)
|
||||
if ((rc= cs->mb_wc(&wc, (uchar*) from, (uchar*) end)) <= 0)
|
||||
return make_empty_result(); /* EOL or invalid byte sequence */
|
||||
|
||||
if (rc == 1 && cs->ctype)
|
||||
if (rc == 1 && cs->m_ctype)
|
||||
{
|
||||
/* Single byte letter found */
|
||||
if (my_isalpha(cs, *from))
|
||||
|
@ -2575,7 +2575,7 @@ String *Item_func_soundex::val_str(String *str)
|
|||
/* Multibyte letter found */
|
||||
wc= soundex_toupper(wc);
|
||||
last_ch= get_scode(wc); // Code of the first letter
|
||||
if ((rc= cs->cset->wc_mb(cs, wc, (uchar*) to, (uchar*) to_end)) <= 0)
|
||||
if ((rc= cs->wc_mb(wc, (uchar*) to, (uchar*) to_end)) <= 0)
|
||||
{
|
||||
/* Extra safety - should not really happen */
|
||||
DBUG_ASSERT(false);
|
||||
|
@ -2593,10 +2593,10 @@ String *Item_func_soundex::val_str(String *str)
|
|||
*/
|
||||
for (nchars= 1 ; ; )
|
||||
{
|
||||
if ((rc= cs->cset->mb_wc(cs, &wc, (uchar*) from, (uchar*) end)) <= 0)
|
||||
if ((rc= cs->mb_wc(&wc, (uchar*) from, (uchar*) end)) <= 0)
|
||||
break; /* EOL or invalid byte sequence */
|
||||
|
||||
if (rc == 1 && cs->ctype)
|
||||
if (rc == 1 && cs->m_ctype)
|
||||
{
|
||||
if (!my_isalpha(cs, *from++))
|
||||
continue;
|
||||
|
@ -2612,8 +2612,7 @@ String *Item_func_soundex::val_str(String *str)
|
|||
if ((ch != '0') && (ch != last_ch)) // if not skipped or double
|
||||
{
|
||||
// letter, copy to output
|
||||
if ((rc= cs->cset->wc_mb(cs, (my_wc_t) ch,
|
||||
(uchar*) to, (uchar*) to_end)) <= 0)
|
||||
if ((rc= cs->wc_mb((my_wc_t) ch, (uchar*) to, (uchar*) to_end)) <= 0)
|
||||
{
|
||||
// Extra safety - should not really happen
|
||||
DBUG_ASSERT(false);
|
||||
|
@ -2629,7 +2628,7 @@ String *Item_func_soundex::val_str(String *str)
|
|||
if (nchars < 4)
|
||||
{
|
||||
uint nbytes= (4 - nchars) * cs->mbminlen;
|
||||
cs->cset->fill(cs, to, nbytes, '0');
|
||||
cs->fill(to, nbytes, '0');
|
||||
to+= nbytes;
|
||||
}
|
||||
|
||||
|
@ -3127,7 +3126,7 @@ String *Item_func_space::val_str(String *str)
|
|||
goto err;
|
||||
str->length(tot_length);
|
||||
str->set_charset(cs);
|
||||
cs->cset->fill(cs, (char*) str->ptr(), tot_length, ' ');
|
||||
cs->fill((char*) str->ptr(), tot_length, ' ');
|
||||
return str;
|
||||
|
||||
err:
|
||||
|
@ -3461,10 +3460,10 @@ String *Item_func_conv::val_str(String *str)
|
|||
else
|
||||
{
|
||||
if (from_base < 0)
|
||||
dec= my_strntoll(res->charset(), res->ptr(), res->length(),
|
||||
dec= res->charset()->strntoll(res->ptr(), res->length(),
|
||||
-from_base, &endptr, &err);
|
||||
else
|
||||
dec= (longlong) my_strntoull(res->charset(), res->ptr(), res->length(),
|
||||
dec= (longlong) res->charset()->strntoull(res->ptr(), res->length(),
|
||||
from_base, &endptr, &err);
|
||||
}
|
||||
|
||||
|
@ -3587,7 +3586,7 @@ bool Item_func_weight_string::fix_length_and_dec()
|
|||
size_t char_length;
|
||||
char_length= ((cs->state & MY_CS_STRNXFRM_BAD_NWEIGHTS) || !nweights) ?
|
||||
args[0]->max_char_length() : nweights * cs->levels_for_order;
|
||||
max_length= (uint32)cs->coll->strnxfrmlen(cs, char_length * cs->mbmaxlen);
|
||||
max_length= (uint32) cs->strnxfrmlen(char_length * cs->mbmaxlen);
|
||||
}
|
||||
maybe_null= 1;
|
||||
return FALSE;
|
||||
|
@ -3638,7 +3637,7 @@ String *Item_func_weight_string::val_str(String *str)
|
|||
char_length= (flags & MY_STRXFRM_PAD_WITH_SPACE) ?
|
||||
res->numchars() : (res->length() / cs->mbminlen);
|
||||
}
|
||||
tmp_length= cs->coll->strnxfrmlen(cs, char_length * cs->mbmaxlen);
|
||||
tmp_length= cs->strnxfrmlen(char_length * cs->mbmaxlen);
|
||||
}
|
||||
|
||||
{
|
||||
|
@ -3657,10 +3656,9 @@ String *Item_func_weight_string::val_str(String *str)
|
|||
if (str->alloc(tmp_length))
|
||||
goto nl;
|
||||
|
||||
frm_length= cs->coll->strnxfrm(cs,
|
||||
(uchar *) str->ptr(), tmp_length,
|
||||
nweights ? nweights : (uint)tmp_length,
|
||||
(const uchar *) res->ptr(), res->length(),
|
||||
frm_length= cs->strnxfrm((char*) str->ptr(), tmp_length,
|
||||
nweights ? nweights : (uint) tmp_length,
|
||||
res->ptr(), res->length(),
|
||||
flags);
|
||||
DBUG_ASSERT(frm_length <= tmp_length);
|
||||
|
||||
|
@ -3781,7 +3779,7 @@ String *Item_func_like_range::val_str(String *str)
|
|||
goto err;
|
||||
null_value=0;
|
||||
|
||||
if (cs->coll->like_range(cs, res->ptr(), res->length(),
|
||||
if (cs->like_range(res->ptr(), res->length(),
|
||||
'\\', '_', '%', (size_t)nbytes,
|
||||
(char*) min_str.ptr(), (char*) max_str.ptr(),
|
||||
&min_len, &max_len))
|
||||
|
@ -4053,7 +4051,7 @@ String *Item_func_quote::val_str(String *str)
|
|||
to_end= (uchar*) to + new_length;
|
||||
|
||||
/* Put leading quote */
|
||||
if ((mblen= cs->cset->wc_mb(cs, '\'', (uchar *) to, to_end)) <= 0)
|
||||
if ((mblen= cs->wc_mb('\'', (uchar *) to, to_end)) <= 0)
|
||||
goto toolong;
|
||||
to+= mblen;
|
||||
|
||||
|
@ -4061,7 +4059,7 @@ String *Item_func_quote::val_str(String *str)
|
|||
{
|
||||
my_wc_t wc;
|
||||
bool escape;
|
||||
if ((mblen= cs->cset->mb_wc(cs, &wc, (uchar*) start, (uchar*) end)) <= 0)
|
||||
if ((mblen= cs->mb_wc(&wc, (uchar*) start, (uchar*) end)) <= 0)
|
||||
goto null;
|
||||
start+= mblen;
|
||||
switch (wc) {
|
||||
|
@ -4073,17 +4071,17 @@ String *Item_func_quote::val_str(String *str)
|
|||
}
|
||||
if (escape)
|
||||
{
|
||||
if ((mblen= cs->cset->wc_mb(cs, '\\', (uchar*) to, to_end)) <= 0)
|
||||
if ((mblen= cs->wc_mb('\\', (uchar*) to, to_end)) <= 0)
|
||||
goto toolong;
|
||||
to+= mblen;
|
||||
}
|
||||
if ((mblen= cs->cset->wc_mb(cs, wc, (uchar*) to, to_end)) <= 0)
|
||||
if ((mblen= cs->wc_mb(wc, (uchar*) to, to_end)) <= 0)
|
||||
goto toolong;
|
||||
to+= mblen;
|
||||
}
|
||||
|
||||
/* Put trailing quote */
|
||||
if ((mblen= cs->cset->wc_mb(cs, '\'', (uchar *) to, to_end)) <= 0)
|
||||
if ((mblen= cs->wc_mb('\'', (uchar *) to, to_end)) <= 0)
|
||||
goto toolong;
|
||||
to+= mblen;
|
||||
new_length= (uint)(to - str->ptr());
|
||||
|
@ -4991,7 +4989,7 @@ double Item_dyncol_get::val_real()
|
|||
{
|
||||
int error;
|
||||
char *end;
|
||||
double res= my_strntod(val.x.string.charset, (char*) val.x.string.value.str,
|
||||
double res= val.x.string.charset->strntod((char*) val.x.string.value.str,
|
||||
val.x.string.value.length, &end, &error);
|
||||
|
||||
if (end != (char*) val.x.string.value.str + val.x.string.value.length ||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#ifndef ITEM_SUM_INCLUDED
|
||||
#define ITEM_SUM_INCLUDED
|
||||
/* Copyright (c) 2000, 2013 Oracle and/or its affiliates.
|
||||
Copyright (c) 2008, 2013 Monty Program Ab.
|
||||
Copyright (c) 2008, 2020, MariaDB Corporation.
|
||||
|
||||
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
|
||||
|
@ -1703,7 +1703,7 @@ public:
|
|||
char *end_not_used;
|
||||
String *res;
|
||||
res=val_str(&str_value);
|
||||
return res ? my_strntod(res->charset(),(char*) res->ptr(),res->length(),
|
||||
return res ? res->charset()->strntod((char*) res->ptr(),res->length(),
|
||||
&end_not_used, &err_not_used) : 0.0;
|
||||
}
|
||||
longlong val_int()
|
||||
|
@ -1717,7 +1717,7 @@ public:
|
|||
return 0; /* Null value */
|
||||
cs= res->charset();
|
||||
end= (char*) res->ptr()+res->length();
|
||||
return cs->cset->strtoll10(cs, res->ptr(), &end, &err_not_used);
|
||||
return cs->strtoll10(res->ptr(), &end, &err_not_used);
|
||||
}
|
||||
my_decimal *val_decimal(my_decimal *dec);
|
||||
const Type_handler *type_handler() const { return string_type_handler(); }
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
Copyright (c) 2000, 2012, Oracle and/or its affiliates.
|
||||
Copyright (c) 2009, 2016, MariaDB
|
||||
Copyright (c) 2009, 2020, MariaDB
|
||||
|
||||
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
|
||||
|
@ -157,7 +157,7 @@ static bool extract_date_time(THD *thd, DATE_TIME_FORMAT *format,
|
|||
for (; ptr != end && val != val_end; ptr++)
|
||||
{
|
||||
/* Skip pre-space between each argument */
|
||||
if ((val+= cs->cset->scan(cs, val, val_end, MY_SEQ_SPACES)) >= val_end)
|
||||
if ((val+= cs->scan(val, val_end, MY_SEQ_SPACES)) >= val_end)
|
||||
break;
|
||||
|
||||
if (*ptr == '%' && ptr+1 != end)
|
||||
|
@ -259,13 +259,9 @@ static bool extract_date_time(THD *thd, DATE_TIME_FORMAT *format,
|
|||
case 'p':
|
||||
if (val_len < 2 || ! usa_time)
|
||||
goto err;
|
||||
if (!my_strnncoll(&my_charset_latin1,
|
||||
(const uchar *) val, 2,
|
||||
(const uchar *) "PM", 2))
|
||||
if (!my_charset_latin1.strnncoll(val, 2, "PM", 2))
|
||||
daypart= 12;
|
||||
else if (my_strnncoll(&my_charset_latin1,
|
||||
(const uchar *) val, 2,
|
||||
(const uchar *) "AM", 2))
|
||||
else if (my_charset_latin1.strnncoll(val, 2, "AM", 2))
|
||||
goto err;
|
||||
val+= 2;
|
||||
break;
|
||||
|
@ -2917,9 +2913,8 @@ String *Item_func_get_format::val_str_ascii(String *str)
|
|||
uint format_name_len;
|
||||
format_name_len= (uint) strlen(format_name);
|
||||
if (val_len == format_name_len &&
|
||||
!my_strnncoll(&my_charset_latin1,
|
||||
(const uchar *) val->ptr(), val_len,
|
||||
(const uchar *) format_name, val_len))
|
||||
!my_charset_latin1.strnncoll(val->ptr(), val_len,
|
||||
format_name, val_len))
|
||||
{
|
||||
const char *format_str= get_date_time_format_str(format, type);
|
||||
str->set(format_str, (uint) strlen(format_str), &my_charset_numeric);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/* Copyright (c) 2005, 2019, Oracle and/or its affiliates.
|
||||
Copyright (c) 2009, 2019, MariaDB
|
||||
Copyright (c) 2009, 2020, MariaDB
|
||||
|
||||
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
|
||||
|
@ -507,7 +507,7 @@ public:
|
|||
{
|
||||
char *end;
|
||||
int err;
|
||||
double add= my_strntod(collation.collation, (char*) node->beg,
|
||||
double add= collation.collation->strntod((char*) node->beg,
|
||||
node->end - node->beg, &end, &err);
|
||||
if (!err)
|
||||
sum+= add;
|
||||
|
@ -1442,14 +1442,14 @@ my_xpath_lex_scan(MY_XPATH *xpath,
|
|||
}
|
||||
|
||||
// Check ident, or a function call, or a keyword
|
||||
if ((length= xpath->cs->cset->ctype(xpath->cs, &ctype,
|
||||
if ((length= xpath->cs->ctype(&ctype,
|
||||
(const uchar*) beg,
|
||||
(const uchar*) end)) > 0 &&
|
||||
((ctype & (_MY_L | _MY_U)) || *beg == '_'))
|
||||
{
|
||||
// scan untill the end of the idenfitier
|
||||
for (beg+= length;
|
||||
(length= xpath->cs->cset->ctype(xpath->cs, &ctype,
|
||||
(length= xpath->cs->ctype(&ctype,
|
||||
(const uchar*) beg,
|
||||
(const uchar*) end)) > 0 &&
|
||||
((ctype & (_MY_L | _MY_U | _MY_NMR)) ||
|
||||
|
|
23
sql/key.cc
23
sql/key.cc
|
@ -1,5 +1,5 @@
|
|||
/* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
Copyright (c) 2018, MariaDB
|
||||
Copyright (c) 2018, 2020, MariaDB
|
||||
|
||||
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
|
||||
|
@ -159,7 +159,7 @@ void key_copy(uchar *to_key, const uchar *from_record, KEY *key_info,
|
|||
CHARSET_INFO *cs= field->charset();
|
||||
uint bytes= field->get_key_image(to_key, length, Field::itRAW);
|
||||
if (bytes < length)
|
||||
cs->cset->fill(cs, (char*) to_key + bytes, length - bytes, ' ');
|
||||
cs->fill((char*) to_key + bytes, length - bytes, ' ');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -324,12 +324,10 @@ bool key_cmp_if_same(TABLE *table,const uchar *key,uint idx,uint key_length)
|
|||
const uchar *pos= table->record[0] + key_part->offset;
|
||||
if (length > char_length)
|
||||
{
|
||||
char_length= my_charpos(cs, pos, pos + length, char_length);
|
||||
char_length= cs->charpos(pos, pos + length, char_length);
|
||||
set_if_smaller(char_length, length);
|
||||
}
|
||||
if (cs->coll->strnncollsp(cs,
|
||||
(const uchar*) key, length,
|
||||
(const uchar*) pos, char_length))
|
||||
if (cs->strnncollsp(key, length, pos, char_length))
|
||||
return 1;
|
||||
continue;
|
||||
}
|
||||
|
@ -387,7 +385,7 @@ void field_unpack(String *to, Field *field, const uchar *rec, uint max_length,
|
|||
Align, returning not more than "char_length" characters.
|
||||
*/
|
||||
size_t charpos, char_length= max_length / cs->mbmaxlen;
|
||||
if ((charpos= my_charpos(cs, tmp.ptr(),
|
||||
if ((charpos= cs->charpos(tmp.ptr(),
|
||||
tmp.ptr() + tmp.length(),
|
||||
char_length)) < tmp.length())
|
||||
tmp.length(charpos);
|
||||
|
@ -757,12 +755,12 @@ ulong key_hashnr(KEY *key_info, uint used_key_parts, const uchar *key)
|
|||
{
|
||||
if (cs->mbmaxlen > 1)
|
||||
{
|
||||
size_t char_length= my_charpos(cs, pos + pack_length,
|
||||
size_t char_length= cs->charpos(pos + pack_length,
|
||||
pos + pack_length + length,
|
||||
length / cs->mbmaxlen);
|
||||
set_if_smaller(length, char_length);
|
||||
}
|
||||
cs->coll->hash_sort(cs, pos+pack_length, length, &nr, &nr2);
|
||||
cs->hash_sort(pos+pack_length, length, &nr, &nr2);
|
||||
key+= pack_length;
|
||||
}
|
||||
else
|
||||
|
@ -871,18 +869,17 @@ bool key_buf_cmp(KEY *key_info, uint used_key_parts,
|
|||
size_t byte_len1= length1, byte_len2= length2;
|
||||
if (cs->mbmaxlen > 1)
|
||||
{
|
||||
size_t char_length1= my_charpos(cs, pos1 + pack_length,
|
||||
size_t char_length1= cs->charpos(pos1 + pack_length,
|
||||
pos1 + pack_length + length1,
|
||||
length1 / cs->mbmaxlen);
|
||||
size_t char_length2= my_charpos(cs, pos2 + pack_length,
|
||||
size_t char_length2= cs->charpos(pos2 + pack_length,
|
||||
pos2 + pack_length + length2,
|
||||
length2 / cs->mbmaxlen);
|
||||
set_if_smaller(length1, char_length1);
|
||||
set_if_smaller(length2, char_length2);
|
||||
}
|
||||
if (length1 != length2 ||
|
||||
cs->coll->strnncollsp(cs,
|
||||
pos1 + pack_length, byte_len1,
|
||||
cs->strnncollsp(pos1 + pack_length, byte_len1,
|
||||
pos2 + pack_length, byte_len2))
|
||||
return TRUE;
|
||||
key1+= pack_length; key2+= pack_length;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/* Copyright (c) 2000, 2015, Oracle and/or its affiliates.
|
||||
Copyright (c) 2008, 2019, MariaDB Corporation.
|
||||
Copyright (c) 2008, 2020, MariaDB Corporation.
|
||||
|
||||
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
|
||||
|
@ -8850,9 +8850,8 @@ bool is_secure_file_path(char *path)
|
|||
}
|
||||
else
|
||||
{
|
||||
if (files_charset_info->coll->strnncoll(files_charset_info,
|
||||
(uchar *) buff2, strlen(buff2),
|
||||
(uchar *) opt_secure_file_priv,
|
||||
if (files_charset_info->strnncoll(buff2, strlen(buff2),
|
||||
opt_secure_file_priv,
|
||||
opt_secure_file_priv_len,
|
||||
TRUE))
|
||||
return FALSE;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/* Copyright (c) 2006, 2016, Oracle and/or its affiliates.
|
||||
Copyright (c) 2010, 2019, MariaDB Corporation.
|
||||
Copyright (c) 2010, 2020, MariaDB Corporation.
|
||||
|
||||
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
|
||||
|
@ -788,8 +788,7 @@ extern "C" void unireg_clear(int exit_code);
|
|||
inline void table_case_convert(char * name, uint length)
|
||||
{
|
||||
if (lower_case_table_names)
|
||||
files_charset_info->cset->casedn(files_charset_info,
|
||||
name, length, name, length);
|
||||
files_charset_info->casedn(name, length, name, length);
|
||||
}
|
||||
|
||||
extern void set_server_version(char *buf, size_t size);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/* Copyright (c) 2000, 2015, Oracle and/or its affiliates.
|
||||
Copyright (c) 2008, 2019, MariaDB
|
||||
Copyright (c) 2008, 2020, MariaDB
|
||||
|
||||
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
|
||||
|
@ -8604,8 +8604,7 @@ Item_func_like::get_mm_leaf(RANGE_OPT_PARAM *param,
|
|||
|
||||
size_t min_length, max_length;
|
||||
field_length-= maybe_null;
|
||||
if (my_like_range(field->charset(),
|
||||
res->ptr(), res->length(),
|
||||
if (field->charset()->like_range(res->ptr(), res->length(),
|
||||
escape, wild_one, wild_many,
|
||||
field_length,
|
||||
(char*) min_str + offset,
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
#define PROCEDURE_INCLUDED
|
||||
|
||||
/* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
Copyright (c) 2009, 2020, MariaDB Corporation.
|
||||
|
||||
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
|
||||
|
@ -88,7 +89,7 @@ public:
|
|||
{
|
||||
int err_not_used;
|
||||
char *end_not_used;
|
||||
value= my_strntod(cs,(char*) str,length, &end_not_used, &err_not_used);
|
||||
value= cs->strntod((char*) str,length, &end_not_used, &err_not_used);
|
||||
}
|
||||
double val_real() { return value; }
|
||||
longlong val_int() { return (longlong) value; }
|
||||
|
@ -116,7 +117,7 @@ public:
|
|||
void set(double nr) { value=(longlong) nr; }
|
||||
void set(longlong nr) { value=nr; }
|
||||
void set(const char *str,uint length, CHARSET_INFO *cs)
|
||||
{ int err; value=my_strntoll(cs,str,length,10,NULL,&err); }
|
||||
{ int err; value= cs->strntoll(str,length,10,NULL,&err); }
|
||||
double val_real() { return (double) value; }
|
||||
longlong val_int() { return value; }
|
||||
String *val_str(String *s) { s->set(value, default_charset()); return s; }
|
||||
|
@ -140,14 +141,14 @@ public:
|
|||
int err_not_used;
|
||||
char *end_not_used;
|
||||
CHARSET_INFO *cs= str_value.charset();
|
||||
return my_strntod(cs, (char*) str_value.ptr(), str_value.length(),
|
||||
return cs->strntod((char*) str_value.ptr(), str_value.length(),
|
||||
&end_not_used, &err_not_used);
|
||||
}
|
||||
longlong val_int()
|
||||
{
|
||||
int err;
|
||||
CHARSET_INFO *cs=str_value.charset();
|
||||
return my_strntoll(cs,str_value.ptr(),str_value.length(),10,NULL,&err);
|
||||
return cs->strntoll(str_value.ptr(),str_value.length(),10,NULL,&err);
|
||||
}
|
||||
String *val_str(String*)
|
||||
{
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
/* Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
Copyright (c) 2009, 2020, MariaDB Corporation.
|
||||
|
||||
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
|
||||
|
@ -595,10 +596,10 @@ Rpl_filter::find_wild(DYNAMIC_ARRAY *a, const char* key, int len)
|
|||
{
|
||||
TABLE_RULE_ENT* e ;
|
||||
get_dynamic(a, (uchar*)&e, i);
|
||||
if (!my_wildcmp(system_charset_info, key, key_end,
|
||||
if (!system_charset_info->wildcmp(key, key_end,
|
||||
(const char*)e->db,
|
||||
(const char*)(e->db + e->key_len),
|
||||
'\\',wild_one,wild_many))
|
||||
'\\', wild_one, wild_many))
|
||||
return e;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/* Copyright (c) 2000, 2017, Oracle and/or its affiliates.
|
||||
Copyright (c) 2009, 2017, MariaDB Corporation
|
||||
Copyright (c) 2009, 2020, MariaDB Corporation
|
||||
|
||||
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
|
||||
|
@ -934,7 +934,7 @@ bool init_slave_skip_errors(const char* arg)
|
|||
use_slave_mask= 1;
|
||||
for (;my_isspace(system_charset_info,*arg);++arg)
|
||||
/* empty */;
|
||||
if (!my_strnncoll(system_charset_info,(uchar*)arg,4,(const uchar*)"all",4))
|
||||
if (!system_charset_info->strnncoll((uchar*)arg,4,(const uchar*)"all",4))
|
||||
{
|
||||
bitmap_set_all(&slave_error_mask);
|
||||
goto end;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
Copyright (c) 2002, 2018, Oracle and/or its affiliates.
|
||||
Copyright (c) 2009, 2018, MariaDB
|
||||
Copyright (c) 2009, 2020, MariaDB
|
||||
|
||||
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
|
||||
|
@ -1283,9 +1283,8 @@ Sp_handler::sp_create_routine(THD *thd, const sp_head *sp) const
|
|||
goto done;
|
||||
}
|
||||
|
||||
if (system_charset_info->cset->numchars(system_charset_info,
|
||||
sp->m_name.str,
|
||||
sp->m_name.str+sp->m_name.length) >
|
||||
if (system_charset_info->numchars(sp->m_name.str,
|
||||
sp->m_name.str + sp->m_name.length) >
|
||||
table->field[MYSQL_PROC_FIELD_NAME]->char_length())
|
||||
{
|
||||
my_error(ER_TOO_LONG_IDENT, MYF(0), sp->m_name.str);
|
||||
|
|
6
sql/sp.h
6
sql/sp.h
|
@ -1,5 +1,6 @@
|
|||
/* -*- C++ -*- */
|
||||
/* Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
Copyright (c) 2009, 2020, MariaDB Corporation.
|
||||
|
||||
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
|
||||
|
@ -135,9 +136,8 @@ public:
|
|||
static bool eq_routine_name(const LEX_CSTRING &name1,
|
||||
const LEX_CSTRING &name2)
|
||||
{
|
||||
return my_strnncoll(system_charset_info,
|
||||
(const uchar *) name1.str, name1.length,
|
||||
(const uchar *) name2.str, name2.length) == 0;
|
||||
return system_charset_info->strnncoll(name1.str, name1.length,
|
||||
name2.str, name2.length) == 0;
|
||||
}
|
||||
const char *type_str() const { return type_lex_cstring().str; }
|
||||
virtual const char *show_create_routine_col1_caption() const
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
/* Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
Copyright (c) 2009, 2020, MariaDB Corporation.
|
||||
|
||||
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
|
||||
|
@ -208,9 +209,8 @@ sp_variable *sp_pcontext::find_variable(const LEX_CSTRING *name,
|
|||
{
|
||||
sp_variable *p= m_vars.at(i);
|
||||
|
||||
if (my_strnncoll(system_charset_info,
|
||||
(const uchar *)name->str, name->length,
|
||||
(const uchar *)p->name.str, p->name.length) == 0)
|
||||
if (system_charset_info->strnncoll(name->str, name->length,
|
||||
p->name.str, p->name.length) == 0)
|
||||
{
|
||||
return p;
|
||||
}
|
||||
|
@ -624,9 +624,8 @@ const sp_pcursor *sp_pcontext::find_cursor(const LEX_CSTRING *name,
|
|||
{
|
||||
LEX_CSTRING n= m_cursors.at(i);
|
||||
|
||||
if (my_strnncoll(system_charset_info,
|
||||
(const uchar *) name->str, name->length,
|
||||
(const uchar *) n.str, n.length) == 0)
|
||||
if (system_charset_info->strnncoll(name->str, name->length,
|
||||
n.str, n.length) == 0)
|
||||
{
|
||||
*poff= m_cursor_offset + i;
|
||||
return &m_cursors.at(i);
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
/* -*- C++ -*- */
|
||||
/* Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
Copyright (c) 2009, 2020, MariaDB Corporation.
|
||||
|
||||
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
|
||||
|
@ -260,9 +261,8 @@ public:
|
|||
}
|
||||
bool eq_name(const LEX_CSTRING *str) const
|
||||
{
|
||||
return my_strnncoll(system_charset_info,
|
||||
(const uchar *) name.str, name.length,
|
||||
(const uchar *) str->str, str->length) == 0;
|
||||
return system_charset_info->strnncoll(name.str, name.length,
|
||||
str->str, str->length) == 0;
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
Copyright (c) 2002, 2013, Oracle and/or its affiliates.
|
||||
Copyright (c) 2011, 2013, Monty Program Ab.
|
||||
Copyright (c) 2011, 2020, MariaDB Corporation.
|
||||
|
||||
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
|
||||
|
@ -149,9 +149,8 @@ Geometry::Class_info *Geometry::find_class(const char *name, size_t len)
|
|||
{
|
||||
if (*cur_rt &&
|
||||
((*cur_rt)->m_name.length == len) &&
|
||||
(my_strnncoll(&my_charset_latin1,
|
||||
(const uchar*) (*cur_rt)->m_name.str, len,
|
||||
(const uchar*) name, len) == 0))
|
||||
(my_charset_latin1.strnncoll((*cur_rt)->m_name.str, len,
|
||||
name, len) == 0))
|
||||
return *cur_rt;
|
||||
}
|
||||
return 0;
|
||||
|
@ -455,7 +454,7 @@ Geometry *Geometry::create_from_json(Geometry_buffer *buffer,
|
|||
goto create_geom;
|
||||
}
|
||||
else if (je->value_len == feature_coll_type_len &&
|
||||
my_strnncoll(&my_charset_latin1, je->value, je->value_len,
|
||||
my_charset_latin1.strnncoll(je->value, je->value_len,
|
||||
feature_coll_type, feature_coll_type_len) == 0)
|
||||
{
|
||||
/*
|
||||
|
@ -467,7 +466,7 @@ Geometry *Geometry::create_from_json(Geometry_buffer *buffer,
|
|||
fcoll_type_found= 1;
|
||||
}
|
||||
else if (je->value_len == feature_type_len &&
|
||||
my_strnncoll(&my_charset_latin1, je->value, je->value_len,
|
||||
my_charset_latin1.strnncoll(je->value, je->value_len,
|
||||
feature_type, feature_type_len) == 0)
|
||||
{
|
||||
if (geometry_start)
|
||||
|
@ -860,8 +859,7 @@ static int read_point_from_json(json_engine_t *je, bool er_on_3D,
|
|||
goto bad_coordinates;
|
||||
|
||||
d= (n_coord == 0) ? x : ((n_coord == 1) ? y : &tmp);
|
||||
*d= my_strntod(je->s.cs, (char *) je->value,
|
||||
je->value_len, &endptr, &err);
|
||||
*d= je->s.cs->strntod((char *) je->value, je->value_len, &endptr, &err);
|
||||
if (err)
|
||||
goto bad_coordinates;
|
||||
n_coord++;
|
||||
|
@ -2989,9 +2987,7 @@ bool Gis_geometry_collection::init_from_wkt(Gis_read_stream *trs, String *wkb)
|
|||
return 1;
|
||||
|
||||
if (next_word.length != 5 ||
|
||||
(my_strnncoll(&my_charset_latin1,
|
||||
(const uchar*) "empty", 5,
|
||||
(const uchar*) next_word.str, 5) != 0))
|
||||
(my_charset_latin1.strnncoll("empty", 5, next_word.str, 5) != 0))
|
||||
{
|
||||
for (;;)
|
||||
{
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/* Copyright (c) 2000, 2018, Oracle and/or its affiliates.
|
||||
Copyright (c) 2009, 2019, MariaDB Corporation.
|
||||
Copyright (c) 2009, 2020, MariaDB Corporation.
|
||||
|
||||
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
|
||||
|
@ -4170,7 +4170,7 @@ bool hostname_requires_resolving(const char *hostname)
|
|||
|
||||
if (hostname == my_localhost ||
|
||||
(hostname_len == localhost_len &&
|
||||
!my_strnncoll(system_charset_info,
|
||||
!system_charset_info->strnncoll(
|
||||
(const uchar *) hostname, hostname_len,
|
||||
(const uchar *) my_localhost, strlen(my_localhost))))
|
||||
{
|
||||
|
@ -12765,7 +12765,7 @@ static bool find_mpvio_user(MPVIO_EXT *mpvio)
|
|||
*/
|
||||
ulong nr1=1, nr2=4;
|
||||
CHARSET_INFO *cs= &my_charset_latin1;
|
||||
cs->coll->hash_sort(cs, (uchar*) sctx->user, strlen(sctx->user), &nr1, &nr2);
|
||||
cs->hash_sort((uchar*) sctx->user, strlen(sctx->user), &nr1, &nr2);
|
||||
|
||||
mysql_mutex_lock(&acl_cache->lock);
|
||||
if (!acl_users.elements)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
Copyright (c) 2000, 2015, Oracle and/or its affiliates.
|
||||
Copyright (c) 2008, 2019, MariaDB Corporation.
|
||||
Copyright (c) 2008, 2020, MariaDB Corporation.
|
||||
|
||||
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
|
||||
|
@ -3395,7 +3395,7 @@ int select_export::send_data(List<Item> &items)
|
|||
pos++)
|
||||
{
|
||||
#ifdef USE_MB
|
||||
if (use_mb(res_charset))
|
||||
if (res_charset->use_mb())
|
||||
{
|
||||
int l;
|
||||
if ((l=my_ismbchar(res_charset, pos, end)))
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
Copyright (c) 2000, 2016, Oracle and/or its affiliates.
|
||||
Copyright (c) 2009, 2019, MariaDB Corporation.
|
||||
Copyright (c) 2009, 2020, MariaDB Corporation.
|
||||
|
||||
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
|
||||
|
@ -3790,7 +3790,7 @@ public:
|
|||
const char *src, size_t src_length);
|
||||
/*
|
||||
If either "dstcs" or "srccs" is &my_charset_bin,
|
||||
then performs native copying using cs->cset->copy_fix().
|
||||
then performs native copying using copy_fix().
|
||||
Otherwise, performs Unicode conversion using convert_fix().
|
||||
*/
|
||||
bool copy_fix(CHARSET_INFO *dstcs, LEX_STRING *dst,
|
||||
|
@ -6999,12 +6999,10 @@ public:
|
|||
return
|
||||
m_db.length == other->m_db.length &&
|
||||
m_name.length == other->m_name.length &&
|
||||
!my_strnncoll(cs,
|
||||
(const uchar *) m_db.str, m_db.length,
|
||||
(const uchar *) other->m_db.str, other->m_db.length) &&
|
||||
!my_strnncoll(cs,
|
||||
(const uchar *) m_name.str, m_name.length,
|
||||
(const uchar *) other->m_name.str, other->m_name.length);
|
||||
!cs->strnncoll(m_db.str, m_db.length,
|
||||
other->m_db.str, other->m_db.length) &&
|
||||
!cs->strnncoll(m_name.str, m_name.length,
|
||||
other->m_name.str, other->m_name.length);
|
||||
}
|
||||
void copy(MEM_ROOT *mem_root, const LEX_CSTRING &db,
|
||||
const LEX_CSTRING &name);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/* Copyright (c) 2000, 2014, Oracle and/or its affiliates.
|
||||
Copyright (c) 2009, 2019, MariaDB Corporation
|
||||
Copyright (c) 2009, 2020, MariaDB Corporation
|
||||
|
||||
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
|
||||
|
@ -1535,7 +1535,7 @@ my_unescape(CHARSET_INFO *cs, char *to, const char *str, const char *end,
|
|||
{
|
||||
#ifdef USE_MB
|
||||
int l;
|
||||
if (use_mb(cs) && (l= my_ismbchar(cs, str, end)))
|
||||
if (cs->use_mb() && (l= my_ismbchar(cs, str, end)))
|
||||
{
|
||||
while (l--)
|
||||
*to++ = *str++;
|
||||
|
@ -1613,7 +1613,7 @@ bool Lex_input_stream::get_text(Lex_string_with_metadata_st *dst, uint sep,
|
|||
#ifdef USE_MB
|
||||
{
|
||||
int l;
|
||||
if (use_mb(cs) &&
|
||||
if (cs->use_mb() &&
|
||||
(l = my_ismbchar(cs,
|
||||
get_ptr() -1,
|
||||
get_end_of_query()))) {
|
||||
|
@ -2644,12 +2644,12 @@ int Lex_input_stream::scan_ident_start(THD *thd, Lex_ident_cli_st *str)
|
|||
const uchar *const ident_map= cs->ident_map;
|
||||
DBUG_ASSERT(m_tok_start <= m_ptr);
|
||||
|
||||
if (use_mb(cs))
|
||||
if (cs->use_mb())
|
||||
{
|
||||
is_8bit= true;
|
||||
while (ident_map[c= yyGet()])
|
||||
{
|
||||
int char_length= my_charlen(cs, get_ptr() - 1, get_end_of_query());
|
||||
int char_length= cs->charlen(get_ptr() - 1, get_end_of_query());
|
||||
if (char_length <= 0)
|
||||
break;
|
||||
skip_binary(char_length - 1);
|
||||
|
@ -2687,10 +2687,10 @@ int Lex_input_stream::scan_ident_middle(THD *thd, Lex_ident_cli_st *str,
|
|||
bool resolve_introducer= true;
|
||||
DBUG_ASSERT(m_ptr == m_tok_start + 1); // m_ptr points to the second byte
|
||||
|
||||
if (use_mb(cs))
|
||||
if (cs->use_mb())
|
||||
{
|
||||
is_8bit= true;
|
||||
int char_length= my_charlen(cs, get_ptr() - 1, get_end_of_query());
|
||||
int char_length= cs->charlen(get_ptr() - 1, get_end_of_query());
|
||||
if (char_length <= 0)
|
||||
{
|
||||
*st= MY_LEX_CHAR;
|
||||
|
@ -2700,7 +2700,7 @@ int Lex_input_stream::scan_ident_middle(THD *thd, Lex_ident_cli_st *str,
|
|||
|
||||
while (ident_map[c= yyGet()])
|
||||
{
|
||||
char_length= my_charlen(cs, get_ptr() - 1, get_end_of_query());
|
||||
char_length= cs->charlen(get_ptr() - 1, get_end_of_query());
|
||||
if (char_length <= 0)
|
||||
break;
|
||||
if (char_length > 1 || (c & 0x80))
|
||||
|
@ -2789,7 +2789,7 @@ int Lex_input_stream::scan_ident_delimited(THD *thd,
|
|||
|
||||
while ((c= yyGet()))
|
||||
{
|
||||
int var_length= my_charlen(cs, get_ptr() - 1, get_end_of_query());
|
||||
int var_length= cs->charlen(get_ptr() - 1, get_end_of_query());
|
||||
if (var_length == 1)
|
||||
{
|
||||
if (c == quote_char)
|
||||
|
@ -7940,11 +7940,11 @@ Item *LEX::create_item_ident(THD *thd,
|
|||
|
||||
if ((thd->variables.sql_mode & MODE_ORACLE) && b.length == 7)
|
||||
{
|
||||
if (!my_strnncoll(system_charset_info,
|
||||
if (!system_charset_info->strnncoll(
|
||||
(const uchar *) b.str, 7,
|
||||
(const uchar *) "NEXTVAL", 7))
|
||||
return create_item_func_nextval(thd, &null_clex_str, &a);
|
||||
else if (!my_strnncoll(system_charset_info,
|
||||
else if (!system_charset_info->strnncoll(
|
||||
(const uchar *) b.str, 7,
|
||||
(const uchar *) "CURRVAL", 7))
|
||||
return create_item_func_lastval(thd, &null_clex_str, &a);
|
||||
|
@ -7963,11 +7963,11 @@ Item *LEX::create_item_ident(THD *thd,
|
|||
Lex_ident_sys() : *a;
|
||||
if ((thd->variables.sql_mode & MODE_ORACLE) && c->length == 7)
|
||||
{
|
||||
if (!my_strnncoll(system_charset_info,
|
||||
if (!system_charset_info->strnncoll(
|
||||
(const uchar *) c->str, 7,
|
||||
(const uchar *) "NEXTVAL", 7))
|
||||
return create_item_func_nextval(thd, a, b);
|
||||
else if (!my_strnncoll(system_charset_info,
|
||||
else if (!system_charset_info->strnncoll(
|
||||
(const uchar *) c->str, 7,
|
||||
(const uchar *) "CURRVAL", 7))
|
||||
return create_item_func_lastval(thd, a, b);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
Copyright (c) 2000, 2016, Oracle and/or its affiliates.
|
||||
Copyright (c) 2010, 2018, MariaDB Corporation.
|
||||
Copyright (c) 2010, 2020, MariaDB Corporation.
|
||||
|
||||
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
|
||||
|
@ -190,7 +190,7 @@ class READ_INFO: public Load_data_param
|
|||
bool read_mbtail(String *str)
|
||||
{
|
||||
int chlen;
|
||||
if ((chlen= my_charlen(charset(), str->end() - 1, str->end())) == 1)
|
||||
if ((chlen= charset()->charlen(str->end() - 1, str->end())) == 1)
|
||||
return false; // Single byte character found
|
||||
for (uint32 length0= str->length() - 1 ; MY_CS_IS_TOOSMALL(chlen); )
|
||||
{
|
||||
|
@ -201,7 +201,7 @@ class READ_INFO: public Load_data_param
|
|||
return true; // EOF
|
||||
}
|
||||
str->append(chr);
|
||||
chlen= my_charlen(charset(), str->ptr() + length0, str->end());
|
||||
chlen= charset()->charlen(str->ptr() + length0, str->end());
|
||||
if (chlen == MY_CS_ILSEQ)
|
||||
{
|
||||
/**
|
||||
|
@ -1587,7 +1587,7 @@ int READ_INFO::read_field()
|
|||
}
|
||||
}
|
||||
data.append(chr);
|
||||
if (use_mb(charset()) && read_mbtail(&data))
|
||||
if (charset()->use_mb() && read_mbtail(&data))
|
||||
goto found_eof;
|
||||
}
|
||||
/*
|
||||
|
@ -1686,8 +1686,8 @@ int READ_INFO::next_line()
|
|||
if (getbyte(&buf[0]))
|
||||
return 1; // EOF
|
||||
|
||||
if (use_mb(charset()) &&
|
||||
(chlen= my_charlen(charset(), buf, buf + 1)) != 1)
|
||||
if (charset()->use_mb() &&
|
||||
(chlen= charset()->charlen(buf, buf + 1)) != 1)
|
||||
{
|
||||
uint i;
|
||||
for (i= 1; MY_CS_IS_TOOSMALL(chlen); )
|
||||
|
@ -1696,7 +1696,7 @@ int READ_INFO::next_line()
|
|||
DBUG_ASSERT(chlen != 1);
|
||||
if (getbyte(&buf[i++]))
|
||||
return 1; // EOF
|
||||
chlen= my_charlen(charset(), buf, buf + i);
|
||||
chlen= charset()->charlen(buf, buf + i);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1867,7 +1867,7 @@ int READ_INFO::read_value(int delim, String *val)
|
|||
else
|
||||
{
|
||||
val->append(chr);
|
||||
if (use_mb(charset()) && read_mbtail(val))
|
||||
if (charset()->use_mb() && read_mbtail(val))
|
||||
return my_b_EOF;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/* Copyright (c) 2000, 2017, Oracle and/or its affiliates.
|
||||
Copyright (c) 2008, 2019, MariaDB
|
||||
Copyright (c) 2008, 2020, MariaDB
|
||||
|
||||
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
|
||||
|
@ -10133,9 +10133,9 @@ int path_starts_from_data_home_dir(const char *path)
|
|||
|
||||
if (lower_case_file_system)
|
||||
{
|
||||
if (!my_strnncoll(default_charset_info, (const uchar*) path,
|
||||
if (!default_charset_info->strnncoll(path,
|
||||
mysql_unpacked_real_data_home_len,
|
||||
(const uchar*) mysql_unpacked_real_data_home,
|
||||
mysql_unpacked_real_data_home,
|
||||
mysql_unpacked_real_data_home_len))
|
||||
{
|
||||
DBUG_PRINT("error", ("Path is part of mysql_real_data_home"));
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/* Copyright (c) 2005, 2017, Oracle and/or its affiliates.
|
||||
Copyright (c) 2009, 2018, MariaDB
|
||||
Copyright (c) 2009, 2020, MariaDB
|
||||
|
||||
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
|
||||
|
@ -1864,7 +1864,7 @@ bool field_is_partition_charset(Field *field)
|
|||
DESCRIPTION
|
||||
We will check in this routine that the fields of the partition functions
|
||||
do not contain unallowed parts. It can also be used to check if there
|
||||
are fields that require special care by calling my_strnxfrm before
|
||||
are fields that require special care by calling strnxfrm before
|
||||
calling the functions to calculate partition id.
|
||||
*/
|
||||
|
||||
|
@ -2951,7 +2951,7 @@ static void copy_to_part_field_buffers(Field **ptr,
|
|||
if (field->type() == MYSQL_TYPE_VARCHAR)
|
||||
{
|
||||
uint len_bytes= ((Field_varstring*)field)->length_bytes;
|
||||
my_strnxfrm(cs, field_buf + len_bytes, max_len,
|
||||
cs->strnxfrm(field_buf + len_bytes, max_len,
|
||||
field->ptr + len_bytes, data_len);
|
||||
if (len_bytes == 1)
|
||||
*field_buf= (uchar) data_len;
|
||||
|
@ -2960,7 +2960,7 @@ static void copy_to_part_field_buffers(Field **ptr,
|
|||
}
|
||||
else
|
||||
{
|
||||
my_strnxfrm(cs, field_buf, max_len,
|
||||
cs->strnxfrm(field_buf, max_len,
|
||||
field->ptr, max_len);
|
||||
}
|
||||
field->ptr= field_buf;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
Copyright (c) 2005, 2018, Oracle and/or its affiliates.
|
||||
Copyright (c) 2010, 2018, MariaDB Corporation
|
||||
Copyright (c) 2010, 2020, MariaDB Corporation
|
||||
|
||||
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
|
||||
|
@ -454,9 +454,8 @@ static struct st_plugin_dl *plugin_dl_find(const LEX_CSTRING *dl)
|
|||
{
|
||||
tmp= *dynamic_element(&plugin_dl_array, i, struct st_plugin_dl **);
|
||||
if (tmp->ref_count &&
|
||||
! my_strnncoll(files_charset_info,
|
||||
(const uchar *)dl->str, dl->length,
|
||||
(const uchar *)tmp->dl.str, tmp->dl.length))
|
||||
! files_charset_info->strnncoll(dl->str, dl->length,
|
||||
tmp->dl.str, tmp->dl.length))
|
||||
DBUG_RETURN(tmp);
|
||||
}
|
||||
DBUG_RETURN(0);
|
||||
|
@ -1128,9 +1127,8 @@ static enum install_status plugin_add(MEM_ROOT *tmp_root, bool if_not_exists,
|
|||
tmp.plugin_dl->mariaversion == 0))
|
||||
continue; // unsupported plugin type
|
||||
|
||||
if (name->str && my_strnncoll(system_charset_info,
|
||||
(const uchar *)name->str, name->length,
|
||||
(const uchar *)tmp.name.str, tmp.name.length))
|
||||
if (name->str && system_charset_info->strnncoll(name->str, name->length,
|
||||
tmp.name.str, tmp.name.length))
|
||||
continue; // plugin name doesn't match
|
||||
|
||||
if (!name->str &&
|
||||
|
@ -1634,8 +1632,7 @@ int plugin_init(int *argc, char **argv, int flags)
|
|||
for (plugin= *builtins; plugin->info; plugin++)
|
||||
{
|
||||
if (opt_ignore_builtin_innodb &&
|
||||
!my_strnncoll(&my_charset_latin1, (const uchar*) plugin->name,
|
||||
6, (const uchar*) "InnoDB", 6))
|
||||
!my_charset_latin1.strnncoll(plugin->name, 6, "InnoDB", 6))
|
||||
continue;
|
||||
|
||||
bzero(&tmp, sizeof(tmp));
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/* Copyright (c) 2000, 2018, Oracle and/or its affiliates.
|
||||
Copyright (c) 2008, 2019, MariaDB Corporation
|
||||
Copyright (c) 2008, 2020, MariaDB Corporation
|
||||
|
||||
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
|
||||
|
@ -3506,7 +3506,7 @@ static bool get_string_parameter(char *to, const char *from, size_t length,
|
|||
if (from) // Empty paramaters allowed
|
||||
{
|
||||
size_t from_length= strlen(from);
|
||||
size_t from_numchars= cs->cset->numchars(cs, from, from + from_length);
|
||||
size_t from_numchars= cs->numchars(from, from + from_length);
|
||||
if (from_numchars > length / cs->mbmaxlen)
|
||||
{
|
||||
my_error(ER_WRONG_STRING_LENGTH, MYF(0), from, name,
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/* Copyright (c) 2000, 2016, Oracle and/or its affiliates.
|
||||
Copyright (c) 2009, 2019, MariaDB Corporation.
|
||||
Copyright (c) 2009, 2020, MariaDB Corporation.
|
||||
|
||||
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
|
||||
|
@ -19086,10 +19086,8 @@ bool Virtual_tmp_table::sp_find_field_by_name(uint *idx,
|
|||
for (uint i= 0; (f= field[i]); i++)
|
||||
{
|
||||
// Use the same comparison style with sp_context::find_variable()
|
||||
if (!my_strnncoll(system_charset_info,
|
||||
(const uchar *) f->field_name.str,
|
||||
f->field_name.length,
|
||||
(const uchar *) name.str, name.length))
|
||||
if (!system_charset_info->strnncoll(f->field_name.str, f->field_name.length,
|
||||
name.str, name.length))
|
||||
{
|
||||
*idx= i;
|
||||
return false;
|
||||
|
@ -27163,7 +27161,7 @@ Index_hint::print(THD *thd, String *str)
|
|||
str->append (STRING_WITH_LEN(" ("));
|
||||
if (key_name.length)
|
||||
{
|
||||
if (thd && !my_strnncoll(system_charset_info,
|
||||
if (thd && !system_charset_info->strnncoll(
|
||||
(const uchar *)key_name.str, key_name.length,
|
||||
(const uchar *)primary_key_name,
|
||||
strlen(primary_key_name)))
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/* Copyright (c) 2000, 2015, Oracle and/or its affiliates.
|
||||
Copyright (c) 2009, 2019, MariaDB
|
||||
Copyright (c) 2009, 2020, MariaDB
|
||||
|
||||
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
|
||||
|
@ -346,15 +346,14 @@ int fill_all_plugins(THD *thd, TABLE_LIST *tables, COND *cond)
|
|||
{
|
||||
if (lookup.wild_db_value)
|
||||
{
|
||||
if (my_wildcmp(files_charset_info, dl.str, dlend, wstr, wend,
|
||||
if (files_charset_info->wildcmp(dl.str, dlend, wstr, wend,
|
||||
wild_prefix, wild_one, wild_many))
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (my_strnncoll(files_charset_info,
|
||||
(uchar*)dl.str, dl.length,
|
||||
(uchar*)lookup.db_value.str, lookup.db_value.length))
|
||||
if (files_charset_info->strnncoll(dl.str, dl.length,
|
||||
lookup.db_value.str, lookup.db_value.length))
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
@ -1494,7 +1493,7 @@ static const char *require_quotes(const char *name, uint name_length)
|
|||
for (; name < end ; name++)
|
||||
{
|
||||
uchar chr= (uchar) *name;
|
||||
int length= my_charlen(system_charset_info, name, end);
|
||||
int length= system_charset_info->charlen(name, end);
|
||||
if (length == 1 && !system_charset_info->ident_map[chr])
|
||||
return name;
|
||||
if (length == 1 && (chr < '0' || chr > '9'))
|
||||
|
@ -1555,7 +1554,7 @@ append_identifier(THD *thd, String *packet, const char *name, size_t length)
|
|||
for (name_end= name+length ; name < name_end ; )
|
||||
{
|
||||
uchar chr= (uchar) *name;
|
||||
int char_length= my_charlen(system_charset_info, name, name_end);
|
||||
int char_length= system_charset_info->charlen(name, name_end);
|
||||
/*
|
||||
charlen can return 0 and negative numbers on a wrong multibyte
|
||||
sequence. It is possible when upgrading from 4.0,
|
||||
|
@ -3882,17 +3881,17 @@ bool get_lookup_value(THD *thd, Item_func *item_func,
|
|||
return 1;
|
||||
|
||||
/* Lookup value is database name */
|
||||
if (!cs->coll->strnncollsp(cs, (uchar *) field_name1, strlen(field_name1),
|
||||
(uchar *) item_field->field_name.str,
|
||||
if (!cs->strnncollsp(field_name1, strlen(field_name1),
|
||||
item_field->field_name.str,
|
||||
item_field->field_name.length))
|
||||
{
|
||||
thd->make_lex_string(&lookup_field_vals->db_value,
|
||||
tmp_str->ptr(), tmp_str->length());
|
||||
}
|
||||
/* Lookup value is table name */
|
||||
else if (!cs->coll->strnncollsp(cs, (uchar *) field_name2,
|
||||
else if (!cs->strnncollsp(field_name2,
|
||||
strlen(field_name2),
|
||||
(uchar *) item_field->field_name.str,
|
||||
item_field->field_name.str,
|
||||
item_field->field_name.length))
|
||||
{
|
||||
thd->make_lex_string(&lookup_field_vals->table_value,
|
||||
|
@ -3986,11 +3985,11 @@ bool uses_only_table_name_fields(Item *item, TABLE_LIST *table)
|
|||
const char *field_name2= schema_table->idx_field2 >= 0 ?
|
||||
field_info[schema_table->idx_field2].name().str : "";
|
||||
if (table->table != item_field->field->table ||
|
||||
(cs->coll->strnncollsp(cs, (uchar *) field_name1, strlen(field_name1),
|
||||
(uchar *) item_field->field_name.str,
|
||||
(cs->strnncollsp(field_name1, strlen(field_name1),
|
||||
item_field->field_name.str,
|
||||
item_field->field_name.length) &&
|
||||
cs->coll->strnncollsp(cs, (uchar *) field_name2, strlen(field_name2),
|
||||
(uchar *) item_field->field_name.str,
|
||||
cs->strnncollsp(field_name2, strlen(field_name2),
|
||||
item_field->field_name.str,
|
||||
item_field->field_name.length)))
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
/* Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
Copyright (c) 2009, 2020, MariaDB Corporation.
|
||||
|
||||
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
|
||||
|
@ -104,7 +105,7 @@ static bool assign_fixed_string(MEM_ROOT *mem_root,
|
|||
src_cs= src->charset();
|
||||
src_len= src->length();
|
||||
src_end= src_str + src_len;
|
||||
numchars= src_cs->cset->numchars(src_cs, src_str, src_end);
|
||||
numchars= src_cs->numchars(src_str, src_end);
|
||||
|
||||
if (numchars <= max_char)
|
||||
{
|
||||
|
@ -114,7 +115,7 @@ static bool assign_fixed_string(MEM_ROOT *mem_root,
|
|||
else
|
||||
{
|
||||
numchars= max_char;
|
||||
to_copy= dst_cs->cset->charpos(dst_cs, src_str, src_end, numchars);
|
||||
to_copy= dst_cs->charpos(src_str, src_end, numchars);
|
||||
truncated= true;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/* Copyright (c) 2000, 2013, Oracle and/or its affiliates.
|
||||
Copyright (c) 2016, MariaDB
|
||||
Copyright (c) 2016, 2020, MariaDB
|
||||
|
||||
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
|
||||
|
@ -125,7 +125,7 @@ bool String::set_int(longlong num, bool unsigned_flag, CHARSET_INFO *cs)
|
|||
|
||||
if (alloc(l))
|
||||
return TRUE;
|
||||
str_length=(uint32) (cs->cset->longlong10_to_str)(cs,Ptr,l,base,num);
|
||||
str_length=(uint32) (cs->longlong10_to_str)(Ptr,l,base,num);
|
||||
set_charset(cs);
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -821,9 +821,8 @@ bool Binary_string::copy_printable_hhhh(CHARSET_INFO *to_cs,
|
|||
|
||||
int sortcmp(const String *s,const String *t, CHARSET_INFO *cs)
|
||||
{
|
||||
return cs->coll->strnncollsp(cs,
|
||||
(uchar *) s->ptr(),s->length(),
|
||||
(uchar *) t->ptr(),t->length());
|
||||
return cs->strnncollsp(s->ptr(), s->length(),
|
||||
t->ptr(), t->length());
|
||||
}
|
||||
|
||||
|
||||
|
@ -1099,7 +1098,7 @@ String_copier::well_formed_copy(CHARSET_INFO *to_cs,
|
|||
my_charset_same(from_cs, to_cs))
|
||||
{
|
||||
m_cannot_convert_error_pos= NULL;
|
||||
return (uint) to_cs->cset->copy_fix(to_cs, to, to_length, from, from_length,
|
||||
return (uint) to_cs->copy_fix(to, to_length, from, from_length,
|
||||
nchars, this);
|
||||
}
|
||||
return (uint) my_convert_fix(to_cs, to, to_length, from_cs, from, from_length,
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
/*
|
||||
Copyright (c) 2000, 2013, Oracle and/or its affiliates.
|
||||
Copyright (c) 2008, 2019, MariaDB Corporation.
|
||||
Copyright (c) 2008, 2020, MariaDB Corporation.
|
||||
|
||||
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
|
||||
|
@ -60,7 +60,7 @@ class Well_formed_prefix_status: public String_copy_status
|
|||
public:
|
||||
Well_formed_prefix_status(CHARSET_INFO *cs,
|
||||
const char *str, const char *end, size_t nchars)
|
||||
{ cs->cset->well_formed_char_length(cs, str, end, nchars, this); }
|
||||
{ cs->well_formed_char_length(str, end, nchars, this); }
|
||||
};
|
||||
|
||||
|
||||
|
@ -137,6 +137,7 @@ public:
|
|||
Charset(CHARSET_INFO *cs) :m_charset(cs) { }
|
||||
|
||||
CHARSET_INFO *charset() const { return m_charset; }
|
||||
bool use_mb() const { return m_charset->use_mb(); }
|
||||
uint mbminlen() const { return m_charset->mbminlen; }
|
||||
uint mbmaxlen() const { return m_charset->mbmaxlen; }
|
||||
bool is_good_for_ft() const
|
||||
|
@ -147,15 +148,15 @@ public:
|
|||
|
||||
size_t numchars(const char *str, const char *end) const
|
||||
{
|
||||
return m_charset->cset->numchars(m_charset, str, end);
|
||||
return m_charset->numchars(str, end);
|
||||
}
|
||||
size_t lengthsp(const char *str, size_t length) const
|
||||
{
|
||||
return m_charset->cset->lengthsp(m_charset, str, length);
|
||||
return m_charset->lengthsp(str, length);
|
||||
}
|
||||
size_t charpos(const char *str, const char *end, size_t pos) const
|
||||
{
|
||||
return m_charset->cset->charpos(m_charset, str, end, pos);
|
||||
return m_charset->charpos(str, end, pos);
|
||||
}
|
||||
void set_charset(CHARSET_INFO *charset_arg)
|
||||
{
|
||||
|
@ -1067,7 +1068,7 @@ static inline bool check_if_only_end_space(CHARSET_INFO *cs,
|
|||
const char *str,
|
||||
const char *end)
|
||||
{
|
||||
return str+ cs->cset->scan(cs, str, end, MY_SEQ_SPACES) == end;
|
||||
return str + cs->scan(str, end, MY_SEQ_SPACES) == end;
|
||||
}
|
||||
|
||||
int append_query_string(CHARSET_INFO *csinfo, String *to,
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
Copyright (c) 2000, 2019, Oracle and/or its affiliates.
|
||||
Copyright (c) 2010, 2019, MariaDB
|
||||
Copyright (c) 2010, 2020, MariaDB
|
||||
|
||||
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
|
||||
|
@ -132,7 +132,7 @@ static char* add_identifier(THD* thd, char *to_p, const char * end_p,
|
|||
*(to_p++)= (char) quote;
|
||||
while (*conv_name && (end_p - to_p - 1) > 0)
|
||||
{
|
||||
int length= my_charlen(system_charset_info, conv_name, conv_name_end);
|
||||
int length= system_charset_info->charlen(conv_name, conv_name_end);
|
||||
if (length <= 0)
|
||||
length= 1;
|
||||
if (length == 1 && *conv_name == (char) quote)
|
||||
|
@ -3228,8 +3228,7 @@ bool Column_definition::prepare_stage1_check_typelib_default()
|
|||
}
|
||||
else /* MYSQL_TYPE_ENUM */
|
||||
{
|
||||
def->length(charset->cset->lengthsp(charset,
|
||||
def->ptr(), def->length()));
|
||||
def->length(charset->lengthsp(def->ptr(), def->length()));
|
||||
not_found= !find_type2(interval, def->ptr(), def->length(), charset);
|
||||
}
|
||||
}
|
||||
|
@ -3478,8 +3477,7 @@ mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info,
|
|||
LEX_CSTRING* connect_string = &create_info->connect_string;
|
||||
if (connect_string->length != 0 &&
|
||||
connect_string->length > CONNECT_STRING_MAXLEN &&
|
||||
(system_charset_info->cset->charpos(system_charset_info,
|
||||
connect_string->str,
|
||||
(system_charset_info->charpos(connect_string->str,
|
||||
(connect_string->str +
|
||||
connect_string->length),
|
||||
CONNECT_STRING_MAXLEN)
|
||||
|
@ -4402,8 +4400,9 @@ bool validate_comment_length(THD *thd, LEX_CSTRING *comment, size_t max_len,
|
|||
uint err_code, const char *name)
|
||||
{
|
||||
DBUG_ENTER("validate_comment_length");
|
||||
size_t tmp_len= my_charpos(system_charset_info, comment->str,
|
||||
comment->str + comment->length, max_len);
|
||||
size_t tmp_len= system_charset_info->charpos(comment->str,
|
||||
comment->str + comment->length,
|
||||
max_len);
|
||||
if (tmp_len < comment->length)
|
||||
{
|
||||
if (thd->is_strict_mode())
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/* Copyright (c) 2000, 2010, Oracle and/or its affiliates.
|
||||
Copyright (c) 2009, 2013 Monty Program Ab.
|
||||
Copyright (c) 2009, 2020, MariaDB Corporation.
|
||||
|
||||
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
|
||||
|
@ -338,7 +338,7 @@ to_ascii(CHARSET_INFO *cs,
|
|||
const char *srcend= src + src_length;
|
||||
char *dst0= dst, *dstend= dst + dst_length - 1;
|
||||
while (dst < dstend &&
|
||||
(cnvres= (cs->cset->mb_wc)(cs, &wc,
|
||||
(cnvres= cs->mb_wc(&wc,
|
||||
(const uchar*) src,
|
||||
(const uchar*) srcend)) > 0 &&
|
||||
wc < 128)
|
||||
|
@ -734,9 +734,7 @@ bool parse_date_time_format(timestamp_type format_type,
|
|||
this. If separators are used, they must be between each part
|
||||
*/
|
||||
if (format_length == 6 && !need_p &&
|
||||
!my_strnncoll(&my_charset_bin,
|
||||
(const uchar *) format, 6,
|
||||
(const uchar *) format_str, 6))
|
||||
!my_charset_bin.strnncoll(format, 6, format_str, 6))
|
||||
return 0;
|
||||
if (separator_map == (1 | 2))
|
||||
{
|
||||
|
@ -757,9 +755,9 @@ bool parse_date_time_format(timestamp_type format_type,
|
|||
Between DATE and TIME we also allow space as separator
|
||||
*/
|
||||
if ((format_length == 12 && !need_p &&
|
||||
!my_strnncoll(&my_charset_bin,
|
||||
(const uchar *) format, 12,
|
||||
(const uchar*) known_date_time_formats[INTERNAL_FORMAT].datetime_format,
|
||||
!my_charset_bin.strnncoll(
|
||||
format, 12,
|
||||
known_date_time_formats[INTERNAL_FORMAT].datetime_format,
|
||||
12)) ||
|
||||
(separators == 5 && separator_map == (1 | 2 | 8 | 16)))
|
||||
return 0;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (c) 2015,2019 MariaDB
|
||||
Copyright (c) 2015,2020 MariaDB
|
||||
|
||||
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
|
||||
|
@ -5597,9 +5597,8 @@ cmp_item *Type_handler_timestamp_common::make_cmp_item(THD *thd,
|
|||
|
||||
static int srtcmp_in(CHARSET_INFO *cs, const String *x,const String *y)
|
||||
{
|
||||
return cs->coll->strnncollsp(cs,
|
||||
(uchar *) x->ptr(),x->length(),
|
||||
(uchar *) y->ptr(),y->length());
|
||||
return cs->strnncollsp(x->ptr(), x->length(),
|
||||
y->ptr(), y->length());
|
||||
}
|
||||
|
||||
in_vector *Type_handler_string_result::make_in_vector(THD *thd,
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
#define SQL_TYPE_H_INCLUDED
|
||||
/*
|
||||
Copyright (c) 2015 MariaDB Foundation.
|
||||
Copyright (c) 2015, 2020, MariaDB Corporation.
|
||||
|
||||
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
|
||||
|
@ -2773,11 +2774,10 @@ public:
|
|||
default: return "UNKNOWN";
|
||||
}
|
||||
}
|
||||
int sortcmp(const String *s, const String *t) const
|
||||
int sortcmp(const Binary_string *s, const Binary_string *t) const
|
||||
{
|
||||
return collation->coll->strnncollsp(collation,
|
||||
(uchar *) s->ptr(), s->length(),
|
||||
(uchar *) t->ptr(), t->length());
|
||||
return collation->strnncollsp(s->ptr(), s->length(),
|
||||
t->ptr(), t->length());
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -3130,9 +3130,8 @@ public:
|
|||
const LEX_CSTRING &lex_cstring() const { return *this; }
|
||||
bool eq(const LEX_CSTRING &other) const
|
||||
{
|
||||
return !my_strnncoll(system_charset_info,
|
||||
(const uchar *) LEX_CSTRING::str, LEX_CSTRING::length,
|
||||
(const uchar *) other.str, other.length);
|
||||
return !system_charset_info->strnncoll(LEX_CSTRING::str, LEX_CSTRING::length,
|
||||
other.str, other.length);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (c) 2019 MariaDB
|
||||
Copyright (c) 2019, 2020 MariaDB
|
||||
|
||||
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
|
||||
|
@ -28,7 +28,7 @@ StringPack::pack(uchar *to, const uchar *from, uint max_length) const
|
|||
DBUG_PRINT("debug", ("length: %zu ", length));
|
||||
|
||||
if (length > local_char_length)
|
||||
local_char_length= my_charpos(charset(), from, from + length,
|
||||
local_char_length= charset()->charpos(from, from + length,
|
||||
local_char_length);
|
||||
set_if_smaller(length, local_char_length);
|
||||
|
||||
|
@ -44,7 +44,7 @@ StringPack::pack(uchar *to, const uchar *from, uint max_length) const
|
|||
length --;
|
||||
}
|
||||
else
|
||||
length= charset()->cset->lengthsp(charset(), (const char*) from, length);
|
||||
length= charset()->lengthsp((const char*) from, length);
|
||||
|
||||
// Length always stored little-endian
|
||||
*to++= (uchar) length;
|
||||
|
@ -97,8 +97,7 @@ StringPack::unpack(uchar *to, const uchar *from, const uchar *from_end,
|
|||
|
||||
memcpy(to, from, length);
|
||||
// Pad the string with the pad character of the fields charset
|
||||
charset()->cset->fill(charset(),
|
||||
(char*) to + length,
|
||||
charset()->fill((char*) to + length,
|
||||
m_octet_length - length,
|
||||
charset()->pad_char);
|
||||
return from+length;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
Copyright (c) 2000, 2015, Oracle and/or its affiliates.
|
||||
Copyright (c) 2010, 2019, MariaDB Corporation.
|
||||
Copyright (c) 2010, 2020, MariaDB Corporation.
|
||||
|
||||
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
|
||||
|
@ -16762,7 +16762,7 @@ grant_role:
|
|||
{
|
||||
CHARSET_INFO *cs= system_charset_info;
|
||||
/* trim end spaces (as they'll be lost in mysql.user anyway) */
|
||||
$1.length= cs->cset->lengthsp(cs, $1.str, $1.length);
|
||||
$1.length= cs->lengthsp($1.str, $1.length);
|
||||
((char*) $1.str)[$1.length] = '\0';
|
||||
if (unlikely($1.length == 0))
|
||||
my_yyabort_error((ER_INVALID_ROLE, MYF(0), ""));
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
/* Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
Copyright (c) 2009, 2020, MariaDB Corporation.
|
||||
|
||||
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
|
||||
|
@ -50,7 +51,7 @@ ulonglong find_set(const TYPELIB *lib,
|
|||
char **err_pos, uint *err_len, bool *set_warning)
|
||||
{
|
||||
CHARSET_INFO *strip= cs ? cs : &my_charset_latin1;
|
||||
const char *end= str + strip->cset->lengthsp(strip, str, length);
|
||||
const char *end= str + strip->lengthsp(str, length);
|
||||
ulonglong found= 0;
|
||||
*err_pos= 0; // No error yet
|
||||
*err_len= 0;
|
||||
|
@ -68,7 +69,7 @@ ulonglong find_set(const TYPELIB *lib,
|
|||
for ( ; pos < end; pos+= mblen)
|
||||
{
|
||||
my_wc_t wc;
|
||||
if ((mblen= cs->cset->mb_wc(cs, &wc, (const uchar *) pos,
|
||||
if ((mblen= cs->mb_wc(&wc, (const uchar *) pos,
|
||||
(const uchar *) end)) < 1)
|
||||
mblen= 1; // Not to hang on a wrong multibyte sequence
|
||||
if (wc == (my_wc_t) field_separator)
|
||||
|
@ -170,8 +171,8 @@ uint find_type2(const TYPELIB *typelib, const char *x, size_t length,
|
|||
|
||||
for (pos=0 ; (j=typelib->type_names[pos]) ; pos++)
|
||||
{
|
||||
if (!my_strnncoll(cs, (const uchar*) x, length,
|
||||
(const uchar*) j, typelib->type_lengths[pos]))
|
||||
if (!cs->strnncoll(x, length,
|
||||
j, typelib->type_lengths[pos]))
|
||||
DBUG_RETURN(pos+1);
|
||||
}
|
||||
DBUG_PRINT("exit",("Couldn't find type"));
|
||||
|
@ -338,8 +339,8 @@ int find_string_in_array(LEX_CSTRING * const haystack, LEX_CSTRING * const needl
|
|||
{
|
||||
const LEX_CSTRING *pos;
|
||||
for (pos= haystack; pos->str; pos++)
|
||||
if (!cs->coll->strnncollsp(cs, (uchar *) pos->str, pos->length,
|
||||
(uchar *) needle->str, needle->length))
|
||||
if (!cs->strnncollsp(pos->str, pos->length,
|
||||
needle->str, needle->length))
|
||||
{
|
||||
return (int)(pos - haystack);
|
||||
}
|
||||
|
|
11
sql/table.cc
11
sql/table.cc
|
@ -1,5 +1,5 @@
|
|||
/* Copyright (c) 2000, 2017, Oracle and/or its affiliates.
|
||||
Copyright (c) 2008, 2019, MariaDB
|
||||
Copyright (c) 2008, 2020, MariaDB
|
||||
|
||||
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
|
||||
|
@ -346,8 +346,7 @@ TABLE_SHARE *alloc_table_share(const char *db, const char *table_name,
|
|||
if (share->table_category == TABLE_CATEGORY_LOG)
|
||||
share->no_replicate= 1;
|
||||
if (key_length > 6 &&
|
||||
my_strnncoll(table_alias_charset, (const uchar*) key, 6,
|
||||
(const uchar*) "mysql", 6) == 0)
|
||||
table_alias_charset->strnncoll(key, 6, "mysql", 6) == 0)
|
||||
share->not_usable_by_query_cache= 1;
|
||||
|
||||
init_sql_alloc(&share->stats_cb.mem_root, "share_stats",
|
||||
|
@ -1834,7 +1833,7 @@ int TABLE_SHARE::init_from_binary_frm_image(THD *thd, bool write,
|
|||
{
|
||||
const CHARSET_INFO *cs= thd->variables.collation_database;
|
||||
/* unknown charset in frm_image[38] or pre-3.23 frm */
|
||||
if (use_mb(cs))
|
||||
if (cs->use_mb())
|
||||
{
|
||||
/* Warn that we may be changing the size of character columns */
|
||||
sql_print_warning("'%s' had no or invalid character set, "
|
||||
|
@ -4743,7 +4742,7 @@ bool check_table_name(const char *name, size_t length, bool check_for_path_chars
|
|||
{
|
||||
#if defined(USE_MB) && defined(USE_MB_IDENT)
|
||||
last_char_is_space= my_isspace(system_charset_info, *name);
|
||||
if (use_mb(system_charset_info))
|
||||
if (system_charset_info->use_mb())
|
||||
{
|
||||
int len=my_ismbchar(system_charset_info, name, end);
|
||||
if (len)
|
||||
|
@ -4778,7 +4777,7 @@ bool check_column_name(const char *name)
|
|||
{
|
||||
#if defined(USE_MB) && defined(USE_MB_IDENT)
|
||||
last_char_is_space= my_isspace(system_charset_info, *name);
|
||||
if (use_mb(system_charset_info))
|
||||
if (system_charset_info->use_mb())
|
||||
{
|
||||
int len=my_ismbchar(system_charset_info, name,
|
||||
name+system_charset_info->mbmaxlen);
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
/* Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
Copyright (c) 2009, 2020, MariaDB Corporation.
|
||||
|
||||
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
|
||||
|
@ -514,7 +515,8 @@ find_savepoint(THD *thd, LEX_CSTRING name)
|
|||
|
||||
while (*sv)
|
||||
{
|
||||
if (my_strnncoll(system_charset_info, (uchar *) name.str, name.length,
|
||||
if (system_charset_info->strnncoll(
|
||||
(uchar *) name.str, name.length,
|
||||
(uchar *) (*sv)->name, (*sv)->length) == 0)
|
||||
break;
|
||||
sv= &(*sv)->prev;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (c) 2018, MariaDB Corporation.
|
||||
Copyright (c) 2018, 2020, MariaDB Corporation.
|
||||
|
||||
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
|
||||
|
@ -30,9 +30,8 @@ struct Compare_table_names
|
|||
{
|
||||
DBUG_ASSERT(a.str[a.length] == 0);
|
||||
DBUG_ASSERT(b.str[b.length] == 0);
|
||||
return my_strnncoll(table_alias_charset,
|
||||
(uchar*)a.str, a.length,
|
||||
(uchar*)b.str, b.length);
|
||||
return table_alias_charset->strnncoll(a.str, a.length,
|
||||
b.str, b.length);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/* Copyright (c) 2004, 2015, Oracle and/or its affiliates.
|
||||
Copyright (c) 2017, MariaDB Corporation.
|
||||
Copyright (c) 2017, 2020, MariaDB Corporation.
|
||||
|
||||
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
|
||||
|
@ -560,7 +560,7 @@ static bool append_ident(String *string, const char *name, size_t length,
|
|||
for (name_end= name+length; name < name_end; name+= clen)
|
||||
{
|
||||
uchar c= *(uchar *) name;
|
||||
clen= my_charlen_fix(system_charset_info, name, name_end);
|
||||
clen= system_charset_info->charlen_fix(name, name_end);
|
||||
if (clen == 1 && c == (uchar) quote_char &&
|
||||
(result= string->append("e_char, 1, system_charset_info)))
|
||||
goto err;
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
/*
|
||||
Copyright (c) 2008-2009, Patrick Galbraith & Antony Curtis
|
||||
Copyright (c) 2020, MariaDB Corporation.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
|
@ -510,7 +511,7 @@ bool append_ident(String *string, const char *name, size_t length,
|
|||
for (name_end= name+length; name < name_end; name+= clen)
|
||||
{
|
||||
uchar c= *(uchar *) name;
|
||||
clen= my_charlen_fix(system_charset_info, name, name_end);
|
||||
clen= system_charset_info->charlen_fix(name, name_end);
|
||||
if (clen == 1 && c == (uchar) quote_char &&
|
||||
(result= string->append("e_char, 1, system_charset_info)))
|
||||
goto err;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/* Copyright (c) 2000, 2018, Oracle and/or its affiliates.
|
||||
Copyright (c) 2010, 2018, MariaDB Corporation.
|
||||
Copyright (c) 2010, 2020, MariaDB Corporation.
|
||||
|
||||
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
|
||||
|
@ -93,7 +93,7 @@ int heap_create(const char *name, HP_CREATE_INFO *create_info,
|
|||
keyinfo->seg[j].flag|= HA_SWAP_KEY;
|
||||
break;
|
||||
case HA_KEYTYPE_VARBINARY1:
|
||||
/* Case-insensitiveness is handled in coll->hash_sort */
|
||||
/* Case-insensitiveness is handled in hash_sort */
|
||||
keyinfo->seg[j].type= HA_KEYTYPE_VARTEXT1;
|
||||
/* fall through */
|
||||
case HA_KEYTYPE_VARTEXT1:
|
||||
|
@ -110,7 +110,7 @@ int heap_create(const char *name, HP_CREATE_INFO *create_info,
|
|||
keyinfo->seg[j].bit_start= 1;
|
||||
break;
|
||||
case HA_KEYTYPE_VARBINARY2:
|
||||
/* Case-insensitiveness is handled in coll->hash_sort */
|
||||
/* Case-insensitiveness is handled in hash_sort */
|
||||
/* fall_through */
|
||||
case HA_KEYTYPE_VARTEXT2:
|
||||
keyinfo->flag|= HA_VAR_LENGTH_KEY;
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
/*
|
||||
Copyright (c) 2000, 2010, Oracle and/or its affiliates
|
||||
Copyright (c) 2020, MariaDB Corporation.
|
||||
|
||||
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
|
||||
|
@ -19,6 +20,14 @@
|
|||
#include "heapdef.h"
|
||||
#include <m_ctype.h>
|
||||
|
||||
|
||||
static inline size_t
|
||||
hp_charpos(CHARSET_INFO *cs, const uchar *b, const uchar *e, size_t num)
|
||||
{
|
||||
return my_ci_charpos(cs, (const char*) b, (const char *) e, num);
|
||||
}
|
||||
|
||||
|
||||
static ulong hp_hashnr(HP_KEYDEF *keydef, const uchar *key);
|
||||
/*
|
||||
Find out how many rows there is in the given range
|
||||
|
@ -242,10 +251,10 @@ static ulong hp_hashnr(HP_KEYDEF *keydef, const uchar *key)
|
|||
if (cs->mbmaxlen > 1)
|
||||
{
|
||||
size_t char_length;
|
||||
char_length= my_charpos(cs, pos, pos + length, length/cs->mbmaxlen);
|
||||
char_length= hp_charpos(cs, pos, pos + length, length/cs->mbmaxlen);
|
||||
set_if_smaller(length, char_length);
|
||||
}
|
||||
cs->coll->hash_sort(cs, pos, length, &nr, &nr2);
|
||||
my_ci_hash_sort(cs, pos, length, &nr, &nr2);
|
||||
}
|
||||
else if (seg->type == HA_KEYTYPE_VARTEXT1) /* Any VARCHAR segments */
|
||||
{
|
||||
|
@ -255,12 +264,12 @@ static ulong hp_hashnr(HP_KEYDEF *keydef, const uchar *key)
|
|||
if (cs->mbmaxlen > 1)
|
||||
{
|
||||
size_t char_length;
|
||||
char_length= my_charpos(cs, pos +pack_length,
|
||||
char_length= hp_charpos(cs, pos +pack_length,
|
||||
pos +pack_length + length,
|
||||
seg->length/cs->mbmaxlen);
|
||||
set_if_smaller(length, char_length);
|
||||
}
|
||||
cs->coll->hash_sort(cs, pos+pack_length, length, &nr, &nr2);
|
||||
my_ci_hash_sort(cs, pos+pack_length, length, &nr, &nr2);
|
||||
key+= pack_length;
|
||||
}
|
||||
else
|
||||
|
@ -302,11 +311,11 @@ ulong hp_rec_hashnr(register HP_KEYDEF *keydef, register const uchar *rec)
|
|||
size_t char_length= seg->length;
|
||||
if (cs->mbmaxlen > 1)
|
||||
{
|
||||
char_length= my_charpos(cs, pos, pos + char_length,
|
||||
char_length= hp_charpos(cs, pos, pos + char_length,
|
||||
char_length / cs->mbmaxlen);
|
||||
set_if_smaller(char_length, seg->length); /* QQ: ok to remove? */
|
||||
}
|
||||
cs->coll->hash_sort(cs, pos, char_length, &nr, &nr2);
|
||||
my_ci_hash_sort(cs, pos, char_length, &nr, &nr2);
|
||||
}
|
||||
else if (seg->type == HA_KEYTYPE_VARTEXT1) /* Any VARCHAR segments */
|
||||
{
|
||||
|
@ -316,14 +325,14 @@ ulong hp_rec_hashnr(register HP_KEYDEF *keydef, register const uchar *rec)
|
|||
if (cs->mbmaxlen > 1)
|
||||
{
|
||||
size_t char_length;
|
||||
char_length= my_charpos(cs, pos + pack_length,
|
||||
char_length= hp_charpos(cs, pos + pack_length,
|
||||
pos + pack_length + length,
|
||||
seg->length/cs->mbmaxlen);
|
||||
set_if_smaller(length, char_length);
|
||||
}
|
||||
else
|
||||
set_if_smaller(length, seg->length);
|
||||
cs->coll->hash_sort(cs, pos+pack_length, length, &nr, &nr2);
|
||||
my_ci_hash_sort(cs, pos+pack_length, length, &nr, &nr2);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -392,18 +401,18 @@ int hp_rec_key_cmp(HP_KEYDEF *keydef, const uchar *rec1, const uchar *rec2)
|
|||
if (cs->mbmaxlen > 1)
|
||||
{
|
||||
size_t char_length= seg->length / cs->mbmaxlen;
|
||||
char_length1= my_charpos(cs, pos1, pos1 + seg->length, char_length);
|
||||
char_length1= hp_charpos(cs, pos1, pos1 + seg->length, char_length);
|
||||
set_if_smaller(char_length1, seg->length);
|
||||
char_length2= my_charpos(cs, pos2, pos2 + seg->length, char_length);
|
||||
char_length2= hp_charpos(cs, pos2, pos2 + seg->length, char_length);
|
||||
set_if_smaller(char_length2, seg->length);
|
||||
}
|
||||
else
|
||||
{
|
||||
char_length1= char_length2= seg->length;
|
||||
}
|
||||
if (seg->charset->coll->strnncollsp(seg->charset,
|
||||
pos1,char_length1,
|
||||
pos2,char_length2))
|
||||
if (my_ci_strnncollsp(seg->charset,
|
||||
pos1, char_length1,
|
||||
pos2, char_length2))
|
||||
return 1;
|
||||
}
|
||||
else if (seg->type == HA_KEYTYPE_VARTEXT1) /* Any VARCHAR segments */
|
||||
|
@ -430,9 +439,9 @@ int hp_rec_key_cmp(HP_KEYDEF *keydef, const uchar *rec1, const uchar *rec2)
|
|||
size_t safe_length1= char_length1;
|
||||
size_t safe_length2= char_length2;
|
||||
size_t char_length= seg->length / cs->mbmaxlen;
|
||||
char_length1= my_charpos(cs, pos1, pos1 + char_length1, char_length);
|
||||
char_length1= hp_charpos(cs, pos1, pos1 + char_length1, char_length);
|
||||
set_if_smaller(char_length1, safe_length1);
|
||||
char_length2= my_charpos(cs, pos2, pos2 + char_length2, char_length);
|
||||
char_length2= hp_charpos(cs, pos2, pos2 + char_length2, char_length);
|
||||
set_if_smaller(char_length2, safe_length2);
|
||||
}
|
||||
else
|
||||
|
@ -441,7 +450,7 @@ int hp_rec_key_cmp(HP_KEYDEF *keydef, const uchar *rec1, const uchar *rec2)
|
|||
set_if_smaller(char_length2, seg->length);
|
||||
}
|
||||
|
||||
if (cs->coll->strnncollsp(seg->charset,
|
||||
if (my_ci_strnncollsp(seg->charset,
|
||||
pos1, char_length1,
|
||||
pos2, char_length2))
|
||||
return 1;
|
||||
|
@ -498,9 +507,9 @@ int hp_key_cmp(HP_KEYDEF *keydef, const uchar *rec, const uchar *key)
|
|||
if (cs->mbmaxlen > 1)
|
||||
{
|
||||
size_t char_length= seg->length / cs->mbmaxlen;
|
||||
char_length_key= my_charpos(cs, key, key + seg->length, char_length);
|
||||
char_length_key= hp_charpos(cs, key, key + seg->length, char_length);
|
||||
set_if_smaller(char_length_key, seg->length);
|
||||
char_length_rec= my_charpos(cs, pos, pos + seg->length, char_length);
|
||||
char_length_rec= hp_charpos(cs, pos, pos + seg->length, char_length);
|
||||
set_if_smaller(char_length_rec, seg->length);
|
||||
}
|
||||
else
|
||||
|
@ -509,9 +518,9 @@ int hp_key_cmp(HP_KEYDEF *keydef, const uchar *rec, const uchar *key)
|
|||
char_length_rec= seg->length;
|
||||
}
|
||||
|
||||
if (seg->charset->coll->strnncollsp(seg->charset,
|
||||
(uchar*) pos, char_length_rec,
|
||||
(uchar*) key, char_length_key))
|
||||
if (my_ci_strnncollsp(seg->charset,
|
||||
pos, char_length_rec,
|
||||
key, char_length_key))
|
||||
return 1;
|
||||
}
|
||||
else if (seg->type == HA_KEYTYPE_VARTEXT1) /* Any VARCHAR segments */
|
||||
|
@ -529,17 +538,17 @@ int hp_key_cmp(HP_KEYDEF *keydef, const uchar *rec, const uchar *key)
|
|||
{
|
||||
size_t char_length1, char_length2;
|
||||
char_length1= char_length2= seg->length / cs->mbmaxlen;
|
||||
char_length1= my_charpos(cs, key, key + char_length_key, char_length1);
|
||||
char_length1= hp_charpos(cs, key, key + char_length_key, char_length1);
|
||||
set_if_smaller(char_length_key, char_length1);
|
||||
char_length2= my_charpos(cs, pos, pos + char_length_rec, char_length2);
|
||||
char_length2= hp_charpos(cs, pos, pos + char_length_rec, char_length2);
|
||||
set_if_smaller(char_length_rec, char_length2);
|
||||
}
|
||||
else
|
||||
set_if_smaller(char_length_rec, seg->length);
|
||||
|
||||
if (cs->coll->strnncollsp(seg->charset,
|
||||
(uchar*) pos, char_length_rec,
|
||||
(uchar*) key, char_length_key))
|
||||
if (my_ci_strnncollsp(seg->charset,
|
||||
pos, char_length_rec,
|
||||
key, char_length_key))
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
|
@ -578,7 +587,7 @@ void hp_make_key(HP_KEYDEF *keydef, uchar *key, const uchar *rec)
|
|||
*key++= MY_TEST(rec[seg->null_pos] & seg->null_bit);
|
||||
if (cs->mbmaxlen > 1)
|
||||
{
|
||||
char_length= my_charpos(cs, pos, pos + seg->length,
|
||||
char_length= hp_charpos(cs, pos, pos + seg->length,
|
||||
char_length / cs->mbmaxlen);
|
||||
set_if_smaller(char_length, seg->length); /* QQ: ok to remove? */
|
||||
}
|
||||
|
@ -598,7 +607,7 @@ void hp_make_key(HP_KEYDEF *keydef, uchar *key, const uchar *rec)
|
|||
#define FIX_LENGTH(cs, pos, length, char_length) \
|
||||
do { \
|
||||
if (length > char_length) \
|
||||
char_length= my_charpos(cs, pos, pos+length, char_length); \
|
||||
char_length= hp_charpos(cs, pos, pos+length, char_length); \
|
||||
set_if_smaller(char_length,length); \
|
||||
} while(0)
|
||||
|
||||
|
@ -676,12 +685,12 @@ uint hp_rb_make_key(HP_KEYDEF *keydef, uchar *key,
|
|||
char_length= seg->length;
|
||||
if (seg->charset->mbmaxlen > 1)
|
||||
{
|
||||
char_length= my_charpos(seg->charset,
|
||||
char_length= hp_charpos(seg->charset,
|
||||
rec + seg->start, rec + seg->start + char_length,
|
||||
char_length / seg->charset->mbmaxlen);
|
||||
set_if_smaller(char_length, seg->length); /* QQ: ok to remove? */
|
||||
if (char_length < seg->length)
|
||||
seg->charset->cset->fill(seg->charset, (char*) key + char_length,
|
||||
my_ci_fill(seg->charset, (char*) key + char_length,
|
||||
seg->length - char_length, ' ');
|
||||
}
|
||||
if (seg->type == HA_KEYTYPE_BIT && seg->bit_length)
|
||||
|
@ -750,11 +759,11 @@ uint hp_rb_pack_key(HP_KEYDEF *keydef, uchar *key, const uchar *old,
|
|||
char_length= seg->length;
|
||||
if (seg->charset->mbmaxlen > 1)
|
||||
{
|
||||
char_length= my_charpos(seg->charset, old, old+char_length,
|
||||
char_length= hp_charpos(seg->charset, old, old+char_length,
|
||||
char_length / seg->charset->mbmaxlen);
|
||||
set_if_smaller(char_length, seg->length); /* QQ: ok to remove? */
|
||||
if (char_length < seg->length)
|
||||
seg->charset->cset->fill(seg->charset, (char*) key + char_length,
|
||||
my_ci_fill(seg->charset, (char*) key + char_length,
|
||||
seg->length - char_length, ' ');
|
||||
}
|
||||
memcpy(key, old, (size_t) char_length);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*****************************************************************************
|
||||
|
||||
Copyright (c) 2011, 2018, Oracle and/or its affiliates. All Rights Reserved.
|
||||
Copyright (c) 2016, 2019, MariaDB Corporation.
|
||||
Copyright (c) 2016, 2020, MariaDB Corporation.
|
||||
|
||||
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
|
||||
|
@ -4533,8 +4533,8 @@ fts_get_token_size(
|
|||
int ctype;
|
||||
int mbl;
|
||||
|
||||
mbl = cs->cset->ctype(
|
||||
cs, &ctype,
|
||||
mbl = cs->ctype(
|
||||
&ctype,
|
||||
reinterpret_cast<uchar*>(start),
|
||||
reinterpret_cast<uchar*>(end));
|
||||
|
||||
|
|
|
@ -2257,8 +2257,7 @@ static bool is_mysql_datadir_path(const char *path)
|
|||
if (!lower_case_file_system)
|
||||
return(memcmp(mysql_data_dir, path_dir, mysql_data_home_len));
|
||||
|
||||
return(files_charset_info->coll->strnncoll(files_charset_info,
|
||||
(uchar *) path_dir, path_len,
|
||||
return(files_charset_info->strnncoll((uchar *) path_dir, path_len,
|
||||
(uchar *) mysql_data_dir,
|
||||
mysql_data_home_len,
|
||||
TRUE));
|
||||
|
@ -6325,13 +6324,13 @@ wsrep_innobase_mysql_sort(
|
|||
ut_a(str_length <= tmp_length);
|
||||
memcpy(tmp_str, str, str_length);
|
||||
|
||||
tmp_length = charset->coll->strnxfrm(charset, str, str_length,
|
||||
tmp_length = charset->strnxfrm(str, str_length,
|
||||
str_length, tmp_str,
|
||||
tmp_length, 0);
|
||||
DBUG_ASSERT(tmp_length <= str_length);
|
||||
if (wsrep_protocol_version < 3) {
|
||||
tmp_length = charset->coll->strnxfrm(
|
||||
charset, str, str_length,
|
||||
tmp_length = charset->strnxfrm(
|
||||
str, str_length,
|
||||
str_length, tmp_str, tmp_length, 0);
|
||||
DBUG_ASSERT(tmp_length <= str_length);
|
||||
} else {
|
||||
|
@ -6339,8 +6338,8 @@ wsrep_innobase_mysql_sort(
|
|||
protocols < 3 truncated the sorted sring
|
||||
protocols >= 3 gets full sorted sring
|
||||
*/
|
||||
tmp_length = charset->coll->strnxfrm(
|
||||
charset, str, buf_length,
|
||||
tmp_length = charset->strnxfrm(
|
||||
str, buf_length,
|
||||
str_length, tmp_str, str_length, 0);
|
||||
DBUG_ASSERT(tmp_length <= buf_length);
|
||||
ret_length = tmp_length;
|
||||
|
@ -6434,7 +6433,7 @@ innobase_strnxfrm(
|
|||
return(0);
|
||||
}
|
||||
|
||||
my_strnxfrm(cs, (uchar*) mystr, 2, str, len);
|
||||
cs->strnxfrm((uchar*) mystr, 2, str, len);
|
||||
|
||||
value = mach_read_from_2(mystr);
|
||||
|
||||
|
@ -6486,7 +6485,7 @@ innobase_fts_casedn_str(
|
|||
|
||||
return(strlen(dst));
|
||||
} else {
|
||||
return(cs->cset->casedn(cs, src, src_len, dst, dst_len));
|
||||
return(cs->casedn(src, src_len, dst, dst_len));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -6523,8 +6522,7 @@ innobase_mysql_fts_get_token(
|
|||
|
||||
int ctype;
|
||||
|
||||
mbl = cs->cset->ctype(
|
||||
cs, &ctype, doc, (const uchar*) end);
|
||||
mbl = cs->ctype(&ctype, doc, (const uchar*) end);
|
||||
|
||||
if (true_word_char(ctype, *doc)) {
|
||||
break;
|
||||
|
@ -6542,8 +6540,7 @@ innobase_mysql_fts_get_token(
|
|||
|
||||
int ctype;
|
||||
|
||||
mbl = cs->cset->ctype(
|
||||
cs, &ctype, (uchar*) doc, (uchar*) end);
|
||||
mbl = cs->ctype(&ctype, (uchar*) doc, (uchar*) end);
|
||||
if (true_word_char(ctype, *doc)) {
|
||||
mwc = 0;
|
||||
} else if (!misc_word_char(*doc) || mwc) {
|
||||
|
@ -17198,7 +17195,7 @@ innobase_get_at_most_n_mbchars(
|
|||
character. */
|
||||
|
||||
if (charset->mbmaxlen > 1) {
|
||||
/* my_charpos() returns the byte length of the first n_chars
|
||||
/* charpos() returns the byte length of the first n_chars
|
||||
characters, or a value bigger than the length of str, if
|
||||
there were not enough full characters in str.
|
||||
|
||||
|
@ -17216,7 +17213,7 @@ innobase_get_at_most_n_mbchars(
|
|||
characters, and we can store in the column prefix index the
|
||||
whole string. */
|
||||
|
||||
char_length= my_charpos(charset, str, str + data_len, n_chars);
|
||||
char_length= charset->charpos(str, str + data_len, n_chars);
|
||||
if (char_length > data_len) {
|
||||
char_length = data_len;
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
/*****************************************************************************
|
||||
|
||||
Copyright (c) 2014, 2015, Oracle and/or its affiliates. All Rights Reserved.
|
||||
Copyright (c) 2020, MariaDB Corporation.
|
||||
|
||||
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
|
||||
|
@ -91,7 +92,7 @@ fts_get_word(
|
|||
while (doc < end) {
|
||||
for (; doc < end;
|
||||
doc += (mbl > 0 ? mbl : (mbl < 0 ? -mbl : 1))) {
|
||||
mbl = cs->cset->ctype(cs, &ctype, doc, end);
|
||||
mbl = cs->ctype(&ctype, doc, end);
|
||||
|
||||
if (true_word_char(ctype, *doc)) {
|
||||
break;
|
||||
|
@ -153,7 +154,7 @@ fts_get_word(
|
|||
for (word->pos = doc;
|
||||
doc < end;
|
||||
length++, doc += (mbl > 0 ? mbl : (mbl < 0 ? -mbl : 1))) {
|
||||
mbl = cs->cset->ctype(cs, &ctype, doc, end);
|
||||
mbl = cs->ctype(&ctype, doc, end);
|
||||
|
||||
if (true_word_char(ctype, *doc)) {
|
||||
mwc = 0;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*****************************************************************************
|
||||
|
||||
Copyright (c) 2007, 2015, Oracle and/or its affiliates. All Rights Reserved.
|
||||
Copyright (c) 2017, 2018, MariaDB Corporation.
|
||||
Copyright (c) 2017, 2020, MariaDB Corporation.
|
||||
|
||||
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
|
||||
|
@ -185,12 +185,12 @@ fts_select_index_by_hash(
|
|||
char_len = my_mbcharlen_ptr(cs, reinterpret_cast<const char*>(str),
|
||||
reinterpret_cast<const char*>(str + len));
|
||||
*/
|
||||
size_t char_len = size_t(cs->cset->charlen(cs, str, str + len));
|
||||
size_t char_len = size_t(cs->charlen(str, str + len));
|
||||
|
||||
ut_ad(char_len <= len);
|
||||
|
||||
/* Get collation hash code */
|
||||
cs->coll->hash_sort(cs, str, char_len, &nr1, &nr2);
|
||||
my_ci_hash_sort(cs, str, char_len, &nr1, &nr2);
|
||||
|
||||
return(nr1 % FTS_NUM_AUX_INDEX);
|
||||
}
|
||||
|
|
|
@ -92,8 +92,7 @@ cmp_dfield_dfield_like_prefix(
|
|||
uint cs_num = (uint) dtype_get_charset_coll(type->prtype);
|
||||
|
||||
if (CHARSET_INFO* cs = get_charset(cs_num, MYF(MY_WME))) {
|
||||
return(cs->coll->strnncoll(
|
||||
cs,
|
||||
return(cs->strnncoll(
|
||||
static_cast<const uchar*>(
|
||||
dfield_get_data(dfield1)),
|
||||
dfield_get_len(dfield1),
|
||||
|
|
|
@ -85,8 +85,7 @@ innobase_mysql_cmp(
|
|||
uint cs_num = (uint) dtype_get_charset_coll(prtype);
|
||||
|
||||
if (CHARSET_INFO* cs = get_charset(cs_num, MYF(MY_WME))) {
|
||||
return(cs->coll->strnncollsp(
|
||||
cs, a, a_length, b, b_length));
|
||||
return(cs->strnncollsp(a, a_length, b, b_length));
|
||||
}
|
||||
|
||||
ib::fatal() << "Unable to find charset-collation " << cs_num;
|
||||
|
@ -356,9 +355,7 @@ cmp_whole_field(
|
|||
return(0);
|
||||
case DATA_VARCHAR:
|
||||
case DATA_CHAR:
|
||||
return(my_charset_latin1.coll->strnncollsp(
|
||||
&my_charset_latin1,
|
||||
a, a_length, b, b_length));
|
||||
return(my_charset_latin1.strnncollsp(a, a_length, b, b_length));
|
||||
case DATA_BLOB:
|
||||
if (prtype & DATA_BINARY_TYPE) {
|
||||
ib::error() << "Comparing a binary BLOB"
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
Copyright (c) 1997, 2017, Oracle and/or its affiliates. All Rights Reserved.
|
||||
Copyright (c) 2008, Google Inc.
|
||||
Copyright (c) 2015, 2019, MariaDB Corporation.
|
||||
Copyright (c) 2015, 2020, MariaDB Corporation.
|
||||
|
||||
Portions of this file contain modifications contributed and copyrighted by
|
||||
Google, Inc. Those modifications are gratefully acknowledged and are described
|
||||
|
@ -4059,7 +4059,7 @@ rec_field_len_in_chars(
|
|||
return SIZE_T_MAX;
|
||||
}
|
||||
|
||||
return(cs->cset->numchars(cs, rec_field, rec_field + rec_field_len));
|
||||
return cs->numchars(rec_field, rec_field + rec_field_len);
|
||||
}
|
||||
|
||||
/** Avoid the clustered index lookup if all the following conditions
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
/* Copyright (C) 2006 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
|
||||
Copyright (c) 2020, MariaDB Corporation.
|
||||
|
||||
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
|
||||
|
@ -126,7 +127,7 @@ uchar maria_ft_get_word(CHARSET_INFO *cs, const uchar **start,
|
|||
{
|
||||
for (; doc < end; doc+= (mbl > 0 ? mbl : (mbl < 0 ? -mbl : 1)))
|
||||
{
|
||||
mbl= cs->cset->ctype(cs, &ctype, doc, end);
|
||||
mbl= my_ci_ctype(cs, &ctype, doc, end);
|
||||
if (true_word_char(ctype, *doc))
|
||||
break;
|
||||
if (*doc == FTB_RQUOT && param->quot)
|
||||
|
@ -166,7 +167,7 @@ uchar maria_ft_get_word(CHARSET_INFO *cs, const uchar **start,
|
|||
for (word->pos= doc; doc < end; length++,
|
||||
doc+= (mbl > 0 ? mbl : (mbl < 0 ? -mbl : 1)))
|
||||
{
|
||||
mbl= cs->cset->ctype(cs, &ctype, doc, end);
|
||||
mbl= my_ci_ctype(cs, &ctype, doc, end);
|
||||
if (true_word_char(ctype, *doc))
|
||||
mwc=0;
|
||||
else if (!misc_word_char(*doc) || mwc)
|
||||
|
@ -219,7 +220,7 @@ uchar maria_ft_simple_get_word(CHARSET_INFO *cs, uchar **start,
|
|||
{
|
||||
if (doc >= end)
|
||||
DBUG_RETURN(0);
|
||||
mbl= cs->cset->ctype(cs, &ctype, doc, end);
|
||||
mbl= my_ci_ctype(cs, &ctype, doc, end);
|
||||
if (true_word_char(ctype, *doc))
|
||||
break;
|
||||
}
|
||||
|
@ -228,7 +229,7 @@ uchar maria_ft_simple_get_word(CHARSET_INFO *cs, uchar **start,
|
|||
for (word->pos= doc; doc < end; length++,
|
||||
doc+= (mbl > 0 ? mbl : (mbl < 0 ? -mbl : 1)))
|
||||
{
|
||||
mbl= cs->cset->ctype(cs, &ctype, doc, end);
|
||||
mbl= my_ci_ctype(cs, &ctype, doc, end);
|
||||
if (true_word_char(ctype, *doc))
|
||||
mwc= 0;
|
||||
else if (!misc_word_char(*doc) || mwc)
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
/* Copyright (C) 2006 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
|
||||
Copyright (c) 2020, MariaDB Corporation.
|
||||
|
||||
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
|
||||
|
@ -32,7 +33,9 @@ static int _ma_put_key_in_record(MARIA_HA *info, uint keynr,
|
|||
#define FIX_LENGTH(cs, pos, length, char_length) \
|
||||
do { \
|
||||
if (length > char_length) \
|
||||
char_length= (uint) my_charpos(cs, pos, pos+length, char_length); \
|
||||
char_length= (uint) my_ci_charpos(cs, (const char *) pos, \
|
||||
(const char *) pos+length, \
|
||||
char_length); \
|
||||
set_if_smaller(char_length,length); \
|
||||
} while(0)
|
||||
|
||||
|
@ -237,7 +240,7 @@ MARIA_KEY *_ma_make_key(MARIA_HA *info, MARIA_KEY *int_key, uint keynr,
|
|||
{
|
||||
if (type != HA_KEYTYPE_NUM)
|
||||
{
|
||||
length= (uint) cs->cset->lengthsp(cs, (const char*)pos, length);
|
||||
length= (uint) my_ci_lengthsp(cs, (const char*)pos, length);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -312,7 +315,7 @@ MARIA_KEY *_ma_make_key(MARIA_HA *info, MARIA_KEY *int_key, uint keynr,
|
|||
FIX_LENGTH(cs, pos, length, char_length);
|
||||
memcpy(key, pos, char_length);
|
||||
if (length > char_length)
|
||||
cs->cset->fill(cs, (char*) key+char_length, length-char_length, ' ');
|
||||
my_ci_fill(cs, (char*) key+char_length, length-char_length, ' ');
|
||||
key+= length;
|
||||
}
|
||||
_ma_dpointer(info->s, key, filepos);
|
||||
|
@ -438,7 +441,7 @@ MARIA_KEY *_ma_pack_key(register MARIA_HA *info, MARIA_KEY *int_key,
|
|||
FIX_LENGTH(cs, pos, length, char_length);
|
||||
memcpy(key, pos, char_length);
|
||||
if (length > char_length)
|
||||
cs->cset->fill(cs, (char*) key+char_length, length-char_length, ' ');
|
||||
my_ci_fill(cs, (char*) key+char_length, length-char_length, ' ');
|
||||
key+= length;
|
||||
}
|
||||
if (last_used_keyseg)
|
||||
|
@ -545,8 +548,7 @@ static int _ma_put_key_in_record(register MARIA_HA *info, uint keynr,
|
|||
if (keyseg->type != (int) HA_KEYTYPE_NUM)
|
||||
{
|
||||
memcpy(pos,key,(size_t) length);
|
||||
keyseg->charset->cset->fill(keyseg->charset,
|
||||
(char*) pos + length,
|
||||
my_ci_fill(keyseg->charset, (char*) pos + length,
|
||||
keyseg->length - length,
|
||||
' ');
|
||||
}
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
/* Copyright (C) 2006 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
|
||||
Copyright (c) 2020, MariaDB Corporation.
|
||||
|
||||
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
|
||||
|
@ -675,8 +676,7 @@ static void update_record(uchar *record)
|
|||
ptr=blob_key;
|
||||
memcpy(pos+4,&ptr,sizeof(char*)); /* Store pointer to new key */
|
||||
if (keyinfo[0].seg[0].type != HA_KEYTYPE_NUM)
|
||||
default_charset_info->cset->casedn(default_charset_info,
|
||||
(char*) blob_key, length,
|
||||
my_ci_casedn(default_charset_info, (char*) blob_key, length,
|
||||
(char*) blob_key, length);
|
||||
pos+=recinfo[0].length;
|
||||
}
|
||||
|
@ -684,16 +684,14 @@ static void update_record(uchar *record)
|
|||
{
|
||||
uint pack_length= HA_VARCHAR_PACKLENGTH(recinfo[0].length-1);
|
||||
uint length= pack_length == 1 ? (uint) *(uchar*) pos : uint2korr(pos);
|
||||
default_charset_info->cset->casedn(default_charset_info,
|
||||
(char*) pos + pack_length, length,
|
||||
my_ci_casedn(default_charset_info, (char*) pos + pack_length, length,
|
||||
(char*) pos + pack_length, length);
|
||||
pos+=recinfo[0].length;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (keyinfo[0].seg[0].type != HA_KEYTYPE_NUM)
|
||||
default_charset_info->cset->casedn(default_charset_info,
|
||||
(char*) pos, keyinfo[0].seg[0].length,
|
||||
my_ci_casedn(default_charset_info, (char*) pos, keyinfo[0].seg[0].length,
|
||||
(char*) pos, keyinfo[0].seg[0].length);
|
||||
pos+=recinfo[0].length;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
/* Copyright (C) 2006 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
|
||||
Copyright (c) 2020, MariaDB Corporation.
|
||||
|
||||
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
|
||||
|
@ -145,9 +146,9 @@ ha_checksum _ma_unique_hash(MARIA_UNIQUEDEF *def, const uchar *record)
|
|||
if (type == HA_KEYTYPE_TEXT || type == HA_KEYTYPE_VARTEXT1 ||
|
||||
type == HA_KEYTYPE_VARTEXT2)
|
||||
{
|
||||
keyseg->charset->coll->hash_sort(keyseg->charset,
|
||||
(const uchar*) pos, length, &seed1,
|
||||
&seed2);
|
||||
my_ci_hash_sort(keyseg->charset,
|
||||
(const uchar*) pos, length,
|
||||
&seed1, &seed2);
|
||||
crc+= seed1;
|
||||
}
|
||||
else
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
/* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
Copyright (c) 2020, MariaDB Corporation.
|
||||
|
||||
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
|
||||
|
@ -122,7 +123,7 @@ uchar ft_get_word(CHARSET_INFO *cs, const uchar **start, const uchar *end,
|
|||
{
|
||||
for (; doc < end; doc+= (mbl > 0 ? mbl : (mbl < 0 ? -mbl : 1)))
|
||||
{
|
||||
mbl= cs->cset->ctype(cs, &ctype, (uchar*)doc, (uchar*)end);
|
||||
mbl= my_ci_ctype(cs, &ctype, (uchar*)doc, (uchar*)end);
|
||||
if (true_word_char(ctype, *doc))
|
||||
break;
|
||||
if (*doc == FTB_RQUOT && param->quot)
|
||||
|
@ -161,7 +162,7 @@ uchar ft_get_word(CHARSET_INFO *cs, const uchar **start, const uchar *end,
|
|||
for (word->pos= doc; doc < end; length++,
|
||||
doc+= (mbl > 0 ? mbl : (mbl < 0 ? -mbl : 1)))
|
||||
{
|
||||
mbl= cs->cset->ctype(cs, &ctype, (uchar*)doc, (uchar*)end);
|
||||
mbl= my_ci_ctype(cs, &ctype, (uchar*)doc, (uchar*)end);
|
||||
if (true_word_char(ctype, *doc))
|
||||
mwc=0;
|
||||
else if (!misc_word_char(*doc) || mwc)
|
||||
|
@ -214,7 +215,7 @@ uchar ft_simple_get_word(CHARSET_INFO *cs, uchar **start, const uchar *end,
|
|||
{
|
||||
if (doc >= end)
|
||||
DBUG_RETURN(0);
|
||||
mbl= cs->cset->ctype(cs, &ctype, (uchar*)doc, (uchar*)end);
|
||||
mbl= my_ci_ctype(cs, &ctype, (uchar*)doc, (uchar*)end);
|
||||
if (true_word_char(ctype, *doc))
|
||||
break;
|
||||
}
|
||||
|
@ -223,7 +224,7 @@ uchar ft_simple_get_word(CHARSET_INFO *cs, uchar **start, const uchar *end,
|
|||
for (word->pos= doc; doc < end; length++,
|
||||
doc+= (mbl > 0 ? mbl : (mbl < 0 ? -mbl : 1)))
|
||||
{
|
||||
mbl= cs->cset->ctype(cs, &ctype, (uchar*)doc, (uchar*)end);
|
||||
mbl= my_ci_ctype(cs, &ctype, (uchar*)doc, (uchar*)end);
|
||||
if (true_word_char(ctype, *doc))
|
||||
mwc= 0;
|
||||
else if (!misc_word_char(*doc) || mwc)
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
/* Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
Copyright (c) 2020, MariaDB Corporation.
|
||||
|
||||
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
|
||||
|
@ -27,7 +28,9 @@
|
|||
#define FIX_LENGTH(cs, pos, length, char_length) \
|
||||
do { \
|
||||
if (length > char_length) \
|
||||
char_length= my_charpos(cs, pos, pos+length, char_length); \
|
||||
char_length= my_ci_charpos(cs, (const char *) pos, \
|
||||
(const char *) pos+length, \
|
||||
char_length); \
|
||||
set_if_smaller(char_length,length); \
|
||||
} while(0)
|
||||
|
||||
|
@ -109,7 +112,7 @@ uint _mi_make_key(register MI_INFO *info, uint keynr, uchar *key,
|
|||
{
|
||||
if (type != HA_KEYTYPE_NUM)
|
||||
{
|
||||
length= cs->cset->lengthsp(cs, (char*) pos, length);
|
||||
length= my_ci_lengthsp(cs, (char*) pos, length);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -183,7 +186,7 @@ uint _mi_make_key(register MI_INFO *info, uint keynr, uchar *key,
|
|||
FIX_LENGTH(cs, pos, length, char_length);
|
||||
memcpy((uchar*) key, pos, char_length);
|
||||
if (length > char_length)
|
||||
cs->cset->fill(cs, (char*) key+char_length, length-char_length, ' ');
|
||||
my_ci_fill(cs, (char*) key+char_length, length-char_length, ' ');
|
||||
key+= length;
|
||||
}
|
||||
_mi_dpointer(info,key,filepos);
|
||||
|
@ -261,7 +264,7 @@ uint _mi_pack_key(register MI_INFO *info, uint keynr, uchar *key, uchar *old,
|
|||
}
|
||||
else if (type != HA_KEYTYPE_BINARY)
|
||||
{
|
||||
length= cs->cset->lengthsp(cs, (char*) pos, length);
|
||||
length= my_ci_lengthsp(cs, (char*) pos, length);
|
||||
}
|
||||
FIX_LENGTH(cs, pos, length, char_length);
|
||||
store_key_length_inc(key,char_length);
|
||||
|
@ -292,7 +295,7 @@ uint _mi_pack_key(register MI_INFO *info, uint keynr, uchar *key, uchar *old,
|
|||
FIX_LENGTH(cs, pos, length, char_length);
|
||||
memcpy((uchar*) key, pos, char_length);
|
||||
if (length > char_length)
|
||||
cs->cset->fill(cs, (char*) key+char_length, length-char_length, ' ');
|
||||
my_ci_fill(cs, (char*) key+char_length, length-char_length, ' ');
|
||||
key+= length;
|
||||
}
|
||||
if (last_used_keyseg)
|
||||
|
@ -380,8 +383,7 @@ static int _mi_put_key_in_record(register MI_INFO *info, uint keynr,
|
|||
if (keyseg->type != (int) HA_KEYTYPE_NUM)
|
||||
{
|
||||
memcpy(pos,key,(size_t) length);
|
||||
keyseg->charset->cset->fill(keyseg->charset,
|
||||
(char*) pos + length,
|
||||
my_ci_fill(keyseg->charset, (char*) pos + length,
|
||||
keyseg->length - length,
|
||||
' ');
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
/*
|
||||
Copyright (c) 2000, 2011, Oracle and/or its affiliates
|
||||
Copyright (c) 2020, MariaDB Corporation.
|
||||
|
||||
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
|
||||
|
@ -479,8 +480,7 @@ static void update_record(uchar *record)
|
|||
ptr=blob_key;
|
||||
memcpy(pos+4, &ptr, sizeof(char*)); /* Store pointer to new key */
|
||||
if (keyinfo[0].seg[0].type != HA_KEYTYPE_NUM)
|
||||
default_charset_info->cset->casedn(default_charset_info,
|
||||
(char*) blob_key, length,
|
||||
my_ci_casedn(default_charset_info, (char*) blob_key, length,
|
||||
(char*) blob_key, length);
|
||||
pos+=recinfo[1].length;
|
||||
}
|
||||
|
@ -488,16 +488,14 @@ static void update_record(uchar *record)
|
|||
{
|
||||
uint pack_length= HA_VARCHAR_PACKLENGTH(recinfo[1].length-1);
|
||||
uint length= pack_length == 1 ? (uint) *(uchar*) pos : uint2korr(pos);
|
||||
default_charset_info->cset->casedn(default_charset_info,
|
||||
(char*) pos + pack_length, length,
|
||||
my_ci_casedn(default_charset_info, (char*) pos + pack_length, length,
|
||||
(char*) pos + pack_length, length);
|
||||
pos+=recinfo[1].length;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (keyinfo[0].seg[0].type != HA_KEYTYPE_NUM)
|
||||
default_charset_info->cset->casedn(default_charset_info,
|
||||
(char*) pos, keyinfo[0].seg[0].length,
|
||||
my_ci_casedn(default_charset_info, (char*) pos, keyinfo[0].seg[0].length,
|
||||
(char*) pos, keyinfo[0].seg[0].length);
|
||||
pos+=recinfo[1].length;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
/*
|
||||
Copyright (c) 2000, 2010, Oracle and/or its affiliates
|
||||
Copyright (c) 2020, MariaDB Corporation.
|
||||
|
||||
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
|
||||
|
@ -121,9 +122,9 @@ ha_checksum mi_unique_hash(MI_UNIQUEDEF *def, const uchar *record)
|
|||
if (type == HA_KEYTYPE_TEXT || type == HA_KEYTYPE_VARTEXT1 ||
|
||||
type == HA_KEYTYPE_VARTEXT2)
|
||||
{
|
||||
keyseg->charset->coll->hash_sort(keyseg->charset,
|
||||
(const uchar*) pos, length, &seed1,
|
||||
&seed2);
|
||||
my_ci_hash_sort(keyseg->charset,
|
||||
(const uchar*) pos, length,
|
||||
&seed1, &seed2);
|
||||
crc^= seed1;
|
||||
}
|
||||
else
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
/* Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
Copyright (c) 2020, MariaDB Corporation.
|
||||
|
||||
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
|
||||
|
@ -633,7 +634,7 @@ static void configure_instr_class(PFS_instr_class *entry)
|
|||
|
||||
Consecutive wildcards affect the count.
|
||||
*/
|
||||
if (!my_wildcmp(&my_charset_latin1,
|
||||
if (!my_charset_latin1.wildcmp(
|
||||
entry->m_name, entry->m_name+entry->m_name_length,
|
||||
e->m_name, e->m_name+e->m_name_length,
|
||||
'\\', '?','%'))
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue