Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
b21f2d08
Commit
b21f2d08
authored
Feb 14, 2002
by
monty@hundin.mysql.fi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Don't give warnings for empty statements with comments
parent
d76fcdc5
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
24 additions
and
5 deletions
+24
-5
Docs/manual.texi
Docs/manual.texi
+3
-0
mysql-test/t/comments.test
mysql-test/t/comments.test
+2
-1
sql/mysql_priv.h
sql/mysql_priv.h
+2
-1
sql/sql_lex.cc
sql/sql_lex.cc
+2
-0
sql/sql_lex.h
sql/sql_lex.h
+1
-1
sql/sql_parse.cc
sql/sql_parse.cc
+4
-0
sql/sql_yacc.yy
sql/sql_yacc.yy
+10
-2
No files found.
Docs/manual.texi
View file @
b21f2d08
...
...
@@ -46890,6 +46890,9 @@ not yet 100% confident in this code.
@appendixsubsec Changes in release 3.23.49
@itemize @bullet
@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
the last used field for a table always returned @code{NULL}.
@item
mysql-test/t/comments.test
View file @
b21f2d08
...
...
@@ -5,7 +5,7 @@
select
1
+
2
/*hello*/
+
3
;
select
1
/* long
multi line comment */
;
!
$
1065
/* empty query */
;
!
$
1065
;
select
1
/*!32301 +1 */
;
select
1
/*!52301 +1 */
;
select
1
--
1
;
...
...
@@ -15,3 +15,4 @@ select 1 --2
+
1
;
select
1
# The rest of the row will be ignored
;
/* line with only comment */
;
sql/mysql_priv.h
View file @
b21f2d08
...
...
@@ -158,7 +158,8 @@ void kill_one_thread(THD *thd, ulong id);
#define OPTION_LOW_PRIORITY_UPDATES 8192
#define OPTION_WARNINGS 16384
#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_BIN_LOG OPTION_BUFFER_RESULT*2
#define OPTION_NOT_AUTO_COMMIT OPTION_BIN_LOG*2
...
...
sql/sql_lex.cc
View file @
b21f2d08
...
...
@@ -734,6 +734,7 @@ int yylex(void *arg)
return
(
TEXT_STRING
);
case
STATE_COMMENT
:
// Comment
lex
->
options
|=
OPTION_FOUND_COMMENT
;
while
((
c
=
yyGet
())
!=
'\n'
&&
c
)
;
yyUnget
();
// Safety against eof
state
=
STATE_START
;
// Try again
...
...
@@ -745,6 +746,7 @@ int yylex(void *arg)
break
;
}
yySkip
();
// Skip '*'
lex
->
options
|=
OPTION_FOUND_COMMENT
;
if
(
yyPeek
()
==
'!'
)
// MySQL command in comment
{
ulong
version
=
MYSQL_VERSION_ID
;
...
...
sql/sql_lex.h
View file @
b21f2d08
...
...
@@ -53,7 +53,7 @@ enum enum_sql_command {
SQLCOM_BEGIN
,
SQLCOM_LOAD_MASTER_TABLE
,
SQLCOM_CHANGE_MASTER
,
SQLCOM_RENAME_TABLE
,
SQLCOM_BACKUP_TABLE
,
SQLCOM_RESTORE_TABLE
,
SQLCOM_RESET
,
SQLCOM_PURGE
,
SQLCOM_SHOW_BINLOGS
,
SQLCOM_SHOW_OPEN_TABLES
,
SQLCOM_DO
,
SQLCOM_SHOW_OPEN_TABLES
,
SQLCOM_DO
,
SQLCOM_EMPTY_QUERY
,
SQLCOM_END
};
...
...
sql/sql_parse.cc
View file @
b21f2d08
...
...
@@ -1181,6 +1181,10 @@ mysql_execute_command(void)
res
=
mysql_do
(
thd
,
*
lex
->
insert_list
);
break
;
case
SQLCOM_EMPTY_QUERY
:
send_ok
(
&
thd
->
net
);
break
;
case
SQLCOM_PURGE
:
{
if
(
check_process_priv
(
thd
))
...
...
sql/sql_yacc.yy
View file @
b21f2d08
...
...
@@ -544,9 +544,17 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize);
query:
END_OF_INPUT
{
if (!current_thd->bootstrap)
THD *thd=current_thd;
if (!thd->bootstrap &&
(!(thd->lex.options & OPTION_FOUND_COMMENT)))
{
send_error(¤t_thd->net,ER_EMPTY_QUERY);
YYABORT;
YYABORT;
}
else
{
thd->lex.sql_command = SQLCOM_EMPTY_QUERY;
}
}
| verb_clause END_OF_INPUT {}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment