mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
Merge zippy.cornsilk.net:/home/cmiller/work/mysql/bug36570/my50-bug36570
into zippy.cornsilk.net:/home/cmiller/work/mysql/bug36570/my51-bug36570
This commit is contained in:
@ -303,9 +303,7 @@ SET @@session.sql_mode=0/*!*/;
|
|||||||
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
|
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
|
||||||
/*!\C latin1 *//*!*/;
|
/*!\C latin1 *//*!*/;
|
||||||
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
|
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
|
||||||
SET @@session.lc_time_names=0/*!*/;
|
CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`()
|
||||||
SET @@session.collation_database=DEFAULT/*!*/;
|
|
||||||
CREATE DEFINER=`root`@`localhost` procedure p1()
|
|
||||||
begin
|
begin
|
||||||
select 1;
|
select 1;
|
||||||
end
|
end
|
||||||
|
@ -592,17 +592,19 @@ begin
|
|||||||
select 1;
|
select 1;
|
||||||
end|
|
end|
|
||||||
|
|
||||||
create procedure ` mysqltestbug36570_p2`(/*!50001 a int*/)`label`:
|
use mysql|
|
||||||
|
create procedure test.` mysqltestbug36570_p2`(/*!50001 a int*/)`label`:
|
||||||
begin
|
begin
|
||||||
select a;
|
select a;
|
||||||
end|
|
end|
|
||||||
|
|
||||||
/*!50001 create function mysqltestbug36570_f1() */
|
/*!50001 create function test.mysqltestbug36570_f1() */
|
||||||
returns int
|
returns int
|
||||||
/*!50001 deterministic */
|
/*!50001 deterministic */
|
||||||
begin
|
begin
|
||||||
return 3;
|
return 3;
|
||||||
end|
|
end|
|
||||||
|
use test|
|
||||||
|
|
||||||
delimiter ;|
|
delimiter ;|
|
||||||
|
|
||||||
@ -618,8 +620,8 @@ show function status like '%mysqltestbug36570%';
|
|||||||
|
|
||||||
connection master;
|
connection master;
|
||||||
use test;
|
use test;
|
||||||
drop procedure if exists mysqltestbug36570_p1;
|
drop procedure mysqltestbug36570_p1;
|
||||||
drop procedure if exists ` mysqltestbug36570_p2`;
|
drop procedure ` mysqltestbug36570_p2`;
|
||||||
drop function if exists mysqltestbug36570_f1;
|
drop function mysqltestbug36570_f1;
|
||||||
--echo End of 5.0 tests
|
--echo End of 5.0 tests
|
||||||
--echo End of 5.1 tests
|
--echo End of 5.1 tests
|
||||||
|
36
sql/sp.cc
36
sql/sp.cc
@ -24,6 +24,7 @@
|
|||||||
static bool
|
static bool
|
||||||
create_string(THD *thd, String *buf,
|
create_string(THD *thd, String *buf,
|
||||||
int sp_type,
|
int sp_type,
|
||||||
|
const char *db, ulong dblen,
|
||||||
const char *name, ulong namelen,
|
const char *name, ulong namelen,
|
||||||
const char *params, ulong paramslen,
|
const char *params, ulong paramslen,
|
||||||
const char *returns, ulong returnslen,
|
const char *returns, ulong returnslen,
|
||||||
@ -588,12 +589,13 @@ db_load_routine(THD *thd, int type, sp_name *name, sp_head **sphp,
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
if (!create_string(thd, &defstr,
|
if (!create_string(thd, &defstr,
|
||||||
type,
|
type,
|
||||||
name->m_name.str, name->m_name.length,
|
NULL, 0,
|
||||||
params, strlen(params),
|
name->m_name.str, name->m_name.length,
|
||||||
returns, strlen(returns),
|
params, strlen(params),
|
||||||
body, strlen(body),
|
returns, strlen(returns),
|
||||||
&chistics, &definer_user_name, &definer_host_name))
|
body, strlen(body),
|
||||||
|
&chistics, &definer_user_name, &definer_host_name))
|
||||||
{
|
{
|
||||||
ret= SP_INTERNAL_ERROR;
|
ret= SP_INTERNAL_ERROR;
|
||||||
goto end;
|
goto end;
|
||||||
@ -922,6 +924,8 @@ sp_create_routine(THD *thd, int type, sp_head *sp)
|
|||||||
|
|
||||||
if (!create_string(thd, &log_query,
|
if (!create_string(thd, &log_query,
|
||||||
sp->m_type,
|
sp->m_type,
|
||||||
|
(sp->m_explicit_name ? sp->m_db.str : NULL),
|
||||||
|
(sp->m_explicit_name ? sp->m_db.length : 0),
|
||||||
sp->m_name.str, sp->m_name.length,
|
sp->m_name.str, sp->m_name.length,
|
||||||
sp->m_params.str, sp->m_params.length,
|
sp->m_params.str, sp->m_params.length,
|
||||||
retstr.c_ptr(), retstr.length(),
|
retstr.c_ptr(), retstr.length(),
|
||||||
@ -2070,17 +2074,18 @@ sp_cache_routines_and_add_tables_for_triggers(THD *thd, LEX *lex,
|
|||||||
*/
|
*/
|
||||||
static bool
|
static bool
|
||||||
create_string(THD *thd, String *buf,
|
create_string(THD *thd, String *buf,
|
||||||
int type,
|
int type,
|
||||||
const char *name, ulong namelen,
|
const char *db, ulong dblen,
|
||||||
const char *params, ulong paramslen,
|
const char *name, ulong namelen,
|
||||||
const char *returns, ulong returnslen,
|
const char *params, ulong paramslen,
|
||||||
const char *body, ulong bodylen,
|
const char *returns, ulong returnslen,
|
||||||
st_sp_chistics *chistics,
|
const char *body, ulong bodylen,
|
||||||
|
st_sp_chistics *chistics,
|
||||||
const LEX_STRING *definer_user,
|
const LEX_STRING *definer_user,
|
||||||
const LEX_STRING *definer_host)
|
const LEX_STRING *definer_host)
|
||||||
{
|
{
|
||||||
/* Make some room to begin with */
|
/* Make some room to begin with */
|
||||||
if (buf->alloc(100 + namelen + paramslen + returnslen + bodylen +
|
if (buf->alloc(100 + dblen + 1 + namelen + paramslen + returnslen + bodylen +
|
||||||
chistics->comment.length + 10 /* length of " DEFINER= "*/ +
|
chistics->comment.length + 10 /* length of " DEFINER= "*/ +
|
||||||
USER_HOST_BUFF_SIZE))
|
USER_HOST_BUFF_SIZE))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@ -2091,6 +2096,11 @@ create_string(THD *thd, String *buf,
|
|||||||
buf->append(STRING_WITH_LEN("FUNCTION "));
|
buf->append(STRING_WITH_LEN("FUNCTION "));
|
||||||
else
|
else
|
||||||
buf->append(STRING_WITH_LEN("PROCEDURE "));
|
buf->append(STRING_WITH_LEN("PROCEDURE "));
|
||||||
|
if (dblen > 0)
|
||||||
|
{
|
||||||
|
append_identifier(thd, buf, db, dblen);
|
||||||
|
buf->append('.');
|
||||||
|
}
|
||||||
append_identifier(thd, buf, name, namelen);
|
append_identifier(thd, buf, name, namelen);
|
||||||
buf->append('(');
|
buf->append('(');
|
||||||
buf->append(params, paramslen);
|
buf->append(params, paramslen);
|
||||||
|
@ -561,6 +561,8 @@ sp_head::init(LEX *lex)
|
|||||||
m_qname.str= NULL;
|
m_qname.str= NULL;
|
||||||
m_qname.length= 0;
|
m_qname.length= 0;
|
||||||
|
|
||||||
|
m_explicit_name= false;
|
||||||
|
|
||||||
m_db.str= NULL;
|
m_db.str= NULL;
|
||||||
m_db.length= 0;
|
m_db.length= 0;
|
||||||
|
|
||||||
@ -603,6 +605,8 @@ sp_head::init_sp_name(THD *thd, sp_name *spname)
|
|||||||
m_name.str= strmake_root(thd->mem_root, spname->m_name.str,
|
m_name.str= strmake_root(thd->mem_root, spname->m_name.str,
|
||||||
spname->m_name.length);
|
spname->m_name.length);
|
||||||
|
|
||||||
|
m_explicit_name= spname->m_explicit_name;
|
||||||
|
|
||||||
if (spname->m_qname.length == 0)
|
if (spname->m_qname.length == 0)
|
||||||
spname->init_qname(thd);
|
spname->init_qname(thd);
|
||||||
|
|
||||||
|
@ -180,6 +180,7 @@ public:
|
|||||||
st_sp_chistics *m_chistics;
|
st_sp_chistics *m_chistics;
|
||||||
ulong m_sql_mode; ///< For SHOW CREATE and execution
|
ulong m_sql_mode; ///< For SHOW CREATE and execution
|
||||||
LEX_STRING m_qname; ///< db.name
|
LEX_STRING m_qname; ///< db.name
|
||||||
|
bool m_explicit_name; ///< Prepend the db name? */
|
||||||
/**
|
/**
|
||||||
Key representing routine in the set of stored routines used by statement.
|
Key representing routine in the set of stored routines used by statement.
|
||||||
[routine_type]db.name
|
[routine_type]db.name
|
||||||
|
Reference in New Issue
Block a user