Commit e45cff23 authored by monty@hundin.mysql.fi's avatar monty@hundin.mysql.fi

Merge work:/home/bk/mysql into hundin.mysql.fi:/my/bk/mysql

parents 4eb0f28e b21f2d08
...@@ -46890,6 +46890,9 @@ not yet 100% confident in this code. ...@@ -46890,6 +46890,9 @@ not yet 100% confident in this code.
@appendixsubsec Changes in release 3.23.49 @appendixsubsec Changes in release 3.23.49
@itemize @bullet @itemize @bullet
@item @item
Don't give warning for statement that is only a comment; This is needed for
@code{mysqldump --disable-keys} to work.
@item
Fixed unlikely caching bug when doing a join without keys. In this case Fixed unlikely caching bug when doing a join without keys. In this case
the last used field for a table always returned @code{NULL}. the last used field for a table always returned @code{NULL}.
@item @item
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
select 1+2/*hello*/+3; select 1+2/*hello*/+3;
select 1 /* long select 1 /* long
multi line comment */; multi line comment */;
!$1065 /* empty query */; !$1065 ;
select 1 /*!32301 +1 */; select 1 /*!32301 +1 */;
select 1 /*!52301 +1 */; select 1 /*!52301 +1 */;
select 1--1; select 1--1;
...@@ -15,3 +15,4 @@ select 1 --2 ...@@ -15,3 +15,4 @@ select 1 --2
+1; +1;
select 1 # The rest of the row will be ignored select 1 # The rest of the row will be ignored
; ;
/* line with only comment */;
...@@ -158,7 +158,8 @@ void kill_one_thread(THD *thd, ulong id); ...@@ -158,7 +158,8 @@ void kill_one_thread(THD *thd, ulong id);
#define OPTION_LOW_PRIORITY_UPDATES 8192 #define OPTION_LOW_PRIORITY_UPDATES 8192
#define OPTION_WARNINGS 16384 #define OPTION_WARNINGS 16384
#define OPTION_AUTO_IS_NULL 32768 #define OPTION_AUTO_IS_NULL 32768
#define OPTION_SAFE_UPDATES 65536L*2 #define OPTION_FOUND_COMMENT 65536L
#define OPTION_SAFE_UPDATES OPTION_FOUND_COMMENT*2
#define OPTION_BUFFER_RESULT OPTION_SAFE_UPDATES*2 #define OPTION_BUFFER_RESULT OPTION_SAFE_UPDATES*2
#define OPTION_BIN_LOG OPTION_BUFFER_RESULT*2 #define OPTION_BIN_LOG OPTION_BUFFER_RESULT*2
#define OPTION_NOT_AUTO_COMMIT OPTION_BIN_LOG*2 #define OPTION_NOT_AUTO_COMMIT OPTION_BIN_LOG*2
......
...@@ -734,6 +734,7 @@ int yylex(void *arg) ...@@ -734,6 +734,7 @@ int yylex(void *arg)
return(TEXT_STRING); return(TEXT_STRING);
case STATE_COMMENT: // Comment case STATE_COMMENT: // Comment
lex->options|= OPTION_FOUND_COMMENT;
while ((c = yyGet()) != '\n' && c) ; while ((c = yyGet()) != '\n' && c) ;
yyUnget(); // Safety against eof yyUnget(); // Safety against eof
state = STATE_START; // Try again state = STATE_START; // Try again
...@@ -745,6 +746,7 @@ int yylex(void *arg) ...@@ -745,6 +746,7 @@ int yylex(void *arg)
break; break;
} }
yySkip(); // Skip '*' yySkip(); // Skip '*'
lex->options|= OPTION_FOUND_COMMENT;
if (yyPeek() == '!') // MySQL command in comment if (yyPeek() == '!') // MySQL command in comment
{ {
ulong version=MYSQL_VERSION_ID; ulong version=MYSQL_VERSION_ID;
......
...@@ -53,7 +53,7 @@ enum enum_sql_command { ...@@ -53,7 +53,7 @@ enum enum_sql_command {
SQLCOM_BEGIN, SQLCOM_LOAD_MASTER_TABLE, SQLCOM_CHANGE_MASTER, SQLCOM_BEGIN, SQLCOM_LOAD_MASTER_TABLE, SQLCOM_CHANGE_MASTER,
SQLCOM_RENAME_TABLE, SQLCOM_BACKUP_TABLE, SQLCOM_RESTORE_TABLE, SQLCOM_RENAME_TABLE, SQLCOM_BACKUP_TABLE, SQLCOM_RESTORE_TABLE,
SQLCOM_RESET, SQLCOM_PURGE, SQLCOM_SHOW_BINLOGS, SQLCOM_RESET, SQLCOM_PURGE, SQLCOM_SHOW_BINLOGS,
SQLCOM_SHOW_OPEN_TABLES, SQLCOM_DO, SQLCOM_SHOW_OPEN_TABLES, SQLCOM_DO, SQLCOM_EMPTY_QUERY,
SQLCOM_END SQLCOM_END
}; };
......
...@@ -1181,6 +1181,10 @@ mysql_execute_command(void) ...@@ -1181,6 +1181,10 @@ mysql_execute_command(void)
res=mysql_do(thd, *lex->insert_list); res=mysql_do(thd, *lex->insert_list);
break; break;
case SQLCOM_EMPTY_QUERY:
send_ok(&thd->net);
break;
case SQLCOM_PURGE: case SQLCOM_PURGE:
{ {
if (check_process_priv(thd)) if (check_process_priv(thd))
......
...@@ -544,9 +544,17 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize); ...@@ -544,9 +544,17 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize);
query: query:
END_OF_INPUT END_OF_INPUT
{ {
if (!current_thd->bootstrap) THD *thd=current_thd;
if (!thd->bootstrap &&
(!(thd->lex.options & OPTION_FOUND_COMMENT)))
{
send_error(&current_thd->net,ER_EMPTY_QUERY); send_error(&current_thd->net,ER_EMPTY_QUERY);
YYABORT; YYABORT;
}
else
{
thd->lex.sql_command = SQLCOM_EMPTY_QUERY;
}
} }
| verb_clause END_OF_INPUT {} | verb_clause END_OF_INPUT {}
......
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