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
71238556
Commit
71238556
authored
Dec 07, 2005
by
konstantin@mysql.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
A fix and a test case for Bug#15392 "Server crashes during
prepared statement execute
parent
adc8051c
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
96 additions
and
10 deletions
+96
-10
mysql-test/r/sp.result
mysql-test/r/sp.result
+39
-0
mysql-test/t/sp.test
mysql-test/t/sp.test
+46
-0
sql/sp_head.cc
sql/sp_head.cc
+11
-10
No files found.
mysql-test/r/sp.result
View file @
71238556
...
@@ -4153,4 +4153,43 @@ A local variable in a nested compound statement takes precedence over table colu
...
@@ -4153,4 +4153,43 @@ A local variable in a nested compound statement takes precedence over table colu
a - local variable in a nested compound statement
a - local variable in a nested compound statement
A local variable in a nested compound statement takes precedence over table column in cursors
A local variable in a nested compound statement takes precedence over table column in cursors
a - local variable in a nested compound statement
a - local variable in a nested compound statement
drop schema if exists mysqltest1|
Warnings:
Note 1008 Can't drop database 'mysqltest1'; database doesn't exist
drop schema if exists mysqltest2|
Warnings:
Note 1008 Can't drop database 'mysqltest2'; database doesn't exist
drop schema if exists mysqltest3|
Warnings:
Note 1008 Can't drop database 'mysqltest3'; database doesn't exist
create schema mysqltest1|
create schema mysqltest2|
create schema mysqltest3|
use mysqltest3|
create procedure mysqltest1.p1 (out prequestid varchar(100))
begin
call mysqltest2.p2('call mysqltest3.p3(1, 2)');
end|
create procedure mysqltest2.p2(in psql text)
begin
declare lsql text;
set @lsql= psql;
prepare lstatement from @lsql;
execute lstatement;
deallocate prepare lstatement;
end|
create procedure mysqltest3.p3(in p1 int)
begin
select p1;
end|
call mysqltest1.p1(@rs)|
ERROR 42000: Incorrect number of arguments for PROCEDURE mysqltest3.p3; expected 1, got 2
call mysqltest1.p1(@rs)|
ERROR 42000: Incorrect number of arguments for PROCEDURE mysqltest3.p3; expected 1, got 2
call mysqltest1.p1(@rs)|
ERROR 42000: Incorrect number of arguments for PROCEDURE mysqltest3.p3; expected 1, got 2
drop schema if exists mysqltest1|
drop schema if exists mysqltest2|
drop schema if exists mysqltest3|
use test|
drop table t1,t2;
drop table t1,t2;
mysql-test/t/sp.test
View file @
71238556
...
@@ -4947,6 +4947,52 @@ begin
...
@@ -4947,6 +4947,52 @@ begin
end
|
end
|
call
p1
(
"a - stored procedure parameter"
)
|
call
p1
(
"a - stored procedure parameter"
)
|
#
# A test case for Bug#15392 "Server crashes during prepared statement
# execute": make sure that stored procedure check for error conditions
# properly and do not continue execution if an error has been set.
#
# It's necessary to use several DBs because in the original code
# the successful return of mysql_change_db overrode the error from
# execution.
drop
schema
if
exists
mysqltest1
|
drop
schema
if
exists
mysqltest2
|
drop
schema
if
exists
mysqltest3
|
create
schema
mysqltest1
|
create
schema
mysqltest2
|
create
schema
mysqltest3
|
use
mysqltest3
|
create procedure mysqltest1.p1 (out prequestid varchar(100))
begin
call mysqltest2.p2('call mysqltest3.p3(1, 2)')
;
end
|
create
procedure
mysqltest2
.
p2
(
in
psql
text
)
begin
declare
lsql
text
;
set
@
lsql
=
psql
;
prepare
lstatement
from
@
lsql
;
execute
lstatement
;
deallocate
prepare
lstatement
;
end
|
create
procedure
mysqltest3
.
p3
(
in
p1
int
)
begin
select
p1
;
end
|
--
error
ER_SP_WRONG_NO_OF_ARGS
call
mysqltest1
.
p1
(
@
rs
)
|
--
error
ER_SP_WRONG_NO_OF_ARGS
call
mysqltest1
.
p1
(
@
rs
)
|
--
error
ER_SP_WRONG_NO_OF_ARGS
call
mysqltest1
.
p1
(
@
rs
)
|
drop
schema
if
exists
mysqltest1
|
drop
schema
if
exists
mysqltest2
|
drop
schema
if
exists
mysqltest3
|
use
test
|
#
#
# BUG#NNNN: New bug synopsis
# BUG#NNNN: New bug synopsis
#
#
...
...
sql/sp_head.cc
View file @
71238556
...
@@ -1137,10 +1137,12 @@ int sp_head::execute(THD *thd)
...
@@ -1137,10 +1137,12 @@ int sp_head::execute(THD *thd)
original thd->db will then have been freed */
original thd->db will then have been freed */
if
(
dbchanged
)
if
(
dbchanged
)
{
{
/* No access check when changing back to where we came from.
/*
(It would generate an error from mysql_change_db() when olddb=="") */
No access check when changing back to where we came from.
(It would generate an error from mysql_change_db() when olddb=="")
*/
if
(
!
thd
->
killed
)
if
(
!
thd
->
killed
)
ret
=
mysql_change_db
(
thd
,
olddb
,
1
);
ret
|=
(
int
)
mysql_change_db
(
thd
,
olddb
,
1
);
}
}
m_flags
&=
~
IS_INVOKED
;
m_flags
&=
~
IS_INVOKED
;
DBUG_PRINT
(
"info"
,
(
"first free for 0x%lx --: 0x%lx->0x%lx, level: %lu, flags %x"
,
DBUG_PRINT
(
"info"
,
(
"first free for 0x%lx --: 0x%lx->0x%lx, level: %lu, flags %x"
,
...
@@ -1519,13 +1521,12 @@ int sp_head::execute_procedure(THD *thd, List<Item> *args)
...
@@ -1519,13 +1521,12 @@ int sp_head::execute_procedure(THD *thd, List<Item> *args)
suv
=
new
Item_func_set_user_var
(
guv
->
get_name
(),
item
);
suv
=
new
Item_func_set_user_var
(
guv
->
get_name
(),
item
);
/*
/*
we do not check suv->fixed, because it can't be fixed after
Item_func_set_user_var is not fixed after construction,
creation
call fix_fields().
*/
*/
suv
->
fix_fields
(
thd
,
&
item
);
if
((
ret
=
test
(
!
suv
||
suv
->
fix_fields
(
thd
,
&
item
)
||
suv
->
fix_length_and_dec
();
suv
->
check
()
||
suv
->
update
())))
suv
->
check
();
break
;
suv
->
update
();
}
}
}
}
}
}
...
@@ -2097,7 +2098,7 @@ sp_lex_keeper::reset_lex_and_exec_core(THD *thd, uint *nextp,
...
@@ -2097,7 +2098,7 @@ sp_lex_keeper::reset_lex_and_exec_core(THD *thd, uint *nextp,
cleanup_items() is called in sp_head::execute()
cleanup_items() is called in sp_head::execute()
*/
*/
return
res
;
return
res
||
thd
->
net
.
report_error
;
}
}
...
...
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