From fa7faa2955cf6d6c0af294c3ad6714e206ee2889 Mon Sep 17 00:00:00 2001 From: Alexander Barkov Date: Wed, 18 Dec 2013 01:08:39 +0400 Subject: MDEV-5009 don't look inside /*!50700 ... */ comments --- sql/sql_lex.cc | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) (limited to 'sql/sql_lex.cc') diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc index 9941c124f4d..9acbdc641eb 100644 --- a/sql/sql_lex.cc +++ b/sql/sql_lex.cc @@ -1515,19 +1515,14 @@ int lex_one_token(void *arg, THD *thd) lip->save_in_comment_state(); - if (lip->yyPeekn(2) == 'M' && lip->yyPeekn(3) == '!') - { - /* Skip MariaDB unique marker */ - lip->set_echo(FALSE); - lip->yySkip(); - /* The following if will be true */ - } - if (lip->yyPeekn(2) == '!') + if (lip->yyPeekn(2) == '!' || + (lip->yyPeekn(2) == 'M' && lip->yyPeekn(3) == '!')) { + bool maria_comment_syntax= lip->yyPeekn(2) == 'M'; lip->in_comment= DISCARD_COMMENT; /* Accept '/' '*' '!', but do not keep this marker. */ lip->set_echo(FALSE); - lip->yySkipn(3); + lip->yySkipn(maria_comment_syntax ? 4 : 3); /* The special comment format is very strict: @@ -1557,7 +1552,14 @@ int lex_one_token(void *arg, THD *thd) version= (ulong) my_strtoll10(lip->get_ptr(), &end_ptr, &error); - if (version <= MYSQL_VERSION_ID) + /* + MySQL-5.7 has new features and might have new SQL syntax that + MariaDB-10.0 does not understand. Ignore all versioned comments + with MySQL versions in the range 50700–999999, but + do not ignore MariaDB specific comments for the same versions. + */ + if (version <= MYSQL_VERSION_ID && + (version < 50700 || version > 999999 || maria_comment_syntax)) { /* Accept 'M' 'm' 'm' 'd' 'd' */ lip->yySkipn(length); -- cgit v1.2.1