summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Widenius <monty@askmonty.org>2014-02-11 21:43:08 +0200
committerMichael Widenius <monty@askmonty.org>2014-02-11 21:43:08 +0200
commit55829ac13d763589c50b880a98664852fd7c7e99 (patch)
treec8ca868b88f21a5f10a51a340d16cf50679c2e67
parent1bdf2151dad679a8c13d2856d3baa32515a6db35 (diff)
downloadmariadb-git-55829ac13d763589c50b880a98664852fd7c7e99.tar.gz
Support 6 digit version numbers in executable comment syntax.
This is needed to be able to ignore executable comments from version 10.0.
-rw-r--r--mysql-test/r/comments.result5
-rw-r--r--mysql-test/t/comments.test3
-rw-r--r--sql/sql_lex.cc33
3 files changed, 24 insertions, 17 deletions
diff --git a/mysql-test/r/comments.result b/mysql-test/r/comments.result
index 8aebe95c5ac..3a752221780 100644
--- a/mysql-test/r/comments.result
+++ b/mysql-test/r/comments.result
@@ -38,11 +38,14 @@ select 1 /*M!50300 +1 */;
select 2 /*M!99999 +1 */;
2
2
+select 2 /*M!100000 +1 */;
+2
+2
select 2 /*M!0000 +1 */;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '0000 +1 */' at line 1
select 1/*!2*/;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '2*/' at line 1
-select 1/*!000002*/;
+select 1/*!0000002*/;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '2*/' at line 1
select 1/*!999992*/;
1
diff --git a/mysql-test/t/comments.test b/mysql-test/t/comments.test
index 08c74c99d0c..4d47674650c 100644
--- a/mysql-test/t/comments.test
+++ b/mysql-test/t/comments.test
@@ -28,6 +28,7 @@ select 1 /*M! +1 */;
select 1 /*M!50000 +1 */;
select 1 /*M!50300 +1 */;
select 2 /*M!99999 +1 */;
+select 2 /*M!100000 +1 */;
--error ER_PARSE_ERROR
select 2 /*M!0000 +1 */;
@@ -39,7 +40,7 @@ select 2 /*M!0000 +1 */;
select 1/*!2*/;
--error ER_PARSE_ERROR
-select 1/*!000002*/;
+select 1/*!0000002*/;
select 1/*!999992*/;
diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc
index 043841cbb6a..8dab2191224 100644
--- a/sql/sql_lex.cc
+++ b/sql/sql_lex.cc
@@ -1509,27 +1509,23 @@ 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:
'/' '*' '!', followed by an optional 'M' and exactly
- 1 digit (major), 2 digits (minor), then 2 digits (dot).
- 32302 -> 3.23.02
- 50032 -> 5.0.32
- 50114 -> 5.1.14
+ 1-2 digits (major), 2 digits (minor), then 2 digits (dot).
+ 32302 -> 3.23.02
+ 50032 -> 5.0.32
+ 50114 -> 5.1.14
+ 100000 -> 10.0.0
*/
if ( my_isdigit(cs, lip->yyPeekn(0))
&& my_isdigit(cs, lip->yyPeekn(1))
@@ -1539,14 +1535,21 @@ int lex_one_token(void *arg, THD *thd)
)
{
ulong version;
- char *end_ptr= (char*) lip->get_ptr()+5;
+ uint length= 5;
+ char *end_ptr= (char*) lip->get_ptr()+length;
int error;
+ if (my_isdigit(cs, lip->yyPeekn(5)))
+ {
+ end_ptr++; // 6 digit number
+ length++;
+ }
+
version= (ulong) my_strtoll10(lip->get_ptr(), &end_ptr, &error);
if (version <= MYSQL_VERSION_ID)
{
/* Accept 'M' 'm' 'm' 'd' 'd' */
- lip->yySkipn(5);
+ lip->yySkipn(length);
/* Expand the content of the special comment as real code */
lip->set_echo(TRUE);
state=MY_LEX_START;