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
a1d21d89
Commit
a1d21d89
authored
Jan 23, 2003
by
pem@mysql.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added check for selects without into in SPs, and updated error messages and tests
accordingly.
parent
1fd48663
Changes
27
Hide whitespace changes
Inline
Side-by-side
Showing
27 changed files
with
119 additions
and
79 deletions
+119
-79
include/mysqld_error.h
include/mysqld_error.h
+5
-5
mysql-test/r/sp.result
mysql-test/r/sp.result
+13
-0
mysql-test/t/sp.test
mysql-test/t/sp.test
+18
-0
sql/share/czech/errmsg.txt
sql/share/czech/errmsg.txt
+3
-3
sql/share/danish/errmsg.txt
sql/share/danish/errmsg.txt
+3
-3
sql/share/dutch/errmsg.txt
sql/share/dutch/errmsg.txt
+3
-3
sql/share/english/errmsg.txt
sql/share/english/errmsg.txt
+2
-2
sql/share/estonian/errmsg.txt
sql/share/estonian/errmsg.txt
+3
-3
sql/share/french/errmsg.txt
sql/share/french/errmsg.txt
+3
-3
sql/share/german/errmsg.txt
sql/share/german/errmsg.txt
+3
-3
sql/share/greek/errmsg.txt
sql/share/greek/errmsg.txt
+3
-3
sql/share/hungarian/errmsg.txt
sql/share/hungarian/errmsg.txt
+3
-3
sql/share/italian/errmsg.txt
sql/share/italian/errmsg.txt
+3
-3
sql/share/japanese/errmsg.txt
sql/share/japanese/errmsg.txt
+3
-3
sql/share/korean/errmsg.txt
sql/share/korean/errmsg.txt
+3
-3
sql/share/norwegian-ny/errmsg.txt
sql/share/norwegian-ny/errmsg.txt
+3
-3
sql/share/norwegian/errmsg.txt
sql/share/norwegian/errmsg.txt
+3
-3
sql/share/polish/errmsg.txt
sql/share/polish/errmsg.txt
+3
-3
sql/share/portuguese/errmsg.txt
sql/share/portuguese/errmsg.txt
+3
-3
sql/share/romanian/errmsg.txt
sql/share/romanian/errmsg.txt
+3
-3
sql/share/russian/errmsg.txt
sql/share/russian/errmsg.txt
+3
-3
sql/share/serbian/errmsg.txt
sql/share/serbian/errmsg.txt
+3
-3
sql/share/slovak/errmsg.txt
sql/share/slovak/errmsg.txt
+3
-3
sql/share/spanish/errmsg.txt
sql/share/spanish/errmsg.txt
+3
-3
sql/share/swedish/errmsg.txt
sql/share/swedish/errmsg.txt
+3
-3
sql/share/ukrainian/errmsg.txt
sql/share/ukrainian/errmsg.txt
+3
-3
sql/sql_yacc.yy
sql/sql_yacc.yy
+15
-6
No files found.
include/mysqld_error.h
View file @
a1d21d89
...
...
@@ -271,10 +271,10 @@
#define ER_SP_DOES_NOT_EXIST 1252
#define ER_SP_DROP_FAILED 1253
#define ER_SP_STORE_FAILED 1254
#define ER_SP_L
EAVE
_MISMATCH 1255
#define ER_SP_
ITERATE_MISMATCH
1256
#define ER_SP_LABEL_
REDEFINE
1257
#define ER_SP_
LABEL_MISMATCH
1258
#define ER_SP_
UNINIT_VAR
1259
#define ER_SP_L
ILABEL
_MISMATCH 1255
#define ER_SP_
LABEL_REDEFINE
1256
#define ER_SP_LABEL_
MISMATCH
1257
#define ER_SP_
UNINIT_VAR
1258
#define ER_SP_
BADSELECT
1259
#define ER_ERROR_MESSAGES 260
mysql-test/r/sp.result
View file @
a1d21d89
...
...
@@ -76,6 +76,19 @@ repeat
insert into test.t1 values (repeat("b",3), x);
set x = x-1;
until x = 0 end repeat;
create procedure b2(x int)
repeat(select 1 into outfile 'b2');
insert into test.t1 values (repeat("b2",3), x);
set x = x-1;
until x = 0 end repeat;
drop procedure b2;
create procedure b3(x int)
repeat
select * from test.t1; # No INTO!
insert into test.t1 values (repeat("b3",3), x);
set x = x-1;
until x = 0 end repeat;
SELECT in a stored procedure must have INTO
create procedure c(x int)
hmm: while x > 0 do
insert into test.t1 values ("c", x);
...
...
mysql-test/t/sp.test
View file @
a1d21d89
...
...
@@ -127,6 +127,24 @@ repeat
set
x
=
x
-
1
;
until
x
=
0
end
repeat
|
# Check that repeat isn't parsed the wrong way
create
procedure
b2
(
x
int
)
repeat
(
select
1
into
outfile
'b2'
);
insert
into
test
.
t1
values
(
repeat
(
"b2"
,
3
),
x
);
set
x
=
x
-
1
;
until
x
=
0
end
repeat
|
# We don't actually want to call it.
drop
procedure
b2
|
# Btw, this should generate an error
--
error
1259
create
procedure
b3
(
x
int
)
repeat
select
*
from
test
.
t1
;
# No INTO!
insert
into
test
.
t1
values
(
repeat
(
"b3"
,
3
),
x
);
set
x
=
x
-
1
;
until
x
=
0
end
repeat
|
# Labelled WHILE with ITERATE (pointless really)
create
procedure
c
(
x
int
)
hmm
:
while
x
>
0
do
...
...
sql/share/czech/errmsg.txt
View file @
a1d21d89
...
...
@@ -264,9 +264,9 @@ v/*
"PROCEDURE already exists"
"PROCEDURE does not exist"
"Failed to DROP PROCEDURE"
"Failed to store PROCEDURE"
"LEAVE with no matching label"
"ITERATE with no matching label"
"Failed to CREATE PROCEDURE"
"%s with no matching label"
"Redefining label"
"End-label without match"
"Referring to uninitialized variable"
"SELECT in a stored procedure must have INTO"
sql/share/danish/errmsg.txt
View file @
a1d21d89
...
...
@@ -258,9 +258,9 @@
"PROCEDURE already exists"
"PROCEDURE does not exist"
"Failed to DROP PROCEDURE"
"Failed to store PROCEDURE"
"LEAVE with no matching label"
"ITERATE with no matching label"
"Failed to CREATE PROCEDURE"
"%s with no matching label"
"Redefining label"
"End-label without match"
"Referring to uninitialized variable"
"SELECT in a stored procedure must have INTO"
sql/share/dutch/errmsg.txt
View file @
a1d21d89
...
...
@@ -266,9 +266,9 @@
"PROCEDURE already exists"
"PROCEDURE does not exist"
"Failed to DROP PROCEDURE"
"Failed to store PROCEDURE"
"LEAVE with no matching label"
"ITERATE with no matching label"
"Failed to CREATE PROCEDURE"
"%s with no matching label"
"Redefining label"
"End-label without match"
"Referring to uninitialized variable"
"SELECT in a stored procedure must have INTO"
sql/share/english/errmsg.txt
View file @
a1d21d89
...
...
@@ -256,8 +256,8 @@
"PROCEDURE does not exist"
"Failed to DROP PROCEDURE"
"Failed to CREATE PROCEDURE"
"LEAVE with no matching label"
"ITERATE with no matching label"
"%s with no matching label"
"Redefining label"
"End-label without match"
"Referring to uninitialized variable"
"SELECT in a stored procedure must have INTO"
sql/share/estonian/errmsg.txt
View file @
a1d21d89
...
...
@@ -260,9 +260,9 @@
"PROCEDURE already exists"
"PROCEDURE does not exist"
"Failed to DROP PROCEDURE"
"Failed to store PROCEDURE"
"LEAVE with no matching label"
"ITERATE with no matching label"
"Failed to CREATE PROCEDURE"
"%s with no matching label"
"Redefining label"
"End-label without match"
"Referring to uninitialized variable"
"SELECT in a stored procedure must have INTO"
sql/share/french/errmsg.txt
View file @
a1d21d89
...
...
@@ -255,9 +255,9 @@
"PROCEDURE already exists"
"PROCEDURE does not exist"
"Failed to DROP PROCEDURE"
"Failed to store PROCEDURE"
"LEAVE with no matching label"
"ITERATE with no matching label"
"Failed to CREATE PROCEDURE"
"%s with no matching label"
"Redefining label"
"End-label without match"
"Referring to uninitialized variable"
"SELECT in a stored procedure must have INTO"
sql/share/german/errmsg.txt
View file @
a1d21d89
...
...
@@ -265,9 +265,9 @@
"PROCEDURE already exists"
"PROCEDURE does not exist"
"Failed to DROP PROCEDURE"
"Failed to store PROCEDURE"
"LEAVE with no matching label"
"ITERATE with no matching label"
"Failed to CREATE PROCEDURE"
"%s with no matching label"
"Redefining label"
"End-label without match"
"Referring to uninitialized variable"
"SELECT in a stored procedure must have INTO"
sql/share/greek/errmsg.txt
View file @
a1d21d89
...
...
@@ -255,9 +255,9 @@
"PROCEDURE already exists"
"PROCEDURE does not exist"
"Failed to DROP PROCEDURE"
"Failed to store PROCEDURE"
"LEAVE with no matching label"
"ITERATE with no matching label"
"Failed to CREATE PROCEDURE"
"%s with no matching label"
"Redefining label"
"End-label without match"
"Referring to uninitialized variable"
"SELECT in a stored procedure must have INTO"
sql/share/hungarian/errmsg.txt
View file @
a1d21d89
...
...
@@ -257,9 +257,9 @@
"PROCEDURE already exists"
"PROCEDURE does not exist"
"Failed to DROP PROCEDURE"
"Failed to store PROCEDURE"
"LEAVE with no matching label"
"ITERATE with no matching label"
"Failed to CREATE PROCEDURE"
"%s with no matching label"
"Redefining label"
"End-label without match"
"Referring to uninitialized variable"
"SELECT in a stored procedure must have INTO"
sql/share/italian/errmsg.txt
View file @
a1d21d89
...
...
@@ -255,9 +255,9 @@
"PROCEDURE already exists"
"PROCEDURE does not exist"
"Failed to DROP PROCEDURE"
"Failed to store PROCEDURE"
"LEAVE with no matching label"
"ITERATE with no matching label"
"Failed to CREATE PROCEDURE"
"%s with no matching label"
"Redefining label"
"End-label without match"
"Referring to uninitialized variable"
"SELECT in a stored procedure must have INTO"
sql/share/japanese/errmsg.txt
View file @
a1d21d89
...
...
@@ -257,9 +257,9 @@
"PROCEDURE already exists"
"PROCEDURE does not exist"
"Failed to DROP PROCEDURE"
"Failed to store PROCEDURE"
"LEAVE with no matching label"
"ITERATE with no matching label"
"Failed to CREATE PROCEDURE"
"%s with no matching label"
"Redefining label"
"End-label without match"
"Referring to uninitialized variable"
"SELECT in a stored procedure must have INTO"
sql/share/korean/errmsg.txt
View file @
a1d21d89
...
...
@@ -255,9 +255,9 @@
"PROCEDURE already exists"
"PROCEDURE does not exist"
"Failed to DROP PROCEDURE"
"Failed to store PROCEDURE"
"LEAVE with no matching label"
"ITERATE with no matching label"
"Failed to CREATE PROCEDURE"
"%s with no matching label"
"Redefining label"
"End-label without match"
"Referring to uninitialized variable"
"SELECT in a stored procedure must have INTO"
sql/share/norwegian-ny/errmsg.txt
View file @
a1d21d89
...
...
@@ -257,9 +257,9 @@
"PROCEDURE already exists"
"PROCEDURE does not exist"
"Failed to DROP PROCEDURE"
"Failed to store PROCEDURE"
"LEAVE with no matching label"
"ITERATE with no matching label"
"Failed to CREATE PROCEDURE"
"%s with no matching label"
"Redefining label"
"End-label without match"
"Referring to uninitialized variable"
"SELECT in a stored procedure must have INTO"
sql/share/norwegian/errmsg.txt
View file @
a1d21d89
...
...
@@ -257,9 +257,9 @@
"PROCEDURE already exists"
"PROCEDURE does not exist"
"Failed to DROP PROCEDURE"
"Failed to store PROCEDURE"
"LEAVE with no matching label"
"ITERATE with no matching label"
"Failed to CREATE PROCEDURE"
"%s with no matching label"
"Redefining label"
"End-label without match"
"Referring to uninitialized variable"
"SELECT in a stored procedure must have INTO"
sql/share/polish/errmsg.txt
View file @
a1d21d89
...
...
@@ -259,9 +259,9 @@
"PROCEDURE already exists"
"PROCEDURE does not exist"
"Failed to DROP PROCEDURE"
"Failed to store PROCEDURE"
"LEAVE with no matching label"
"ITERATE with no matching label"
"Failed to CREATE PROCEDURE"
"%s with no matching label"
"Redefining label"
"End-label without match"
"Referring to uninitialized variable"
"SELECT in a stored procedure must have INTO"
sql/share/portuguese/errmsg.txt
View file @
a1d21d89
...
...
@@ -255,9 +255,9 @@
"PROCEDURE already exists"
"PROCEDURE does not exist"
"Failed to DROP PROCEDURE"
"Failed to store PROCEDURE"
"LEAVE with no matching label"
"ITERATE with no matching label"
"Failed to CREATE PROCEDURE"
"%s with no matching label"
"Redefining label"
"End-label without match"
"Referring to uninitialized variable"
"SELECT in a stored procedure must have INTO"
sql/share/romanian/errmsg.txt
View file @
a1d21d89
...
...
@@ -259,9 +259,9 @@
"PROCEDURE already exists"
"PROCEDURE does not exist"
"Failed to DROP PROCEDURE"
"Failed to store PROCEDURE"
"LEAVE with no matching label"
"ITERATE with no matching label"
"Failed to CREATE PROCEDURE"
"%s with no matching label"
"Redefining label"
"End-label without match"
"Referring to uninitialized variable"
"SELECT in a stored procedure must have INTO"
sql/share/russian/errmsg.txt
View file @
a1d21d89
...
...
@@ -258,9 +258,9 @@
"PROCEDURE already exists"
"PROCEDURE does not exist"
"Failed to DROP PROCEDURE"
"Failed to store PROCEDURE"
"LEAVE with no matching label"
"ITERATE with no matching label"
"Failed to CREATE PROCEDURE"
"%s with no matching label"
"Redefining label"
"End-label without match"
"Referring to uninitialized variable"
"SELECT in a stored procedure must have INTO"
sql/share/serbian/errmsg.txt
View file @
a1d21d89
...
...
@@ -251,9 +251,9 @@
"PROCEDURE already exists"
"PROCEDURE does not exist"
"Failed to DROP PROCEDURE"
"Failed to store PROCEDURE"
"LEAVE with no matching label"
"ITERATE with no matching label"
"Failed to CREATE PROCEDURE"
"%s with no matching label"
"Redefining label"
"End-label without match"
"Referring to uninitialized variable"
"SELECT in a stored procedure must have INTO"
sql/share/slovak/errmsg.txt
View file @
a1d21d89
...
...
@@ -263,9 +263,9 @@
"PROCEDURE already exists"
"PROCEDURE does not exist"
"Failed to DROP PROCEDURE"
"Failed to store PROCEDURE"
"LEAVE with no matching label"
"ITERATE with no matching label"
"Failed to CREATE PROCEDURE"
"%s with no matching label"
"Redefining label"
"End-label without match"
"Referring to uninitialized variable"
"SELECT in a stored procedure must have INTO"
sql/share/spanish/errmsg.txt
View file @
a1d21d89
...
...
@@ -256,9 +256,9 @@
"PROCEDURE already exists"
"PROCEDURE does not exist"
"Failed to DROP PROCEDURE"
"Failed to store PROCEDURE"
"LEAVE with no matching label"
"ITERATE with no matching label"
"Failed to CREATE PROCEDURE"
"%s with no matching label"
"Redefining label"
"End-label without match"
"Referring to uninitialized variable"
"SELECT in a stored procedure must have INTO"
sql/share/swedish/errmsg.txt
View file @
a1d21d89
...
...
@@ -255,9 +255,9 @@
"PROCEDURE already exists"
"PROCEDURE does not exist"
"Failed to DROP PROCEDURE"
"Failed to store PROCEDURE"
"LEAVE with no matching label"
"ITERATE with no matching label"
"Failed to CREATE PROCEDURE"
"%s with no matching label"
"Redefining label"
"End-label without match"
"Referring to uninitialized variable"
"SELECT in a stored procedure must have INTO"
sql/share/ukrainian/errmsg.txt
View file @
a1d21d89
...
...
@@ -260,9 +260,9 @@
"PROCEDURE already exists"
"PROCEDURE does not exist"
"Failed to DROP PROCEDURE"
"Failed to store PROCEDURE"
"LEAVE with no matching label"
"ITERATE with no matching label"
"Failed to CREATE PROCEDURE"
"%s with no matching label"
"Redefining label"
"End-label without match"
"Referring to uninitialized variable"
"SELECT in a stored procedure must have INTO"
sql/sql_yacc.yy
View file @
a1d21d89
...
...
@@ -1041,11 +1041,20 @@ sp_proc_stmt:
statement
{
LEX *lex= Lex;
sp_instr_stmt *i= new sp_instr_stmt(lex->sphead->instructions());
i->set_lex(lex);
lex->sphead->add_instr(i);
lex->sphead->restore_lex(YYTHD);
if (lex->sql_command == SQLCOM_SELECT && !lex->result)
{
send_error(YYTHD, ER_SP_BADSELECT);
YYABORT;
}
else
{
sp_instr_stmt *i= new sp_instr_stmt(lex->sphead->instructions());
i->set_lex(lex);
lex->sphead->add_instr(i);
lex->sphead->restore_lex(YYTHD);
}
}
| IF sp_if END IF {}
| CASE_SYM WHEN_SYM
...
...
@@ -1096,7 +1105,7 @@ sp_proc_stmt:
if (! lab)
{
send_error(YYTHD, ER_SP_L
EAVE_MISMATCH
);
send_error(YYTHD, ER_SP_L
ILABEL_MISMATCH, "LEAVE"
);
YYABORT;
}
else
...
...
@@ -1114,7 +1123,7 @@ sp_proc_stmt:
if (! lab)
{
send_error(YYTHD, ER_SP_
ITERATE_MISMATCH
);
send_error(YYTHD, ER_SP_
LILABEL_MISMATCH, "ITERATE"
);
YYABORT;
}
else
...
...
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