summaryrefslogtreecommitdiff
path: root/sql/item.cc
diff options
context:
space:
mode:
authorSergei Golubchik <sergii@pisem.net>2012-02-15 18:08:08 +0100
committerSergei Golubchik <sergii@pisem.net>2012-02-15 18:08:08 +0100
commit25609313ffbd9205e921d0793cf423f711d10ced (patch)
treef04a1c26fabcc5463aca51a860f03131e02d94f7 /sql/item.cc
parent47a54a2e087a7c1fc861bcbc114c14987f492cfe (diff)
parent764eeeee74f999fe2107fc362236563be0025093 (diff)
downloadmariadb-git-25609313ffbd9205e921d0793cf423f711d10ced.tar.gz
5.3.4 merge
Diffstat (limited to 'sql/item.cc')
-rw-r--r--sql/item.cc37
1 files changed, 24 insertions, 13 deletions
diff --git a/sql/item.cc b/sql/item.cc
index 02cbe9b7f49..de4716350c2 100644
--- a/sql/item.cc
+++ b/sql/item.cc
@@ -5378,7 +5378,8 @@ bool Item_field::set_no_const_sub(uchar *arg)
Item *Item_field::replace_equal_field(uchar *arg)
{
- if (item_equal && item_equal == (Item_equal *) arg)
+ REPLACE_EQUAL_FIELD_ARG* param= (REPLACE_EQUAL_FIELD_ARG*)arg;
+ if (item_equal && item_equal == param->item_equal)
{
Item *const_item= item_equal->get_const();
if (const_item)
@@ -5387,7 +5388,8 @@ Item *Item_field::replace_equal_field(uchar *arg)
return this;
return const_item;
}
- Item_field *subst= (Item_field *)(item_equal->get_first(this));
+ Item_field *subst=
+ (Item_field *)(item_equal->get_first(param->context_tab, this));
if (subst)
subst= (Item_field *) (subst->real_item());
if (subst && !field->eq(subst->field))
@@ -9467,13 +9469,13 @@ void Item_type_holder::get_full_info(Item *item)
DBUG_ASSERT((enum_set_typelib &&
get_real_type(item) == MYSQL_TYPE_NULL) ||
(!enum_set_typelib &&
- item->type() == Item::FIELD_ITEM &&
- (get_real_type(item) == MYSQL_TYPE_ENUM ||
- get_real_type(item) == MYSQL_TYPE_SET) &&
- ((Field_enum*)((Item_field *) item)->field)->typelib));
+ item->real_item()->type() == Item::FIELD_ITEM &&
+ (get_real_type(item->real_item()) == MYSQL_TYPE_ENUM ||
+ get_real_type(item->real_item()) == MYSQL_TYPE_SET) &&
+ ((Field_enum*)((Item_field *) item->real_item())->field)->typelib));
if (!enum_set_typelib)
{
- enum_set_typelib= ((Field_enum*)((Item_field *) item)->field)->typelib;
+ enum_set_typelib= ((Field_enum*)((Item_field *) item->real_item())->field)->typelib;
}
}
}
@@ -9558,18 +9560,22 @@ void Item_ref::update_used_tables()
}
-table_map Item_direct_view_ref::used_tables() const
+table_map Item_direct_view_ref::used_tables() const
{
- return get_depended_from() ?
+ return get_depended_from() ?
OUTER_REF_TABLE_BIT :
- (view->merged ? (*ref)->used_tables() : view->table->map);
+ ((view->merged || !view->table) ?
+ (*ref)->used_tables() :
+ view->table->map);
}
-table_map Item_direct_view_ref::not_null_tables() const
+table_map Item_direct_view_ref::not_null_tables() const
{
- return get_depended_from() ?
+ return get_depended_from() ?
0 :
- (view->merged ? (*ref)->not_null_tables() : view->table->map);
+ ((view->merged || !view->table) ?
+ (*ref)->not_null_tables() :
+ view->table->map);
}
/*
@@ -9583,6 +9589,8 @@ table_map Item_ref_null_helper::used_tables() const
}
+#ifndef DBUG_OFF
+
/* Debugger help function */
static char dbug_item_print_buf[256];
@@ -9599,6 +9607,9 @@ const char *dbug_print_item(Item *item)
else
return "Couldn't fit into buffer";
}
+
+#endif /*DBUG_OFF*/
+
/*****************************************************************************
** Instantiate templates
*****************************************************************************/