summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mysql-test/r/ctype_utf8.result12
-rw-r--r--mysql-test/t/ctype_utf8.test11
-rw-r--r--sql/sql_lex.cc21
3 files changed, 32 insertions, 12 deletions
diff --git a/mysql-test/r/ctype_utf8.result b/mysql-test/r/ctype_utf8.result
index 934f56877ac..aa87bfee6a7 100644
--- a/mysql-test/r/ctype_utf8.result
+++ b/mysql-test/r/ctype_utf8.result
@@ -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:
diff --git a/mysql-test/t/ctype_utf8.test b/mysql-test/t/ctype_utf8.test
index 77b76a14171..a3dc781de6a 100644
--- a/mysql-test/t/ctype_utf8.test
+++ b/mysql-test/t/ctype_utf8.test
@@ -879,6 +879,17 @@ 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
#
diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc
index 7d4dca15608..5a355cedca5 100644
--- a/sql/sql_lex.cc
+++ b/sql/sql_lex.cc
@@ -557,23 +557,20 @@ 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;
- return (NCHAR_STRING);
+ yylval->lex_str.length= lex->yytoklen;
+ return(NCHAR_STRING);
case MY_LEX_IDENT_OR_HEX:
if (yyPeek() == '\'')