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
98e6f58f
Commit
98e6f58f
authored
Apr 27, 2005
by
unknown
Browse files
Options
Browse Files
Download
Plain Diff
Merge mysql.com:/usr/local/bk/mysql-5.0
into mysql.com:/home/pem/work/mysql-5.0 sql/item_func.h: Auto merged
parents
82c2a2e9
2f7548cf
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
129 additions
and
0 deletions
+129
-0
mysql-test/r/sp-error.result
mysql-test/r/sp-error.result
+48
-0
mysql-test/t/sp-error.test
mysql-test/t/sp-error.test
+61
-0
sql/item_func.cc
sql/item_func.cc
+10
-0
sql/item_func.h
sql/item_func.h
+2
-0
sql/share/errmsg.txt
sql/share/errmsg.txt
+2
-0
sql/sql_yacc.yy
sql/sql_yacc.yy
+6
-0
No files found.
mysql-test/r/sp-error.result
View file @
98e6f58f
...
...
@@ -594,4 +594,52 @@ alter function bug7047;
return 0;
end|
ERROR HY000: Can't drop or alter a FUNCTION from within another stored routine
drop function if exists bug8408|
drop procedure if exists bug8408|
create function bug8408() returns int
begin
select * from t1;
return 0;
end|
ERROR 0A000: Not allowed to return a result set from a function
create function bug8408() returns int
begin
show warnings;
return 0;
end|
ERROR 0A000: Not allowed to return a result set from a function
create function bug8408(a int) returns int
begin
declare b int;
select b;
return b;
end|
ERROR 0A000: Not allowed to return a result set from a function
create function bug8408() returns int
begin
call bug8408();
return 0;
end|
create procedure bug8408()
select * from t1|
call bug8408()|
val x
select bug8408()|
ERROR 0A000: SELECT in a stored procedure must have INTO
drop procedure bug8408|
drop function bug8408|
create function bug8408() returns int
begin
declare n int default 0;
select count(*) into n from t1;
return n;
end|
insert into t1 value (2, 2.7), (3, 3.14), (7, 7.0)|
select *,bug8408() from t1|
val x bug8408()
2 2.7 3
3 3.14 3
7 7 3
drop function bug8408|
delete from t1|
drop table t1|
mysql-test/t/sp-error.test
View file @
98e6f58f
...
...
@@ -831,6 +831,67 @@ begin
end
|
#
# BUG#8408: Stored procedure crash if function contains SHOW
# BUG#9058: Stored Procedures: Crash if function included SELECT
#
--
disable_warnings
drop
function
if
exists
bug8408
|
drop
procedure
if
exists
bug8408
|
--
enable_warnings
# Some things are caught when parsing
--
error
ER_SP_NO_RETSET_IN_FUNC
create
function
bug8408
()
returns
int
begin
select
*
from
t1
;
return
0
;
end
|
--
error
ER_SP_NO_RETSET_IN_FUNC
create
function
bug8408
()
returns
int
begin
show
warnings
;
return
0
;
end
|
--
error
ER_SP_NO_RETSET_IN_FUNC
create
function
bug8408
(
a
int
)
returns
int
begin
declare
b
int
;
select
b
;
return
b
;
end
|
# Some things must be caught at invokation time
create
function
bug8408
()
returns
int
begin
call
bug8408
();
return
0
;
end
|
create
procedure
bug8408
()
select
*
from
t1
|
call
bug8408
()
|
--
error
ER_SP_BADSELECT
select
bug8408
()
|
drop
procedure
bug8408
|
drop
function
bug8408
|
# But this is ok
create
function
bug8408
()
returns
int
begin
declare
n
int
default
0
;
select
count
(
*
)
into
n
from
t1
;
return
n
;
end
|
insert
into
t1
value
(
2
,
2.7
),
(
3
,
3.14
),
(
7
,
7.0
)
|
select
*
,
bug8408
()
from
t1
|
drop
function
bug8408
|
delete
from
t1
|
#
# BUG#NNNN: New bug synopsis
#
...
...
sql/item_func.cc
View file @
98e6f58f
...
...
@@ -4554,6 +4554,7 @@ Item_func_sp::execute(Item **itp)
{
DBUG_ENTER
(
"Item_func_sp::execute"
);
THD
*
thd
=
current_thd
;
bool
clcap_mr
;
int
res
;
#ifndef NO_EMBEDDED_ACCESS_CHECKS
st_sp_security_context
save_ctx
;
...
...
@@ -4567,6 +4568,9 @@ Item_func_sp::execute(Item **itp)
DBUG_RETURN
(
-
1
);
}
clcap_mr
=
(
thd
->
client_capabilities
&
CLIENT_MULTI_RESULTS
);
thd
->
client_capabilities
&=
~
CLIENT_MULTI_RESULTS
;
#ifndef EMBEDDED_LIBRARY
my_bool
nsok
=
thd
->
net
.
no_send_ok
;
thd
->
net
.
no_send_ok
=
TRUE
;
...
...
@@ -4582,6 +4586,8 @@ Item_func_sp::execute(Item **itp)
m_sp
->
m_db
.
str
,
m_sp
->
m_name
.
str
,
0
))
{
sp_restore_security_context
(
thd
,
m_sp
,
&
save_ctx
);
if
(
clcap_mr
)
thd
->
client_capabilities
|=
CLIENT_MULTI_RESULTS
;
DBUG_RETURN
(
-
1
);
}
#endif
...
...
@@ -4595,6 +4601,10 @@ Item_func_sp::execute(Item **itp)
#ifndef EMBEDDED_LIBRARY
thd
->
net
.
no_send_ok
=
nsok
;
#endif
if
(
clcap_mr
)
thd
->
client_capabilities
|=
CLIENT_MULTI_RESULTS
;
DBUG_RETURN
(
res
);
}
...
...
sql/item_func.h
View file @
98e6f58f
...
...
@@ -1301,6 +1301,8 @@ class Item_func_sp :public Item_func
void
cleanup
()
{
if
(
result_field
)
delete
result_field
;
Item_func
::
cleanup
();
result_field
=
NULL
;
}
...
...
sql/share/errmsg.txt
View file @
98e6f58f
...
...
@@ -5342,3 +5342,5 @@ ER_SP_DUP_HANDLER 42000
eng "Duplicate handler declared in the same block"
ER_SP_NOT_VAR_ARG 42000
eng "OUT or INOUT argument %d for routine %s is not a variable"
ER_SP_NO_RETSET_IN_FUNC 0A000
eng "Not allowed to return a result set from a function"
sql/sql_yacc.yy
View file @
98e6f58f
...
...
@@ -1442,6 +1442,12 @@ create_function_tail:
LEX *lex= Lex;
sp_head *sp= lex->sphead;
if (sp->m_multi_results)
{
my_message(ER_SP_NO_RETSET_IN_FUNC, ER(ER_SP_NO_RETSET_IN_FUNC),
MYF(0));
YYABORT;
}
if (sp->check_backpatch(YYTHD))
YYABORT;
lex->sql_command= SQLCOM_CREATE_SPFUNCTION;
...
...
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