Commit 3b932255 authored by Sergei Golubchik's avatar Sergei Golubchik

cleanup: const_Item->real_item()

allow real_item() to be called for const Item*,
remove casts in the code
parent cce76fef
......@@ -3444,7 +3444,7 @@ bool Item_field::is_null_result()
bool Item_field::eq(const Item *item, bool binary_cmp) const
{
Item *real_item2= ((Item *) item)->real_item();
const Item *real_item2= item->real_item();
if (real_item2->type() != FIELD_ITEM)
return 0;
......
......@@ -1891,6 +1891,7 @@ class Item: public Value_source,
virtual Item *copy_or_same(THD *thd) { return this; }
virtual Item *copy_andor_structure(THD *thd) { return this; }
virtual Item *real_item() { return this; }
const Item *real_item() const { return const_cast<Item*>(this)->real_item(); }
virtual Item *get_tmp_table_item(THD *thd) { return copy_or_same(thd); }
virtual Item *make_odbc_literal(THD *thd, const LEX_CSTRING *typestr)
{
......@@ -5404,7 +5405,7 @@ class Item_ref :public Item_ident,
{ return ref ? (*ref)->type() : REF_ITEM; }
bool eq(const Item *item, bool binary_cmp) const override
{
Item *it= ((Item *) item)->real_item();
const Item *it= item->real_item();
return ref && (*ref)->eq(it, binary_cmp);
}
void save_val(Field *to) override;
......@@ -5762,7 +5763,7 @@ class Item_cache_wrapper :public Item_result_field,
{ orig_item->make_send_field(thd, field); }
bool eq(const Item *item, bool binary_cmp) const override
{
Item *it= const_cast<Item*>(item)->real_item();
const Item *it= item->real_item();
return orig_item->eq(it, binary_cmp);
}
void fix_after_pullout(st_select_lex *new_parent, Item **refptr, bool merge)
......@@ -7638,7 +7639,7 @@ class Item_direct_ref_to_item : public Item_direct_ref
{ m_item->make_send_field(thd, field); }
bool eq(const Item *item, bool binary_cmp) const
{
Item *it= ((Item *) item)->real_item();
const Item *it= item->real_item();
return m_item->eq(it, binary_cmp);
}
void fix_after_pullout(st_select_lex *new_parent, Item **refptr, bool merge)
......
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