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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
48664555
Commit
48664555
authored
Feb 14, 2002
by
unknown
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Don't give warnings for empty statements with comments
parent
01f1db42
Changes
7
Show 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 @
48664555
...
@@ -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
mysql-test/t/comments.test
View file @
48664555
...
@@ -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 */
;
sql/mysql_priv.h
View file @
48664555
...
@@ -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
...
...
sql/sql_lex.cc
View file @
48664555
...
@@ -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
;
...
...
sql/sql_lex.h
View file @
48664555
...
@@ -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
};
};
...
...
sql/sql_parse.cc
View file @
48664555
...
@@ -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
))
...
...
sql/sql_yacc.yy
View file @
48664555
...
@@ -544,10 +544,18 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize);
...
@@ -544,10 +544,18 @@ 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(¤t_thd->net,ER_EMPTY_QUERY);
send_error(¤t_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 {}
verb_clause:
verb_clause:
...
...
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