summaryrefslogtreecommitdiff
path: root/sql/sp.cc
diff options
context:
space:
mode:
authorunknown <cmiller@zippy.cornsilk.net>2008-05-15 19:45:42 -0400
committerunknown <cmiller@zippy.cornsilk.net>2008-05-15 19:45:42 -0400
commit9906138343428c9ab1f9fc2f17490bb06ca2ac58 (patch)
treee0367d45ae9e212b5fc86960272efd604d3e35e4 /sql/sp.cc
parent496ec47d220591453163cc303fd9bea569991e51 (diff)
parent55012e427bc4b3b6a5ffa070e229c519c8cd0b98 (diff)
downloadmariadb-git-9906138343428c9ab1f9fc2f17490bb06ca2ac58.tar.gz
Merge zippy.cornsilk.net:/home/cmiller/work/mysql/bug36570/my50-bug36570
into zippy.cornsilk.net:/home/cmiller/work/mysql/bug36570/my51-bug36570 BitKeeper/deleted/.del-binlog_innodb.result: Auto merged sql/sp_head.cc: Auto merged mysql-test/suite/binlog/r/binlog_stm_ctype_ucs.result: need to re-record. mysql-test/suite/rpl/r/rpl_sp.result: need to re-record. mysql-test/r/mysqlbinlog.result: manual merge. mysql-test/suite/rpl/t/rpl_sp.test: manual merge. sql/sp.cc: manual merge. sql/sp_head.h: manual merge.
Diffstat (limited to 'sql/sp.cc')
-rw-r--r--sql/sp.cc36
1 files changed, 23 insertions, 13 deletions
diff --git a/sql/sp.cc b/sql/sp.cc
index 1ce6bc20517..8637174efde 100644
--- a/sql/sp.cc
+++ b/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);