Commit 44cad14b authored by evgen@moonbone.local's avatar evgen@moonbone.local

item_cmpfunc.cc, item.cc:

  Additional fix for bug #21475
item_func.h, item_func.cc:
  Additional fix for bug#16861
parent f0edc908
......@@ -305,6 +305,7 @@ Item::Item():
maybe_null=null_value=with_sum_func=unsigned_flag=0;
decimals= 0; max_length= 0;
with_subselect= 0;
cmp_context= (Item_result)-1;
/* Put item in free list so that we can free all items at end */
THD *thd= current_thd;
......@@ -343,7 +344,8 @@ Item::Item(THD *thd, Item *item):
unsigned_flag(item->unsigned_flag),
with_sum_func(item->with_sum_func),
fixed(item->fixed),
collation(item->collation)
collation(item->collation),
cmp_context(item->cmp_context)
{
next= thd->free_list; // Put in free list
thd->free_list= this;
......@@ -3788,7 +3790,8 @@ Item *Item_field::equal_fields_propagator(byte *arg)
The same problem occurs when comparing a DATE/TIME field with a
DATE/TIME represented as an int and as a string.
*/
if (!item || item->cmp_context != cmp_context)
if (!item ||
(cmp_context != (Item_result)-1 && item->cmp_context != cmp_context))
item= this;
return item;
}
......
......@@ -1220,6 +1220,7 @@ void Item_func_between::fix_length_and_dec()
if (!args[0] || !args[1] || !args[2])
return;
agg_cmp_type(thd, &cmp_type, args, 3);
args[0]->cmp_context= args[1]->cmp_context= args[2]->cmp_context= cmp_type;
if (cmp_type == STRING_RESULT)
agg_arg_charsets(cmp_collation, args, 3, MY_COLL_CMP_CONV, 1);
......
......@@ -3897,6 +3897,19 @@ bool Item_func_set_user_var::send(Protocol *protocol, String *str_arg)
return Item::send(protocol, str_arg);
}
void Item_func_set_user_var::make_field(Send_field *tmp_field)
{
if (result_field)
{
result_field->make_field(tmp_field);
DBUG_ASSERT(tmp_field->table_name != 0);
if (Item::name)
tmp_field->col_name=Item::name; // Use user supplied name
}
else
Item::make_field(tmp_field);
}
String *
Item_func_get_user_var::val_str(String *str)
{
......
......@@ -1175,6 +1175,7 @@ class Item_func_set_user_var :public Item_func
bool update_hash(void *ptr, uint length, enum Item_result type,
CHARSET_INFO *cs, Derivation dv, bool unsigned_arg= 0);
bool send(Protocol *protocol, String *str_arg);
void make_field(Send_field *tmp_field);
bool check(bool use_result_field);
bool update();
enum Item_result result_type () const { return cached_result_type; }
......
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