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
7b5df9ed
Commit
7b5df9ed
authored
Apr 17, 2003
by
pem@mysql.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Check the number of args to SPs.
Fixes bug #280.
parent
64da2fff
Changes
27
Hide whitespace changes
Inline
Side-by-side
Showing
27 changed files
with
79 additions
and
7 deletions
+79
-7
include/mysqld_error.h
include/mysqld_error.h
+2
-1
mysql-test/r/sp-error.result
mysql-test/r/sp-error.result
+16
-2
mysql-test/t/sp-error.test
mysql-test/t/sp-error.test
+20
-2
sql/share/czech/errmsg.txt
sql/share/czech/errmsg.txt
+1
-0
sql/share/danish/errmsg.txt
sql/share/danish/errmsg.txt
+1
-0
sql/share/dutch/errmsg.txt
sql/share/dutch/errmsg.txt
+1
-0
sql/share/english/errmsg.txt
sql/share/english/errmsg.txt
+1
-0
sql/share/estonian/errmsg.txt
sql/share/estonian/errmsg.txt
+1
-0
sql/share/french/errmsg.txt
sql/share/french/errmsg.txt
+1
-0
sql/share/german/errmsg.txt
sql/share/german/errmsg.txt
+1
-0
sql/share/greek/errmsg.txt
sql/share/greek/errmsg.txt
+1
-0
sql/share/hungarian/errmsg.txt
sql/share/hungarian/errmsg.txt
+1
-0
sql/share/italian/errmsg.txt
sql/share/italian/errmsg.txt
+1
-0
sql/share/japanese/errmsg.txt
sql/share/japanese/errmsg.txt
+1
-0
sql/share/korean/errmsg.txt
sql/share/korean/errmsg.txt
+1
-0
sql/share/norwegian-ny/errmsg.txt
sql/share/norwegian-ny/errmsg.txt
+1
-0
sql/share/norwegian/errmsg.txt
sql/share/norwegian/errmsg.txt
+1
-0
sql/share/polish/errmsg.txt
sql/share/polish/errmsg.txt
+1
-0
sql/share/portuguese/errmsg.txt
sql/share/portuguese/errmsg.txt
+1
-0
sql/share/romanian/errmsg.txt
sql/share/romanian/errmsg.txt
+1
-0
sql/share/russian/errmsg.txt
sql/share/russian/errmsg.txt
+1
-0
sql/share/serbian/errmsg.txt
sql/share/serbian/errmsg.txt
+1
-0
sql/share/slovak/errmsg.txt
sql/share/slovak/errmsg.txt
+1
-0
sql/share/spanish/errmsg.txt
sql/share/spanish/errmsg.txt
+1
-0
sql/share/swedish/errmsg.txt
sql/share/swedish/errmsg.txt
+1
-0
sql/share/ukrainian/errmsg.txt
sql/share/ukrainian/errmsg.txt
+1
-0
sql/sp_head.cc
sql/sp_head.cc
+18
-2
No files found.
include/mysqld_error.h
View file @
7b5df9ed
...
...
@@ -290,4 +290,5 @@
#define ER_UPDATE_LOG_DEPRECATED_IGNORED 1271
#define ER_UPDATE_LOG_DEPRECATED_TRANSLATED 1272
#define ER_QUERY_INTERRUPTED 1273
#define ER_ERROR_MESSAGES 274
#define ER_SP_WRONG_NO_OF_ARGS 1274
#define ER_ERROR_MESSAGES 275
mysql-test/r/sp-error.result
View file @
7b5df9ed
...
...
@@ -15,6 +15,8 @@ PROCEDURE proc1 already exists
create function func1() returns int
return 42;
FUNCTION func1 already exists
drop procedure proc1;
drop function func1;
alter procedure foo;
PROCEDURE foo does not exist
alter function foo;
...
...
@@ -69,5 +71,17 @@ select max(c) into x from test.t;
return x;
end;
Queries, like SELECT, INSERT, UPDATE (and others), are not allowed in a FUNCTION
drop procedure proc1;
drop function func1;
create procedure p(x int)
insert into test.t1 values (x);
create function f(x int) returns int
return x+42;
call p();
Wrong number of arguments for PROCEDURE p, expected 1, got 0
call p(1, 2);
Wrong number of arguments for PROCEDURE p, expected 1, got 2
select f();
Wrong number of arguments for FUNCTION f, expected 1, got 0
select f(1, 2);
Wrong number of arguments for FUNCTION f, expected 1, got 2
drop procedure p;
drop function f;
mysql-test/t/sp-error.test
View file @
7b5df9ed
...
...
@@ -37,6 +37,9 @@ create procedure proc1()
create
function
func1
()
returns
int
return
42
|
drop
procedure
proc1
|
drop
function
func1
|
# Does not exist
--
error
1261
alter
procedure
foo
|
...
...
@@ -105,7 +108,22 @@ begin
return
x
;
end
|
drop
procedure
proc1
|
drop
function
func1
|
# Wrong number of arguments
create
procedure
p
(
x
int
)
insert
into
test
.
t1
values
(
x
)
|
create
function
f
(
x
int
)
returns
int
return
x
+
42
|
--
error
1274
call
p
()
|
--
error
1274
call
p
(
1
,
2
)
|
--
error
1274
select
f
()
|
--
error
1274
select
f
(
1
,
2
)
|
drop
procedure
p
|
drop
function
f
|
delimiter
;
|
sql/share/czech/errmsg.txt
View file @
7b5df9ed
...
...
@@ -284,3 +284,4 @@ v/*
"The update log is deprecated and replaced by the binary log. SET SQL_LOG_UPDATE has been ignored."
"The update log is deprecated and replaced by the binary log. SET SQL_LOG_UPDATE has been translated to SET SQL_LOG_BIN."
"Query execution was interrupted"
"Wrong number of arguments for %s %s, expected %u, got %u"
sql/share/danish/errmsg.txt
View file @
7b5df9ed
...
...
@@ -278,3 +278,4 @@
"The update log is deprecated and replaced by the binary log. SET SQL_LOG_UPDATE has been ignored."
"The update log is deprecated and replaced by the binary log. SET SQL_LOG_UPDATE has been translated to SET SQL_LOG_BIN."
"Query execution was interrupted"
"Wrong number of arguments for %s %s, expected %u, got %u"
sql/share/dutch/errmsg.txt
View file @
7b5df9ed
...
...
@@ -286,3 +286,4 @@
"The update log is deprecated and replaced by the binary log. SET SQL_LOG_UPDATE has been ignored."
"The update log is deprecated and replaced by the binary log. SET SQL_LOG_UPDATE has been translated to SET SQL_LOG_BIN."
"Query execution was interrupted"
"Wrong number of arguments for %s %s, expected %u, got %u"
sql/share/english/errmsg.txt
View file @
7b5df9ed
...
...
@@ -275,3 +275,4 @@
"The update log is deprecated and replaced by the binary log. SET SQL_LOG_UPDATE has been ignored."
"The update log is deprecated and replaced by the binary log. SET SQL_LOG_UPDATE has been translated to SET SQL_LOG_BIN."
"Query execution was interrupted"
"Wrong number of arguments for %s %s, expected %u, got %u"
sql/share/estonian/errmsg.txt
View file @
7b5df9ed
...
...
@@ -280,3 +280,4 @@
"The update log is deprecated and replaced by the binary log. SET SQL_LOG_UPDATE has been ignored."
"The update log is deprecated and replaced by the binary log. SET SQL_LOG_UPDATE has been translated to SET SQL_LOG_BIN."
"Query execution was interrupted"
"Wrong number of arguments for %s %s, expected %u, got %u"
sql/share/french/errmsg.txt
View file @
7b5df9ed
...
...
@@ -275,3 +275,4 @@
"The update log is deprecated and replaced by the binary log. SET SQL_LOG_UPDATE has been ignored."
"The update log is deprecated and replaced by the binary log. SET SQL_LOG_UPDATE has been translated to SET SQL_LOG_BIN."
"Query execution was interrupted"
"Wrong number of arguments for %s %s, expected %u, got %u"
sql/share/german/errmsg.txt
View file @
7b5df9ed
...
...
@@ -284,3 +284,4 @@
"The update log is deprecated and replaced by the binary log. SET SQL_LOG_UPDATE has been ignored."
"The update log is deprecated and replaced by the binary log. SET SQL_LOG_UPDATE has been translated to SET SQL_LOG_BIN."
"Query execution was interrupted"
"Wrong number of arguments for %s %s, expected %u, got %u"
sql/share/greek/errmsg.txt
View file @
7b5df9ed
...
...
@@ -275,3 +275,4 @@
"The update log is deprecated and replaced by the binary log. SET SQL_LOG_UPDATE has been ignored."
"The update log is deprecated and replaced by the binary log. SET SQL_LOG_UPDATE has been translated to SET SQL_LOG_BIN."
"Query execution was interrupted"
"Wrong number of arguments for %s %s, expected %u, got %u"
sql/share/hungarian/errmsg.txt
View file @
7b5df9ed
...
...
@@ -277,3 +277,4 @@
"The update log is deprecated and replaced by the binary log. SET SQL_LOG_UPDATE has been ignored."
"The update log is deprecated and replaced by the binary log. SET SQL_LOG_UPDATE has been translated to SET SQL_LOG_BIN."
"Query execution was interrupted"
"Wrong number of arguments for %s %s, expected %u, got %u"
sql/share/italian/errmsg.txt
View file @
7b5df9ed
...
...
@@ -275,3 +275,4 @@
"The update log is deprecated and replaced by the binary log. SET SQL_LOG_UPDATE has been ignored."
"The update log is deprecated and replaced by the binary log. SET SQL_LOG_UPDATE has been translated to SET SQL_LOG_BIN."
"Query execution was interrupted"
"Wrong number of arguments for %s %s, expected %u, got %u"
sql/share/japanese/errmsg.txt
View file @
7b5df9ed
...
...
@@ -277,3 +277,4 @@
"The update log is deprecated and replaced by the binary log. SET SQL_LOG_UPDATE has been ignored."
"The update log is deprecated and replaced by the binary log. SET SQL_LOG_UPDATE has been translated to SET SQL_LOG_BIN."
"Query execution was interrupted"
"Wrong number of arguments for %s %s, expected %u, got %u"
sql/share/korean/errmsg.txt
View file @
7b5df9ed
...
...
@@ -275,3 +275,4 @@
"The update log is deprecated and replaced by the binary log. SET SQL_LOG_UPDATE has been ignored."
"The update log is deprecated and replaced by the binary log. SET SQL_LOG_UPDATE has been translated to SET SQL_LOG_BIN."
"Query execution was interrupted"
"Wrong number of arguments for %s %s, expected %u, got %u"
sql/share/norwegian-ny/errmsg.txt
View file @
7b5df9ed
...
...
@@ -277,3 +277,4 @@
"The update log is deprecated and replaced by the binary log. SET SQL_LOG_UPDATE has been ignored."
"The update log is deprecated and replaced by the binary log. SET SQL_LOG_UPDATE has been translated to SET SQL_LOG_BIN."
"Query execution was interrupted"
"Wrong number of arguments for %s %s, expected %u, got %u"
sql/share/norwegian/errmsg.txt
View file @
7b5df9ed
...
...
@@ -277,3 +277,4 @@
"The update log is deprecated and replaced by the binary log. SET SQL_LOG_UPDATE has been ignored."
"The update log is deprecated and replaced by the binary log. SET SQL_LOG_UPDATE has been translated to SET SQL_LOG_BIN."
"Query execution was interrupted"
"Wrong number of arguments for %s %s, expected %u, got %u"
sql/share/polish/errmsg.txt
View file @
7b5df9ed
...
...
@@ -279,3 +279,4 @@
"The update log is deprecated and replaced by the binary log. SET SQL_LOG_UPDATE has been ignored."
"The update log is deprecated and replaced by the binary log. SET SQL_LOG_UPDATE has been translated to SET SQL_LOG_BIN."
"Query execution was interrupted"
"Wrong number of arguments for %s %s, expected %u, got %u"
sql/share/portuguese/errmsg.txt
View file @
7b5df9ed
...
...
@@ -275,3 +275,4 @@
"The update log is deprecated and replaced by the binary log. SET SQL_LOG_UPDATE has been ignored."
"The update log is deprecated and replaced by the binary log. SET SQL_LOG_UPDATE has been translated to SET SQL_LOG_BIN."
"Query execution was interrupted"
"Wrong number of arguments for %s %s, expected %u, got %u"
sql/share/romanian/errmsg.txt
View file @
7b5df9ed
...
...
@@ -279,3 +279,4 @@
"The update log is deprecated and replaced by the binary log. SET SQL_LOG_UPDATE has been ignored."
"The update log is deprecated and replaced by the binary log. SET SQL_LOG_UPDATE has been translated to SET SQL_LOG_BIN."
"Query execution was interrupted"
"Wrong number of arguments for %s %s, expected %u, got %u"
sql/share/russian/errmsg.txt
View file @
7b5df9ed
...
...
@@ -277,3 +277,4 @@
"The update log is deprecated and replaced by the binary log. SET SQL_LOG_UPDATE has been ignored."
"The update log is deprecated and replaced by the binary log. SET SQL_LOG_UPDATE has been translated to SET SQL_LOG_BIN."
"Query execution was interrupted"
"Wrong number of arguments for %s %s, expected %u, got %u"
sql/share/serbian/errmsg.txt
View file @
7b5df9ed
...
...
@@ -271,3 +271,4 @@
"The update log is deprecated and replaced by the binary log. SET SQL_LOG_UPDATE has been ignored."
"The update log is deprecated and replaced by the binary log. SET SQL_LOG_UPDATE has been translated to SET SQL_LOG_BIN."
"Query execution was interrupted"
"Wrong number of arguments for %s %s, expected %u, got %u"
sql/share/slovak/errmsg.txt
View file @
7b5df9ed
...
...
@@ -283,3 +283,4 @@
"The update log is deprecated and replaced by the binary log. SET SQL_LOG_UPDATE has been ignored."
"The update log is deprecated and replaced by the binary log. SET SQL_LOG_UPDATE has been translated to SET SQL_LOG_BIN."
"Query execution was interrupted"
"Wrong number of arguments for %s %s, expected %u, got %u"
sql/share/spanish/errmsg.txt
View file @
7b5df9ed
...
...
@@ -276,3 +276,4 @@
"The update log is deprecated and replaced by the binary log. SET SQL_LOG_UPDATE has been ignored."
"The update log is deprecated and replaced by the binary log. SET SQL_LOG_UPDATE has been translated to SET SQL_LOG_BIN."
"Query execution was interrupted"
"Wrong number of arguments for %s %s, expected %u, got %u"
sql/share/swedish/errmsg.txt
View file @
7b5df9ed
...
...
@@ -275,3 +275,4 @@
"The update log is deprecated and replaced by the binary log. SET SQL_LOG_UPDATE has been ignored."
"The update log is deprecated and replaced by the binary log. SET SQL_LOG_UPDATE has been translated to SET SQL_LOG_BIN."
"Query execution was interrupted"
"Wrong number of arguments for %s %s, expected %u, got %u"
sql/share/ukrainian/errmsg.txt
View file @
7b5df9ed
...
...
@@ -280,3 +280,4 @@
"The update log is deprecated and replaced by the binary log. SET SQL_LOG_UPDATE has been ignored."
"The update log is deprecated and replaced by the binary log. SET SQL_LOG_UPDATE has been translated to SET SQL_LOG_BIN."
"Query execution was interrupted"
"Wrong number of arguments for %s %s, expected %u, got %u"
sql/sp_head.cc
View file @
7b5df9ed
...
...
@@ -199,7 +199,16 @@ sp_head::execute_function(THD *thd, Item **argp, uint argcount, Item **resp)
uint
i
;
int
ret
;
// QQ Should have some error checking here? (no. of args, types, etc...)
if
(
argcount
!=
params
)
{
// Need to use my_printf_error here, or it will not terminate the
// invoking query properly.
my_printf_error
(
ER_SP_WRONG_NO_OF_ARGS
,
ER
(
ER_SP_WRONG_NO_OF_ARGS
),
MYF
(
0
),
"FUNCTION"
,
m_name
.
str
,
params
,
argcount
);
DBUG_RETURN
(
-
1
);
}
// QQ Should have some error checking here? (types, etc...)
nctx
=
new
sp_rcontext
(
csize
);
for
(
i
=
0
;
i
<
params
&&
i
<
argcount
;
i
++
)
{
...
...
@@ -234,6 +243,13 @@ sp_head::execute_procedure(THD *thd, List<Item> *args)
sp_rcontext
*
nctx
=
NULL
;
my_bool
tmp_octx
=
FALSE
;
// True if we have allocated a temporary octx
if
(
args
->
elements
!=
params
)
{
net_printf
(
thd
,
ER_SP_WRONG_NO_OF_ARGS
,
"PROCEDURE"
,
m_name
.
str
,
params
,
args
->
elements
);
DBUG_RETURN
(
-
1
);
}
if
(
csize
>
0
)
{
uint
i
;
...
...
@@ -246,7 +262,7 @@ sp_head::execute_procedure(THD *thd, List<Item> *args)
octx
=
new
sp_rcontext
(
csize
);
tmp_octx
=
TRUE
;
}
// QQ:
No error checking whatsoever right now.
Should do type checking?
// QQ: Should do type checking?
for
(
i
=
0
;
(
it
=
li
++
)
&&
i
<
params
;
i
++
)
{
sp_pvar_t
*
pvar
=
m_pcont
->
find_pvar
(
i
);
...
...
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