Commit 5841af19 authored by Andrei Elkin's avatar Andrei Elkin

merge bug14275000 fixes to 5.5

parents fb3e11d0 e3c8fb4a
......@@ -5767,6 +5767,9 @@ User_var_log_event::
User_var_log_event(const char* buf,
const Format_description_log_event* description_event)
:Log_event(buf, description_event)
#ifndef MYSQL_CLIENT
, deferred(false)
#endif
{
/* The Post-Header is empty. The Variable Data part begins immediately. */
const char *start= buf;
......@@ -6002,7 +6005,10 @@ int User_var_log_event::do_apply_event(Relay_log_info const *rli)
CHARSET_INFO *charset;
if (rli->deferred_events_collecting)
{
set_deferred();
return rli->deferred_events->add(this);
}
if (!(charset= get_charset(charset_number, MYF(MY_WME))))
return 1;
......@@ -6054,7 +6060,8 @@ int User_var_log_event::do_apply_event(Relay_log_info const *rli)
return 0;
}
}
Item_func_set_user_var e(user_var_name, it);
Item_func_set_user_var *e= new Item_func_set_user_var(user_var_name, it);
/*
Item_func_set_user_var can't substitute something else on its place =>
0 can be passed as last argument (reference on item)
......@@ -6063,7 +6070,7 @@ int User_var_log_event::do_apply_event(Relay_log_info const *rli)
crash the server, so if fix fields fails, we just return with an
error.
*/
if (e.fix_fields(thd, 0))
if (e->fix_fields(thd, 0))
return 1;
/*
......@@ -6071,9 +6078,10 @@ int User_var_log_event::do_apply_event(Relay_log_info const *rli)
a single record and with a single column. Thus, like
a column value, it could always have IMPLICIT derivation.
*/
e.update_hash(val, val_len, type, charset, DERIVATION_IMPLICIT,
(flags & User_var_log_event::UNSIGNED_F));
free_root(thd->mem_root,0);
e->update_hash(val, val_len, type, charset, DERIVATION_IMPLICIT,
(flags & User_var_log_event::UNSIGNED_F));
if (!is_deferred())
free_root(thd->mem_root, 0);
return 0;
}
......
......@@ -2562,14 +2562,23 @@ public:
Item_result type;
uint charset_number;
bool is_null;
<<<<<<< TREE
uchar flags;
#ifdef MYSQL_SERVER
=======
#ifndef MYSQL_CLIENT
bool deferred;
>>>>>>> MERGE-SOURCE
User_var_log_event(THD* thd_arg, char *name_arg, uint name_len_arg,
char *val_arg, ulong val_len_arg, Item_result type_arg,
uint charset_number_arg, uchar flags_arg)
:Log_event(), name(name_arg), name_len(name_len_arg), val(val_arg),
val_len(val_len_arg), type(type_arg), charset_number(charset_number_arg),
<<<<<<< TREE
flags(flags_arg)
=======
deferred(false)
>>>>>>> MERGE-SOURCE
{ is_null= !val; }
void pack_info(Protocol* protocol);
#else
......@@ -2582,6 +2591,13 @@ public:
Log_event_type get_type_code() { return USER_VAR_EVENT;}
#ifdef MYSQL_SERVER
bool write(IO_CACHE* file);
/*
Getter and setter for deferred User-event.
Returns true if the event is not applied directly
and which case the applier adjusts execution path.
*/
bool is_deferred() { return deferred; }
void set_deferred() { deferred= val; }
#endif
bool is_valid() const { return 1; }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment