mirror of
https://github.com/MariaDB/server.git
synced 2025-02-02 12:01:42 +01:00
Merge lgrimmer@build.mysql.com:/home/bk/mysql-5.0
into mysql.com:/space/my/mysql-5.0
This commit is contained in:
commit
f69ee8d2a5
4 changed files with 126 additions and 13 deletions
|
@ -922,6 +922,52 @@ select @x2|
|
|||
@x2
|
||||
2
|
||||
drop procedure bug2260|
|
||||
create procedure bug2267_1()
|
||||
begin
|
||||
show procedure status;
|
||||
end|
|
||||
create procedure bug2267_2()
|
||||
begin
|
||||
show function status;
|
||||
end|
|
||||
create procedure bug2267_3()
|
||||
begin
|
||||
show create procedure bug2267_1;
|
||||
end|
|
||||
create procedure bug2267_4()
|
||||
begin
|
||||
show create function fac;
|
||||
end|
|
||||
call bug2267_1()|
|
||||
Name Type Definer Modified Created Security_type Comment
|
||||
bug2267_1 PROCEDURE root@localhost 0000-00-00 00:00:00 0000-00-00 00:00:00 DEFINER
|
||||
bug2267_2 PROCEDURE root@localhost 0000-00-00 00:00:00 0000-00-00 00:00:00 DEFINER
|
||||
bug2267_3 PROCEDURE root@localhost 0000-00-00 00:00:00 0000-00-00 00:00:00 DEFINER
|
||||
bug2267_4 PROCEDURE root@localhost 0000-00-00 00:00:00 0000-00-00 00:00:00 DEFINER
|
||||
call bug2267_2()|
|
||||
Name Type Definer Modified Created Security_type Comment
|
||||
fac FUNCTION root@localhost 0000-00-00 00:00:00 0000-00-00 00:00:00 DEFINER
|
||||
call bug2267_3()|
|
||||
Procedure Create Procedure
|
||||
bug2267_1 CREATE PROCEDURE `bug2267_1`()
|
||||
begin
|
||||
show procedure status;
|
||||
end
|
||||
call bug2267_4()|
|
||||
Function Create Function
|
||||
fac CREATE FUNCTION `fac`(n int unsigned) RETURNS bigint unsigned
|
||||
begin
|
||||
declare f bigint unsigned default 1;
|
||||
while n > 1 do
|
||||
set f = f * n;
|
||||
set n = n - 1;
|
||||
end while;
|
||||
return f;
|
||||
end
|
||||
drop procedure bug2267_1|
|
||||
drop procedure bug2267_2|
|
||||
drop procedure bug2267_3|
|
||||
drop procedure bug2267_4|
|
||||
drop table if exists fac|
|
||||
create table fac (n int unsigned not null primary key, f bigint unsigned)|
|
||||
create procedure ifac(n int unsigned)
|
||||
|
|
|
@ -1072,6 +1072,41 @@ call bug2260()|
|
|||
select @x2|
|
||||
drop procedure bug2260|
|
||||
|
||||
#
|
||||
# BUG#2267
|
||||
#
|
||||
create procedure bug2267_1()
|
||||
begin
|
||||
show procedure status;
|
||||
end|
|
||||
|
||||
create procedure bug2267_2()
|
||||
begin
|
||||
show function status;
|
||||
end|
|
||||
|
||||
create procedure bug2267_3()
|
||||
begin
|
||||
show create procedure bug2267_1;
|
||||
end|
|
||||
|
||||
create procedure bug2267_4()
|
||||
begin
|
||||
show create function fac;
|
||||
end|
|
||||
|
||||
--replace_column 4 '0000-00-00 00:00:00' 5 '0000-00-00 00:00:00'
|
||||
call bug2267_1()|
|
||||
--replace_column 4 '0000-00-00 00:00:00' 5 '0000-00-00 00:00:00'
|
||||
call bug2267_2()|
|
||||
call bug2267_3()|
|
||||
call bug2267_4()|
|
||||
|
||||
drop procedure bug2267_1|
|
||||
drop procedure bug2267_2|
|
||||
drop procedure bug2267_3|
|
||||
drop procedure bug2267_4|
|
||||
|
||||
|
||||
#
|
||||
# Some "real" examples
|
||||
|
|
50
sql/sp.cc
50
sql/sp.cc
|
@ -570,20 +570,25 @@ sp_find_procedure(THD *thd, LEX_STRING *name)
|
|||
int
|
||||
sp_create_procedure(THD *thd, sp_head *sp)
|
||||
{
|
||||
int ret;
|
||||
DBUG_ENTER("sp_create_procedure");
|
||||
DBUG_PRINT("enter", ("name: %*s", sp->m_name.length, sp->m_name.str));
|
||||
DBUG_RETURN(db_create_routine(thd, TYPE_ENUM_PROCEDURE, sp));
|
||||
|
||||
ret= db_create_routine(thd, TYPE_ENUM_PROCEDURE, sp);
|
||||
DBUG_RETURN(ret);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
sp_drop_procedure(THD *thd, char *name, uint namelen)
|
||||
{
|
||||
int ret;
|
||||
DBUG_ENTER("sp_drop_procedure");
|
||||
DBUG_PRINT("enter", ("name: %*s", namelen, name));
|
||||
|
||||
sp_cache_remove(&thd->sp_proc_cache, name, namelen);
|
||||
DBUG_RETURN(db_drop_routine(thd, TYPE_ENUM_PROCEDURE, name, namelen));
|
||||
ret= db_drop_routine(thd, TYPE_ENUM_PROCEDURE, name, namelen);
|
||||
DBUG_RETURN(ret);
|
||||
}
|
||||
|
||||
|
||||
|
@ -592,12 +597,14 @@ sp_update_procedure(THD *thd, char *name, uint namelen,
|
|||
char *newname, uint newnamelen,
|
||||
st_sp_chistics *chistics)
|
||||
{
|
||||
int ret;
|
||||
DBUG_ENTER("sp_update_procedure");
|
||||
DBUG_PRINT("enter", ("name: %*s", namelen, name));
|
||||
|
||||
sp_cache_remove(&thd->sp_proc_cache, name, namelen);
|
||||
DBUG_RETURN(db_update_routine(thd, TYPE_ENUM_PROCEDURE, name, namelen,
|
||||
newname, newnamelen, chistics));
|
||||
ret= db_update_routine(thd, TYPE_ENUM_PROCEDURE, name, namelen,
|
||||
newname, newnamelen, chistics);
|
||||
DBUG_RETURN(ret);
|
||||
}
|
||||
|
||||
|
||||
|
@ -609,7 +616,11 @@ sp_show_create_procedure(THD *thd, LEX_STRING *name)
|
|||
DBUG_PRINT("enter", ("name: %*s", name->length, name->str));
|
||||
|
||||
if ((sp= sp_find_procedure(thd, name)))
|
||||
DBUG_RETURN(sp->show_create_procedure(thd));
|
||||
{
|
||||
int ret= sp->show_create_procedure(thd);
|
||||
|
||||
DBUG_RETURN(ret);
|
||||
}
|
||||
|
||||
DBUG_RETURN(SP_KEY_NOT_FOUND);
|
||||
}
|
||||
|
@ -618,8 +629,11 @@ sp_show_create_procedure(THD *thd, LEX_STRING *name)
|
|||
int
|
||||
sp_show_status_procedure(THD *thd, const char *wild)
|
||||
{
|
||||
int ret;
|
||||
DBUG_ENTER("sp_show_status_procedure");
|
||||
DBUG_RETURN(db_show_routine_status(thd, TYPE_ENUM_PROCEDURE, wild));
|
||||
|
||||
ret= db_show_routine_status(thd, TYPE_ENUM_PROCEDURE, wild);
|
||||
DBUG_RETURN(ret);
|
||||
}
|
||||
|
||||
|
||||
|
@ -649,21 +663,25 @@ sp_find_function(THD *thd, LEX_STRING *name)
|
|||
int
|
||||
sp_create_function(THD *thd, sp_head *sp)
|
||||
{
|
||||
int ret;
|
||||
DBUG_ENTER("sp_create_function");
|
||||
DBUG_PRINT("enter", ("name: %*s", sp->m_name.length, sp->m_name.str));
|
||||
|
||||
DBUG_RETURN(db_create_routine(thd, TYPE_ENUM_FUNCTION, sp));
|
||||
ret= db_create_routine(thd, TYPE_ENUM_FUNCTION, sp);
|
||||
DBUG_RETURN(ret);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
sp_drop_function(THD *thd, char *name, uint namelen)
|
||||
{
|
||||
int ret;
|
||||
DBUG_ENTER("sp_drop_function");
|
||||
DBUG_PRINT("enter", ("name: %*s", namelen, name));
|
||||
|
||||
sp_cache_remove(&thd->sp_func_cache, name, namelen);
|
||||
DBUG_RETURN(db_drop_routine(thd, TYPE_ENUM_FUNCTION, name, namelen));
|
||||
ret= db_drop_routine(thd, TYPE_ENUM_FUNCTION, name, namelen);
|
||||
DBUG_RETURN(ret);
|
||||
}
|
||||
|
||||
|
||||
|
@ -672,12 +690,14 @@ sp_update_function(THD *thd, char *name, uint namelen,
|
|||
char *newname, uint newnamelen,
|
||||
st_sp_chistics *chistics)
|
||||
{
|
||||
int ret;
|
||||
DBUG_ENTER("sp_update_procedure");
|
||||
DBUG_PRINT("enter", ("name: %*s", namelen, name));
|
||||
|
||||
sp_cache_remove(&thd->sp_func_cache, name, namelen);
|
||||
DBUG_RETURN(db_update_routine(thd, TYPE_ENUM_FUNCTION, name, namelen,
|
||||
newname, newnamelen, chistics));
|
||||
ret= db_update_routine(thd, TYPE_ENUM_FUNCTION, name, namelen,
|
||||
newname, newnamelen, chistics);
|
||||
DBUG_RETURN(ret);
|
||||
}
|
||||
|
||||
|
||||
|
@ -689,7 +709,11 @@ sp_show_create_function(THD *thd, LEX_STRING *name)
|
|||
DBUG_PRINT("enter", ("name: %*s", name->length, name->str));
|
||||
|
||||
if ((sp= sp_find_function(thd, name)))
|
||||
DBUG_RETURN(sp->show_create_function(thd));
|
||||
{
|
||||
int ret= sp->show_create_function(thd);
|
||||
|
||||
DBUG_RETURN(ret);
|
||||
}
|
||||
DBUG_RETURN(SP_KEY_NOT_FOUND);
|
||||
}
|
||||
|
||||
|
@ -697,8 +721,10 @@ sp_show_create_function(THD *thd, LEX_STRING *name)
|
|||
int
|
||||
sp_show_status_function(THD *thd, const char *wild)
|
||||
{
|
||||
int ret;
|
||||
DBUG_ENTER("sp_show_status_function");
|
||||
DBUG_RETURN(db_show_routine_status(thd, TYPE_ENUM_FUNCTION, wild));
|
||||
ret= db_show_routine_status(thd, TYPE_ENUM_FUNCTION, wild);
|
||||
DBUG_RETURN(ret);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1572,7 +1572,13 @@ sp_proc_stmt:
|
|||
{
|
||||
LEX *lex= Lex;
|
||||
|
||||
if (lex->sql_command == SQLCOM_SELECT && !lex->result)
|
||||
/* QQ What else? This doesn't seem to be a practical way,
|
||||
but at the moment we can't think of anything better... */
|
||||
if ((lex->sql_command == SQLCOM_SELECT && !lex->result) ||
|
||||
lex->sql_command == SQLCOM_SHOW_CREATE_PROC ||
|
||||
lex->sql_command == SQLCOM_SHOW_CREATE_FUNC ||
|
||||
lex->sql_command == SQLCOM_SHOW_STATUS_PROC ||
|
||||
lex->sql_command == SQLCOM_SHOW_STATUS_FUNC)
|
||||
{
|
||||
/* We maybe have one or more SELECT without INTO */
|
||||
lex->sphead->m_multi_results= TRUE;
|
||||
|
|
Loading…
Add table
Reference in a new issue