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/*!*/;
|
||||
/*!\C latin1 *//*!*/;
|
||||
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
|
||||
SET @@session.lc_time_names=0/*!*/;
|
||||
SET @@session.collation_database=DEFAULT/*!*/;
|
||||
CREATE DEFINER=`root`@`localhost` procedure p1()
|
||||
CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`()
|
||||
begin
|
||||
select 1;
|
||||
end
|
||||
|
@ -592,17 +592,19 @@ begin
|
||||
select 1;
|
||||
end|
|
||||
|
||||
create procedure ` mysqltestbug36570_p2`(/*!50001 a int*/)`label`:
|
||||
use mysql|
|
||||
create procedure test.` mysqltestbug36570_p2`(/*!50001 a int*/)`label`:
|
||||
begin
|
||||
select a;
|
||||
end|
|
||||
|
||||
/*!50001 create function mysqltestbug36570_f1() */
|
||||
/*!50001 create function test.mysqltestbug36570_f1() */
|
||||
returns int
|
||||
/*!50001 deterministic */
|
||||
begin
|
||||
return 3;
|
||||
end|
|
||||
use test|
|
||||
|
||||
delimiter ;|
|
||||
|
||||
@ -618,8 +620,8 @@ show function status like '%mysqltestbug36570%';
|
||||
|
||||
connection master;
|
||||
use test;
|
||||
drop procedure if exists mysqltestbug36570_p1;
|
||||
drop procedure if exists ` mysqltestbug36570_p2`;
|
||||
drop function if exists mysqltestbug36570_f1;
|
||||
drop procedure mysqltestbug36570_p1;
|
||||
drop procedure ` mysqltestbug36570_p2`;
|
||||
drop function mysqltestbug36570_f1;
|
||||
--echo End of 5.0 tests
|
||||
--echo End of 5.1 tests
|
||||
|
36
sql/sp.cc
36
sql/sp.cc
@ -24,6 +24,7 @@
|
||||
static bool
|
||||
create_string(THD *thd, String *buf,
|
||||
int sp_type,
|
||||
const char *db, ulong dblen,
|
||||
const char *name, ulong namelen,
|
||||
const char *params, ulong paramslen,
|
||||
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,
|
||||
type,
|
||||
name->m_name.str, name->m_name.length,
|
||||
params, strlen(params),
|
||||
returns, strlen(returns),
|
||||
body, strlen(body),
|
||||
&chistics, &definer_user_name, &definer_host_name))
|
||||
type,
|
||||
NULL, 0,
|
||||
name->m_name.str, name->m_name.length,
|
||||
params, strlen(params),
|
||||
returns, strlen(returns),
|
||||
body, strlen(body),
|
||||
&chistics, &definer_user_name, &definer_host_name))
|
||||
{
|
||||
ret= SP_INTERNAL_ERROR;
|
||||
goto end;
|
||||
@ -922,6 +924,8 @@ sp_create_routine(THD *thd, int type, sp_head *sp)
|
||||
|
||||
if (!create_string(thd, &log_query,
|
||||
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_params.str, sp->m_params.length,
|
||||
retstr.c_ptr(), retstr.length(),
|
||||
@ -2070,17 +2074,18 @@ sp_cache_routines_and_add_tables_for_triggers(THD *thd, LEX *lex,
|
||||
*/
|
||||
static bool
|
||||
create_string(THD *thd, String *buf,
|
||||
int type,
|
||||
const char *name, ulong namelen,
|
||||
const char *params, ulong paramslen,
|
||||
const char *returns, ulong returnslen,
|
||||
const char *body, ulong bodylen,
|
||||
st_sp_chistics *chistics,
|
||||
int type,
|
||||
const char *db, ulong dblen,
|
||||
const char *name, ulong namelen,
|
||||
const char *params, ulong paramslen,
|
||||
const char *returns, ulong returnslen,
|
||||
const char *body, ulong bodylen,
|
||||
st_sp_chistics *chistics,
|
||||
const LEX_STRING *definer_user,
|
||||
const LEX_STRING *definer_host)
|
||||
{
|
||||
/* 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= "*/ +
|
||||
USER_HOST_BUFF_SIZE))
|
||||
return FALSE;
|
||||
@ -2091,6 +2096,11 @@ create_string(THD *thd, String *buf,
|
||||
buf->append(STRING_WITH_LEN("FUNCTION "));
|
||||
else
|
||||
buf->append(STRING_WITH_LEN("PROCEDURE "));
|
||||
if (dblen > 0)
|
||||
{
|
||||
append_identifier(thd, buf, db, dblen);
|
||||
buf->append('.');
|
||||
}
|
||||
append_identifier(thd, buf, name, namelen);
|
||||
buf->append('(');
|
||||
buf->append(params, paramslen);
|
||||
|
@ -561,6 +561,8 @@ sp_head::init(LEX *lex)
|
||||
m_qname.str= NULL;
|
||||
m_qname.length= 0;
|
||||
|
||||
m_explicit_name= false;
|
||||
|
||||
m_db.str= NULL;
|
||||
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,
|
||||
spname->m_name.length);
|
||||
|
||||
m_explicit_name= spname->m_explicit_name;
|
||||
|
||||
if (spname->m_qname.length == 0)
|
||||
spname->init_qname(thd);
|
||||
|
||||
|
@ -180,6 +180,7 @@ public:
|
||||
st_sp_chistics *m_chistics;
|
||||
ulong m_sql_mode; ///< For SHOW CREATE and execution
|
||||
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.
|
||||
[routine_type]db.name
|
||||
|
Reference in New Issue
Block a user