List:Commits« Previous MessageNext Message »
From:Davi Arnaut Date:May 15 2008 9:46pm
Subject:Re: bk commit into 5.0 tree (cmiller:1.2625) BUG#36570
View as plain text  
Hi Chad,

Good catch and thanks for working on this. A few remarks below.

Chad MILLER wrote:

[..]

>  master-bin.000001	#	Query	1	#	use `mysqltest2`; insert into t values ( 1 )
> -master-bin.000001	#	Query	1	#	use `mysqltest2`; CREATE DEFINER=`root`@`localhost`
> FUNCTION `f1`() RETURNS int(11)
> +master-bin.000001	#	Query	1	#	use `mysqltest2`; CREATE DEFINER=`root`@`localhost`
> FUNCTION `mysqltest2`.`f1`() RETURNS int(11)

Hum, now the names are always fully qualified. To make things compatible
I think it would be better to append the database name only if one was
specified. We could do this by remembering whether the database name was
explicitly given. The sp_name class has a m_explicit_name that we could
also keep in the sp_head class. What do you think?

>  begin
>  insert into t values (1);
>  return 0;
> diff -Nrup a/sql/sp.cc b/sql/sp.cc
> --- a/sql/sp.cc	2008-05-14 19:23:52 -04:00
> +++ b/sql/sp.cc	2008-05-15 16:48:27 -04:00
> @@ -25,6 +25,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,
> @@ -427,6 +428,7 @@ db_load_routine(THD *thd, int type, sp_n
>  
>    if (!create_string(thd, &defstr,
>  		     type,
> +			 NULL, 0,

Tab character.

>  		     name->m_name.str, name->m_name.length,
>  		     params, strlen(params),
>  		     returns, strlen(returns),
> @@ -628,6 +630,7 @@ db_create_routine(THD *thd, int type, sp
>  
>        if (!create_string(thd, &log_query,
>                           sp->m_type,
> +                         sp->m_db.str, sp->m_db.length,
>                           sp->m_name.str, sp->m_name.length,
>                           sp->m_params.str, sp->m_params.length,
>                           retstr.c_ptr(), retstr.length(),
> @@ -1804,6 +1807,7 @@ sp_cache_routines_and_add_tables_for_tri
>  static bool
>  create_string(THD *thd, String *buf,
>  	      int type,
> +	      const char *db, ulong dblen,
>  	      const char *name, ulong namelen,
>  	      const char *params, ulong paramslen,
>  	      const char *returns, ulong returnslen,
> @@ -1813,7 +1817,7 @@ create_string(THD *thd, String *buf,
>                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;
> @@ -1824,6 +1828,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);

Tab character.

> +    buf->append('.');
> +  }
>    append_identifier(thd, buf, name, namelen);
>    buf->append('(');
>    buf->append(params, paramslen);
> 

Regards,

-- 
Davi Arnaut, Software Engineer
MySQL Server Runtime Team
Database Group, Sun Microsystems
Thread
bk commit into 5.0 tree (cmiller:1.2625) BUG#36570Chad MILLER15 May
  • Re: bk commit into 5.0 tree (cmiller:1.2625) BUG#36570Davi Arnaut15 May