Commit 8fea9b45 authored by hf@deer.(none)'s avatar hf@deer.(none)

Bugfix for #614

Item_extract needs special implementation for eq().
Item_func::eq doesn't work correctly because we have to compare 
Item_extract::int_type parameters also

We need to propagate this to 4.1
parent d640ff4a
...@@ -24,6 +24,7 @@ heikki@donna.mysql.fi ...@@ -24,6 +24,7 @@ heikki@donna.mysql.fi
heikki@hundin.mysql.fi heikki@hundin.mysql.fi
heikki@rescue. heikki@rescue.
heikki@work.mysql.com heikki@work.mysql.com
hf@deer.(none)
hf@deer.mysql.r18.ru hf@deer.mysql.r18.ru
hf@genie.(none) hf@genie.(none)
igor@hundin.mysql.fi igor@hundin.mysql.fi
......
...@@ -1137,6 +1137,22 @@ longlong Item_extract::val_int() ...@@ -1137,6 +1137,22 @@ longlong Item_extract::val_int()
return 0; // Impossible return 0; // Impossible
} }
bool Item_extract::eq(const Item *item, bool binary_cmp) const
{
if (this == item)
return 1;
if (item->type() != FUNC_ITEM ||
func_name() != ((Item_func*)item)->func_name())
return 0;
Item_extract* ie= (Item_extract*)item;
if (ie->int_type != int_type)
return 0;
if (!args[0]->eq(ie->args[0], binary_cmp))
return 0;
return 1;
}
void Item_typecast::print(String *str) void Item_typecast::print(String *str)
{ {
......
...@@ -422,6 +422,7 @@ class Item_extract :public Item_int_func ...@@ -422,6 +422,7 @@ class Item_extract :public Item_int_func
longlong val_int(); longlong val_int();
const char *func_name() const { return "extract"; } const char *func_name() const { return "extract"; }
void fix_length_and_dec(); void fix_length_and_dec();
bool eq(const Item *item, bool binary_cmp) const;
unsigned int size_of() { return sizeof(*this);} unsigned int size_of() { return sizeof(*this);}
}; };
......
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