Commit 7e1b6226 authored by pem@mysql.comhem.se's avatar pem@mysql.comhem.se

Fixed BUG#4934: Caching issue with stored procedures.

  ...and added new test file, sp-threads, for multiple connection tests
  (apart from the security tests that are in sp-security).
parent 33c58f8c
use test;
drop table if exists t1;
create table t1 (s1 int, s2 int, s3 int);
create procedure bug4934()
begin
insert into t1 values (1,0,1);
end//
use test;
call bug4934();
select * from t1;
s1 s2 s3
1 0 1
drop table t1;
create table t1 (s1 int, s2 int, s3 int);
drop procedure bug4934;
create procedure bug4934()
begin
end//
select * from t1;
s1 s2 s3
call bug4934();
select * from t1;
s1 s2 s3
drop table t1;
drop procedure bug4934;
#
# Testing stored procedures with multiple connections
#
connect (con1root,localhost,root,,);
connect (con2root,localhost,root,,);
connection con1root;
use test;
--disable_warnings
drop table if exists t1;
--enable_warnings
create table t1 (s1 int, s2 int, s3 int);
delimiter //;
create procedure bug4934()
begin
insert into t1 values (1,0,1);
end//
delimiter ;//
connection con2root;
use test;
call bug4934();
select * from t1;
connection con1root;
drop table t1;
create table t1 (s1 int, s2 int, s3 int);
drop procedure bug4934;
delimiter //;
create procedure bug4934()
begin
end//
delimiter ;//
connection con2root;
select * from t1;
call bug4934();
select * from t1;
connection con1root;
drop table t1;
drop procedure bug4934;
......@@ -722,11 +722,14 @@ int
sp_drop_procedure(THD *thd, sp_name *name)
{
int ret;
bool found;
DBUG_ENTER("sp_drop_procedure");
DBUG_PRINT("enter", ("name: %*s", name->m_name.length, name->m_name.str));
sp_cache_remove(&thd->sp_proc_cache, name);
found= sp_cache_remove(&thd->sp_proc_cache, name);
ret= db_drop_routine(thd, TYPE_ENUM_PROCEDURE, name);
if (!found && !ret)
sp_cache_invalidate();
DBUG_RETURN(ret);
}
......@@ -737,12 +740,15 @@ sp_update_procedure(THD *thd, sp_name *name,
st_sp_chistics *chistics)
{
int ret;
bool found;
DBUG_ENTER("sp_update_procedure");
DBUG_PRINT("enter", ("name: %*s", name->m_name.length, name->m_name.str));
sp_cache_remove(&thd->sp_proc_cache, name);
found= sp_cache_remove(&thd->sp_proc_cache, name);
ret= db_update_routine(thd, TYPE_ENUM_PROCEDURE, name,
newname, newnamelen, chistics);
if (!found && !ret)
sp_cache_invalidate();
DBUG_RETURN(ret);
}
......@@ -814,11 +820,14 @@ int
sp_drop_function(THD *thd, sp_name *name)
{
int ret;
bool found;
DBUG_ENTER("sp_drop_function");
DBUG_PRINT("enter", ("name: %*s", name->m_name.length, name->m_name.str));
sp_cache_remove(&thd->sp_func_cache, name);
found= sp_cache_remove(&thd->sp_func_cache, name);
ret= db_drop_routine(thd, TYPE_ENUM_FUNCTION, name);
if (!found && !ret)
sp_cache_invalidate();
DBUG_RETURN(ret);
}
......@@ -829,12 +838,15 @@ sp_update_function(THD *thd, sp_name *name,
st_sp_chistics *chistics)
{
int ret;
bool found;
DBUG_ENTER("sp_update_procedure");
DBUG_PRINT("enter", ("name: %*s", name->m_name.length, name->m_name.str));
sp_cache_remove(&thd->sp_func_cache, name);
found= sp_cache_remove(&thd->sp_func_cache, name);
ret= db_update_routine(thd, TYPE_ENUM_FUNCTION, name,
newname, newnamelen, chistics);
if (!found && !ret)
sp_cache_invalidate();
DBUG_RETURN(ret);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment