Commit ec68494b authored by Alexander Barkov's avatar Alexander Barkov

MDEV-7677 my_charset_handler_filename has a wrong "ismbchar" member

parent 4fbba098
...@@ -11,3 +11,10 @@ create table com1 (a int); ...@@ -11,3 +11,10 @@ create table com1 (a int);
drop table com1; drop table com1;
create table `clock$` (a int); create table `clock$` (a int);
drop table `clock$`; drop table `clock$`;
#
# MDEV-7677 my_charset_handler_filename has a wrong "ismbchar" member
#
SET NAMES utf8;
SELECT @a:=CONVERT('aя' USING filename) AS `@a`, BINARY @a, REVERSE(@a), HEX(@a), HEX(REVERSE(@a));
@a BINARY @a REVERSE(@a) HEX(@a) HEX(REVERSE(@a))
aя a@r1 яa 61407231 40723161
...@@ -19,3 +19,9 @@ drop table com1; ...@@ -19,3 +19,9 @@ drop table com1;
create table `clock$` (a int); create table `clock$` (a int);
drop table `clock$`; drop table `clock$`;
--echo #
--echo # MDEV-7677 my_charset_handler_filename has a wrong "ismbchar" member
--echo #
SET NAMES utf8;
SELECT @a:=CONVERT('aя' USING filename) AS `@a`, BINARY @a, REVERSE(@a), HEX(@a), HEX(REVERSE(@a));
...@@ -7098,7 +7098,7 @@ my_wc_mb_filename(CHARSET_INFO *cs __attribute__((unused)), ...@@ -7098,7 +7098,7 @@ my_wc_mb_filename(CHARSET_INFO *cs __attribute__((unused)),
my_wc_t wc, uchar *s, uchar *e) my_wc_t wc, uchar *s, uchar *e)
{ {
int code; int code;
char hex[]= "0123456789abcdef"; static const char hex[]= "0123456789abcdef";
if (s >= e) if (s >= e)
return MY_CS_TOOSMALL; return MY_CS_TOOSMALL;
...@@ -7144,6 +7144,15 @@ my_charlen_filename(CHARSET_INFO *cs, const uchar *str, const uchar *end) ...@@ -7144,6 +7144,15 @@ my_charlen_filename(CHARSET_INFO *cs, const uchar *str, const uchar *end)
} }
static uint
my_ismbchar_filename(CHARSET_INFO *cs, const char *str, const char *end)
{
my_wc_t wc;
int rc= my_mb_wc_filename(cs, &wc, (const uchar *) str, (const uchar *) end);
return rc > 1 ? rc : 0;
}
#define MY_FUNCTION_NAME(x) my_ ## x ## _filename #define MY_FUNCTION_NAME(x) my_ ## x ## _filename
#define CHARLEN(cs,str,end) my_charlen_filename(cs,str,end) #define CHARLEN(cs,str,end) my_charlen_filename(cs,str,end)
#define DEFINE_WELL_FORMED_CHAR_LENGTH_USING_CHARLEN #define DEFINE_WELL_FORMED_CHAR_LENGTH_USING_CHARLEN
...@@ -7172,7 +7181,7 @@ static MY_COLLATION_HANDLER my_collation_filename_handler = ...@@ -7172,7 +7181,7 @@ static MY_COLLATION_HANDLER my_collation_filename_handler =
static MY_CHARSET_HANDLER my_charset_filename_handler= static MY_CHARSET_HANDLER my_charset_filename_handler=
{ {
NULL, /* init */ NULL, /* init */
my_ismbchar_utf8, my_ismbchar_filename,
my_mbcharlen_utf8, my_mbcharlen_utf8,
my_numchars_mb, my_numchars_mb,
my_charpos_mb, my_charpos_mb,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment