Below is the list of changes that have just been committed into a local
5.0 repository of pem. When pem does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html
ChangeSet
1.2100 06/03/28 15:08:17 pem@stripped +4 -0
Merge mysql.com:/extern/mysql/bk/mysql-5.0-runtime
into mysql.com:/extern/mysql/5.0/bug17015/mysql-5.0-runtime
sql/sp.cc
1.109 06/03/28 15:08:04 pem@stripped +0 -0
Auto merged
sql/field.h
1.174 06/03/28 15:08:04 pem@stripped +0 -0
Auto merged
mysql-test/t/sp-error.test
1.106 06/03/28 15:08:04 pem@stripped +0 -0
Auto merged
mysql-test/r/sp-error.result
1.105 06/03/28 15:08:04 pem@stripped +0 -0
Auto merged
# This is a BitKeeper patch. What follows are the unified diffs for the
# set of deltas contained in the patch. The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User: pem
# Host: pem.mysql.com
# Root: /extern/mysql/5.0/bug17015/mysql-5.0-runtime/RESYNC
--- 1.173/sql/field.h 2006-02-27 19:26:21 +01:00
+++ 1.174/sql/field.h 2006-03-28 15:08:04 +02:00
@@ -320,6 +320,12 @@
/* convert decimal to longlong with overflow check */
longlong convert_decimal2longlong(const my_decimal *val, bool unsigned_flag,
int *err);
+ /* The max. number of characters */
+ inline uint32 Field::char_length() const
+ {
+ return field_length / charset()->mbmaxlen;
+ }
+
friend bool reopen_table(THD *,struct st_table *,bool);
friend int cre_myisam(my_string name, register TABLE *form, uint options,
ulonglong auto_increment_value);
--- 1.104/mysql-test/r/sp-error.result 2006-02-16 13:40:34 +01:00
+++ 1.105/mysql-test/r/sp-error.result 2006-03-28 15:08:04 +02:00
@@ -464,19 +464,6 @@
call bug3294()|
ERROR 42S02: Unknown table 't5'
drop procedure bug3294|
-drop procedure if exists bug6807|
-create procedure bug6807()
-begin
-declare id int;
-set id = connection_id();
-kill query id;
-select 'Not reached';
-end|
-call bug6807()|
-ERROR 70100: Query execution was interrupted
-call bug6807()|
-ERROR 70100: Query execution was interrupted
-drop procedure bug6807|
drop procedure if exists bug8776_1|
drop procedure if exists bug8776_2|
drop procedure if exists bug8776_3|
--- 1.105/mysql-test/t/sp-error.test 2006-02-16 13:40:34 +01:00
+++ 1.106/mysql-test/t/sp-error.test 2006-03-28 15:08:04 +02:00
@@ -648,28 +648,6 @@
drop procedure bug3294|
#
-# BUG#6807: Stored procedure crash if CREATE PROCEDURE ... KILL QUERY
-#
---disable_warnings
-drop procedure if exists bug6807|
---enable_warnings
-create procedure bug6807()
-begin
- declare id int;
-
- set id = connection_id();
- kill query id;
- select 'Not reached';
-end|
-
---error 1317
-call bug6807()|
---error 1317
-call bug6807()|
-
-drop procedure bug6807|
-
-#
# BUG#876: Stored Procedures: Invalid SQLSTATE is allowed in
# a DECLARE ? HANDLER FOR stmt.
#
--- 1.108/sql/sp.cc 2006-03-28 15:06:00 +02:00
+++ 1.109/sql/sp.cc 2006-03-28 15:08:04 +02:00
@@ -21,6 +21,8 @@
#include "sp_cache.h"
#include "sql_trigger.h"
+#include <my_user.h>
+
static bool
create_string(THD *thd, String *buf,
int sp_type,
@@ -28,7 +30,9 @@
const char *params, ulong paramslen,
const char *returns, ulong returnslen,
const char *body, ulong bodylen,
- st_sp_chistics *chistics);
+ st_sp_chistics *chistics,
+ const LEX_STRING *definer_user,
+ const LEX_STRING *definer_host);
static int
db_load_routine(THD *thd, int type, sp_name *name, sp_head **sphp,
ulong sql_mode, const char *params, const char *returns,
@@ -265,7 +269,7 @@
static int
db_find_routine(THD *thd, int type, sp_name *name, sp_head **sphp)
{
- extern int yyparse(void *thd);
+ extern int MYSQLparse(void *thd);
TABLE *table;
const char *params, *returns, *body;
int ret;
@@ -406,6 +410,15 @@
ulong old_sql_mode= thd->variables.sql_mode;
ha_rows old_select_limit= thd->variables.select_limit;
sp_rcontext *old_spcont= thd->spcont;
+
+ char definer_user_name_holder[USERNAME_LENGTH + 1];
+ LEX_STRING_WITH_INIT definer_user_name(definer_user_name_holder,
+ USERNAME_LENGTH);
+
+ char definer_host_name_holder[HOSTNAME_LENGTH + 1];
+ LEX_STRING_WITH_INIT definer_host_name(definer_host_name_holder,
+ HOSTNAME_LENGTH);
+
int ret;
thd->variables.sql_mode= sql_mode;
@@ -414,14 +427,25 @@
thd->lex= &newlex;
newlex.current_select= NULL;
+ parse_user(definer, strlen(definer),
+ definer_user_name.str, &definer_user_name.length,
+ definer_host_name.str, &definer_host_name.length);
+
defstr.set_charset(system_charset_info);
+
+ /*
+ We have to add DEFINER clause and provide proper routine characterstics in
+ routine definition statement that we build here to be able to use this
+ definition for SHOW CREATE PROCEDURE later.
+ */
+
if (!create_string(thd, &defstr,
type,
name,
params, strlen(params),
returns, strlen(returns),
body, strlen(body),
- &chistics))
+ &chistics, &definer_user_name, &definer_host_name))
{
ret= SP_INTERNAL_ERROR;
goto end;
@@ -435,7 +459,7 @@
lex_start(thd, (uchar*)defstr.c_ptr(), defstr.length());
thd->spcont= 0;
- if (yyparse(thd) || thd->is_fatal_error || newlex.sphead == NULL)
+ if (MYSQLparse(thd) || thd->is_fatal_error || newlex.sphead == NULL)
{
sp_head *sp= newlex.sphead;
@@ -449,7 +473,7 @@
if (dbchanged && (ret= mysql_change_db(thd, olddb, 1)))
goto end;
*sphp= newlex.sphead;
- (*sphp)->set_definer((char*) definer, (uint) strlen(definer));
+ (*sphp)->set_definer(&definer_user_name, &definer_host_name);
(*sphp)->set_info(created, modified, &chistics, sql_mode);
(*sphp)->optimize();
}
@@ -500,8 +524,10 @@
else
{
restore_record(table, s->default_values); // Get default values for fields
- strxmov(definer, thd->security_ctx->priv_user, "@",
- thd->security_ctx->priv_host, NullS);
+
+ /* NOTE: all needed privilege checks have been already done. */
+ strxmov(definer, thd->lex->definer->user.str, "@",
+ thd->lex->definer->host.str, NullS);
if (table->s->fields != MYSQL_PROC_FIELD_COUNT)
{
@@ -596,8 +622,17 @@
else if (mysql_bin_log.is_open())
{
thd->clear_error();
+
+ 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);
+ log_query.append(thd->lex->stmt_definition_begin);
+
/* Such a statement can always go directly to binlog, no trans cache */
- Query_log_event qinfo(thd, thd->query, thd->query_length, 0, FALSE);
+ Query_log_event qinfo(thd, log_query.c_ptr(), log_query.length(), 0,
+ FALSE);
mysql_bin_log.write(&qinfo);
}
@@ -1016,6 +1051,7 @@
{
TABLE_LIST *routine;
bool result= 0;
+ bool sp_object_found;
DBUG_ENTER("sp_exists_routine");
for (routine= routines; routine; routine= routine->next_global)
{
@@ -1028,10 +1064,12 @@
lex_name.str= thd->strmake(routine->table_name, lex_name.length);
name= new sp_name(lex_db, lex_name);
name->init_qname(thd);
- if (sp_find_routine(thd, TYPE_ENUM_PROCEDURE, name,
- &thd->sp_proc_cache, FALSE) != NULL ||
- sp_find_routine(thd, TYPE_ENUM_FUNCTION, name,
- &thd->sp_func_cache, FALSE) != NULL)
+ sp_object_found= sp_find_routine(thd, TYPE_ENUM_PROCEDURE, name,
+ &thd->sp_proc_cache, FALSE) != NULL ||
+ sp_find_routine(thd, TYPE_ENUM_FUNCTION, name,
+ &thd->sp_func_cache, FALSE) != NULL;
+ mysql_reset_errors(thd, TRUE);
+ if (sp_object_found)
{
if (any)
DBUG_RETURN(1);
@@ -1724,14 +1762,18 @@
const char *params, ulong paramslen,
const char *returns, ulong returnslen,
const char *body, ulong bodylen,
- st_sp_chistics *chistics)
+ st_sp_chistics *chistics,
+ const LEX_STRING *definer_user,
+ const LEX_STRING *definer_host)
{
/* Make some room to begin with */
if (buf->alloc(100 + name->m_qname.length + paramslen + returnslen + bodylen +
- chistics->comment.length))
+ chistics->comment.length + 10 /* length of " DEFINER= "*/ +
+ USER_HOST_BUFF_SIZE))
return FALSE;
buf->append(STRING_WITH_LEN("CREATE "));
+ append_definer(thd, buf, definer_user, definer_host);
if (type == TYPE_ENUM_FUNCTION)
buf->append(STRING_WITH_LEN("FUNCTION "));
else
| Thread |
|---|
| • bk commit into 5.0 tree (pem:1.2100) | pem | 28 Mar |