diff options
author | unknown <cmiller@zippy.cornsilk.net> | 2008-05-15 11:08:58 -0400 |
---|---|---|
committer | unknown <cmiller@zippy.cornsilk.net> | 2008-05-15 11:08:58 -0400 |
commit | 8c1c06de321ec1089a508b2a0b896ac0f40f8aa1 (patch) | |
tree | 6e9557c5ff27df08fe2a466c8aa5f0770bc33a13 /sql/sp.cc | |
parent | fba87d6ed47320b9f11b0620978aa7aad7f655bd (diff) | |
parent | fb0d88619a6983444b5ef4fdb90944861a2e8190 (diff) | |
download | mariadb-git-8c1c06de321ec1089a508b2a0b896ac0f40f8aa1.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
mysql-test/r/mysqlbinlog.result:
need to record.
mysql-test/suite/binlog/r/binlog_stm_ctype_ucs.result:
need to record.
mysql-test/suite/rpl/r/rpl_sp.result:
need to record.
mysql-test/suite/rpl/t/rpl_sp.test:
manual merge.
sql/sp.cc:
Manual merge
Diffstat (limited to 'sql/sp.cc')
-rw-r--r-- | sql/sp.cc | 34 |
1 files changed, 18 insertions, 16 deletions
diff --git a/sql/sp.cc b/sql/sp.cc index 69eae8de207..1ce6bc20517 100644 --- a/sql/sp.cc +++ b/sql/sp.cc @@ -24,7 +24,7 @@ static bool create_string(THD *thd, String *buf, int sp_type, - sp_name *name, + const char *name, ulong namelen, const char *params, ulong paramslen, const char *returns, ulong returnslen, const char *body, ulong bodylen, @@ -589,7 +589,7 @@ db_load_routine(THD *thd, int type, sp_name *name, sp_head **sphp, if (!create_string(thd, &defstr, type, - name, + name->m_name.str, name->m_name.length, params, strlen(params), returns, strlen(returns), body, strlen(body), @@ -732,6 +732,7 @@ sp_create_routine(THD *thd, int type, sp_head *sp) DBUG_ENTER("sp_create_routine"); DBUG_PRINT("enter", ("type: %d name: %.*s",type, (int) sp->m_name.length, sp->m_name.str)); + String retstr(64); DBUG_ASSERT(type == TYPE_ENUM_PROCEDURE || type == TYPE_ENUM_FUNCTION); @@ -819,7 +820,6 @@ sp_create_routine(THD *thd, int type, sp_head *sp) if (sp->m_type == TYPE_ENUM_FUNCTION) { - String retstr(64); sp_returns_type(thd, retstr, sp); store_failed= store_failed || @@ -919,17 +919,19 @@ sp_create_routine(THD *thd, int type, sp_head *sp) String log_query; log_query.set_charset(system_charset_info); - log_query.append(STRING_WITH_LEN("CREATE ")); - append_definer(thd, &log_query, &thd->lex->definer->user, - &thd->lex->definer->host); - LEX_STRING stmt_definition; - stmt_definition.str= (char*) thd->lex->stmt_definition_begin; - stmt_definition.length= thd->lex->stmt_definition_end - - thd->lex->stmt_definition_begin; - trim_whitespace(thd->charset(), & stmt_definition); - - log_query.append(stmt_definition.str, stmt_definition.length); + if (!create_string(thd, &log_query, + sp->m_type, + sp->m_name.str, sp->m_name.length, + sp->m_params.str, sp->m_params.length, + retstr.c_ptr(), retstr.length(), + sp->m_body.str, sp->m_body.length, + sp->m_chistics, &(thd->lex->definer->user), + &(thd->lex->definer->host))) + { + ret= SP_INTERNAL_ERROR; + goto done; + } /* Such a statement can always go directly to binlog, no trans cache */ thd->binlog_query(THD::MYSQL_QUERY_TYPE, @@ -2069,7 +2071,7 @@ sp_cache_routines_and_add_tables_for_triggers(THD *thd, LEX *lex, static bool create_string(THD *thd, String *buf, int type, - sp_name *name, + const char *name, ulong namelen, const char *params, ulong paramslen, const char *returns, ulong returnslen, const char *body, ulong bodylen, @@ -2078,7 +2080,7 @@ create_string(THD *thd, String *buf, const LEX_STRING *definer_host) { /* Make some room to begin with */ - if (buf->alloc(100 + name->m_qname.length + paramslen + returnslen + bodylen + + if (buf->alloc(100 + namelen + paramslen + returnslen + bodylen + chistics->comment.length + 10 /* length of " DEFINER= "*/ + USER_HOST_BUFF_SIZE)) return FALSE; @@ -2089,7 +2091,7 @@ create_string(THD *thd, String *buf, buf->append(STRING_WITH_LEN("FUNCTION ")); else buf->append(STRING_WITH_LEN("PROCEDURE ")); - append_identifier(thd, buf, name->m_name.str, name->m_name.length); + append_identifier(thd, buf, name, namelen); buf->append('('); buf->append(params, paramslen); buf->append(')'); |