summaryrefslogtreecommitdiff
path: root/sql/item.cc
diff options
context:
space:
mode:
Diffstat (limited to 'sql/item.cc')
-rw-r--r--sql/item.cc40
1 files changed, 40 insertions, 0 deletions
diff --git a/sql/item.cc b/sql/item.cc
index b6dfb97d128..5a15baa67c1 100644
--- a/sql/item.cc
+++ b/sql/item.cc
@@ -159,6 +159,46 @@ bool Item_ident::remove_dependence_processor(byte * arg)
}
+/*
+ Store the pointer to this item field into a list if not already there.
+
+ SYNOPSIS
+ Item_field::collect_item_field_processor()
+ arg pointer to a List<Item_field>
+
+ DESCRIPTION
+ The method is used by Item::walk to collect all unique Item_field objects
+ from a tree of Items into a set of items represented as a list.
+
+ IMPLEMENTATION
+ Item_cond::walk() and Item_func::walk() stop the evaluation of the
+ processor function for its arguments once the processor returns
+ true.Therefore in order to force this method being called for all item
+ arguments in a condition the method must return false.
+
+ RETURN
+ false on success (force the evaluation of collect_item_field_processor
+ for the subsequent items.)
+ true o/w (stop evaluation of subsequent items.)
+*/
+
+bool Item_field::collect_item_field_processor(byte *arg)
+{
+ DBUG_ENTER("Item_field::collect_item_field_processor");
+ DBUG_PRINT("info", ("%s", field->field_name ? field->field_name : "noname"));
+ List<Item_field> *item_list= (List<Item_field>*) arg;
+ List_iterator<Item_field> item_list_it(*item_list);
+ Item_field *curr_item;
+ while ((curr_item= item_list_it++))
+ {
+ if (curr_item->eq(this, 1))
+ DBUG_RETURN(false); /* Already in the set. */
+ }
+ item_list->push_back(this);
+ DBUG_RETURN(false);
+}
+
+
bool Item::check_cols(uint c)
{
if (c != 1)