mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
N'xxx' and _utf8'xxx' are not equivalent
Problem: Unescaping of '\' characters didn't work when processing N'xxx'. Fix: using get_text() instead of get_token() when scanning nationa strings. mysql-test/r/ctype_utf8.result: Adding test case mysql-test/t/ctype_utf8.test: Adding test case sql/sql_lex.cc: Fixing to process national strings using get_tex(), i.e. the same way with usual strings, to make unescaping work.
This commit is contained in:
@ -1066,6 +1066,18 @@ LENGTH(bug)
|
||||
100
|
||||
DROP TABLE t2;
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (item varchar(255)) default character set utf8;
|
||||
INSERT INTO t1 VALUES (N'\\');
|
||||
INSERT INTO t1 VALUES (_utf8'\\');
|
||||
INSERT INTO t1 VALUES (N'Cote d\'Ivoire');
|
||||
INSERT INTO t1 VALUES (_utf8'Cote d\'Ivoire');
|
||||
SELECT item FROM t1 ORDER BY item;
|
||||
item
|
||||
Cote d'Ivoire
|
||||
Cote d'Ivoire
|
||||
\
|
||||
\
|
||||
DROP TABLE t1;
|
||||
SET NAMES utf8;
|
||||
DROP TABLE IF EXISTS t1;
|
||||
Warnings:
|
||||
|
@ -878,6 +878,17 @@ SELECT LENGTH(bug) FROM t2;
|
||||
DROP TABLE t2;
|
||||
DROP TABLE t1;
|
||||
|
||||
#
|
||||
# Bug#17313: N'xxx' and _utf8'xxx' are not equivalent
|
||||
#
|
||||
CREATE TABLE t1 (item varchar(255)) default character set utf8;
|
||||
INSERT INTO t1 VALUES (N'\\');
|
||||
INSERT INTO t1 VALUES (_utf8'\\');
|
||||
INSERT INTO t1 VALUES (N'Cote d\'Ivoire');
|
||||
INSERT INTO t1 VALUES (_utf8'Cote d\'Ivoire');
|
||||
SELECT item FROM t1 ORDER BY item;
|
||||
DROP TABLE t1;
|
||||
|
||||
#
|
||||
# Bug#17705: Corruption of compressed index when index length changes between
|
||||
# 254 and 256
|
||||
|
@ -557,22 +557,19 @@ int MYSQLlex(void *arg, void *yythd)
|
||||
|
||||
case MY_LEX_IDENT_OR_NCHAR:
|
||||
if (yyPeek() != '\'')
|
||||
{ // Found x'hex-number'
|
||||
{
|
||||
state= MY_LEX_IDENT;
|
||||
break;
|
||||
}
|
||||
yyGet(); // Skip '
|
||||
while ((c = yyGet()) && (c !='\'')) ;
|
||||
length=(lex->ptr - lex->tok_start); // Length of hexnum+3
|
||||
if (c != '\'')
|
||||
/* Found N'string' */
|
||||
lex->tok_start++; // Skip N
|
||||
yySkip(); // Skip '
|
||||
if (!(yylval->lex_str.str = get_text(lex)))
|
||||
{
|
||||
return(ABORT_SYM); // Illegal hex constant
|
||||
state= MY_LEX_CHAR; // Read char by char
|
||||
break;
|
||||
}
|
||||
yyGet(); // get_token makes an unget
|
||||
yylval->lex_str=get_token(lex,length);
|
||||
yylval->lex_str.str+=2; // Skip x'
|
||||
yylval->lex_str.length-=3; // Don't count x' and last '
|
||||
lex->yytoklen-=3;
|
||||
yylval->lex_str.length= lex->yytoklen;
|
||||
return(NCHAR_STRING);
|
||||
|
||||
case MY_LEX_IDENT_OR_HEX:
|
||||
|
Reference in New Issue
Block a user