#include <item_cmpfunc.h>
Inheritance diagram for Item_equal:


Public Member Functions | |
| Item_equal () | |
| Item_equal (Item_field *f1, Item_field *f2) | |
| Item_equal (Item *c, Item_field *f) | |
| Item_equal (Item_equal *item_equal) | |
| Item * | get_const () |
| void | add (Item *c) |
| void | add (Item_field *f) |
| uint | members () |
| bool | contains (Field *field) |
| Item_field * | get_first () |
| void | merge (Item_equal *item) |
| void | update_const () |
| enum Functype | functype () const |
| longlong | val_int () |
| const char * | func_name () const |
| optimize_type | select_optimize () const |
| void | sort (Item_field_cmpfunc cmp, void *arg) |
| void | fix_length_and_dec () |
| bool | fix_fields (THD *thd, Item **ref) |
| void | update_used_tables () |
| bool | walk (Item_processor processor, bool walk_subquery, byte *arg) |
| Item * | transform (Item_transformer transformer, byte *arg) |
| void | print (String *str) |
| CHARSET_INFO * | compare_collation () |
Private Attributes | |
| List< Item_field > | fields |
| Item * | const_item |
| cmp_item * | eval_item |
| bool | cond_false |
| DTCollation | cmp_collation |
Friends | |
| class | Item_equal_iterator |
Definition at line 1267 of file item_cmpfunc.h.
| Item_equal::Item_equal | ( | ) | [inline] |
Definition at line 1275 of file item_cmpfunc.h.
References Item_func::const_item_cache.
01276 : Item_bool_func(), const_item(0), eval_item(0), cond_false(0) 01277 { const_item_cache=0 ;}
| Item_equal::Item_equal | ( | Item_field * | f1, | |
| Item_field * | f2 | |||
| ) |
Definition at line 3738 of file item_cmpfunc.cc.
References Item_func::const_item_cache, f1, f2, fields, and List< T >::push_back().
03739 : Item_bool_func(), const_item(0), eval_item(0), cond_false(0) 03740 { 03741 const_item_cache= 0; 03742 fields.push_back(f1); 03743 fields.push_back(f2); 03744 }
Here is the call graph for this function:

| Item_equal::Item_equal | ( | Item * | c, | |
| Item_field * | f | |||
| ) |
Definition at line 3746 of file item_cmpfunc.cc.
References Item_func::const_item(), Item_func::const_item_cache, f, fields, and List< T >::push_back().
03747 : Item_bool_func(), eval_item(0), cond_false(0) 03748 { 03749 const_item_cache= 0; 03750 fields.push_back(f); 03751 const_item= c; 03752 }
Here is the call graph for this function:

| Item_equal::Item_equal | ( | Item_equal * | item_equal | ) |
Definition at line 3755 of file item_cmpfunc.cc.
References cond_false, const_item, Item_func::const_item(), Item_func::const_item_cache, fields, and List< T >::push_back().
03756 : Item_bool_func(), eval_item(0), cond_false(0) 03757 { 03758 const_item_cache= 0; 03759 List_iterator_fast<Item_field> li(item_equal->fields); 03760 Item_field *item; 03761 while ((item= li++)) 03762 { 03763 fields.push_back(item); 03764 } 03765 const_item= item_equal->const_item; 03766 cond_false= item_equal->cond_false; 03767 }
Here is the call graph for this function:

| void Item_equal::add | ( | Item_field * | f | ) |
Definition at line 3785 of file item_cmpfunc.cc.
References f, fields, and List< T >::push_back().
Here is the call graph for this function:

| void Item_equal::add | ( | Item * | c | ) |
Definition at line 3769 of file item_cmpfunc.cc.
References cond_false, Item_func::const_item(), Item_func::const_item_cache, and func.
Referenced by check_equality(), merge(), and update_const().
03770 { 03771 if (cond_false) 03772 return; 03773 if (!const_item) 03774 { 03775 const_item= c; 03776 return; 03777 } 03778 Item_func_eq *func= new Item_func_eq(c, const_item); 03779 func->set_cmp_func(); 03780 func->quick_fix_field(); 03781 if ((cond_false= !func->val_int())) 03782 const_item_cache= 1; 03783 }
Here is the call graph for this function:

Here is the caller graph for this function:

| CHARSET_INFO* Item_equal::compare_collation | ( | ) | [inline, virtual] |
Reimplemented from Item.
Definition at line 1301 of file item_cmpfunc.h.
References DTCollation::collation, Item::collation, fields, and List< T >::head().
Here is the call graph for this function:

Definition at line 3811 of file item_cmpfunc.cc.
References Field::eq(), Item_field::field, and fields.
Referenced by find_item_equal(), and Item_field::find_item_equal().
03812 { 03813 List_iterator_fast<Item_field> it(fields); 03814 Item_field *item; 03815 while ((item= it++)) 03816 { 03817 if (field->eq(item->field)) 03818 return 1; 03819 } 03820 return 0; 03821 }
Here is the call graph for this function:

Here is the caller graph for this function:

Reimplemented from Item_func.
Definition at line 3946 of file item_cmpfunc.cc.
References Item_func::const_item_cache, fields, fix_length_and_dec(), Item::fixed, Item::maybe_null, Item::not_null_tables(), Item_func::not_null_tables_cache, Item::used_tables(), and Item_func::used_tables_cache.
03947 { 03948 List_iterator_fast<Item_field> li(fields); 03949 Item *item; 03950 not_null_tables_cache= used_tables_cache= 0; 03951 const_item_cache= 0; 03952 while ((item= li++)) 03953 { 03954 table_map tmp_table_map; 03955 used_tables_cache|= item->used_tables(); 03956 tmp_table_map= item->not_null_tables(); 03957 not_null_tables_cache|= tmp_table_map; 03958 if (item->maybe_null) 03959 maybe_null=1; 03960 } 03961 fix_length_and_dec(); 03962 fixed= 1; 03963 return 0; 03964 }
Here is the call graph for this function:

| void Item_equal::fix_length_and_dec | ( | ) | [virtual] |
Reimplemented from Item_bool_func.
Definition at line 4003 of file item_cmpfunc.cc.
References cmp_item::cmp_charset, cmp_collation, DTCollation::collation, Item::collation, Item_func::const_item(), eval_item, cmp_item::get_comparator(), get_first(), Item::result_type(), and STRING_RESULT.
Referenced by build_equal_items_for_cond(), and fix_fields().
04004 { 04005 Item *item= const_item ? const_item : get_first(); 04006 eval_item= cmp_item::get_comparator(item->result_type(), 04007 item->collation.collation); 04008 if (item->result_type() == STRING_RESULT) 04009 eval_item->cmp_charset= cmp_collation.collation; 04010 }
Here is the call graph for this function:

Here is the caller graph for this function:

| const char* Item_equal::func_name | ( | ) | const [inline, virtual] |
Implements Item_func.
Definition at line 1291 of file item_cmpfunc.h.
Referenced by print().
Here is the caller graph for this function:

| enum Functype Item_equal::functype | ( | ) | const [inline, virtual] |
Reimplemented from Item_func.
Definition at line 1289 of file item_cmpfunc.h.
References Item_func::MULT_EQUAL_FUNC.
01289 { return MULT_EQUAL_FUNC; }
| Item* Item_equal::get_const | ( | ) | [inline] |
Definition at line 1281 of file item_cmpfunc.h.
References Item_func::const_item().
Referenced by add_key_fields(), eliminate_item_equal(), Item_field::equal_fields_propagator(), and get_mm_tree().
01281 { return const_item; }
Here is the call graph for this function:

Here is the caller graph for this function:

| Item_field* Item_equal::get_first | ( | ) | [inline] |
Definition at line 1286 of file item_cmpfunc.h.
References fields, and List< T >::head().
Referenced by fix_length_and_dec(), and Item_field::replace_equal_field().
Here is the call graph for this function:

Here is the caller graph for this function:

| uint Item_equal::members | ( | ) |
Definition at line 3790 of file item_cmpfunc.cc.
References base_list::elements, and fields.
Referenced by build_equal_items_for_cond().
Here is the caller graph for this function:

| void Item_equal::merge | ( | Item_equal * | item | ) |
Definition at line 3842 of file item_cmpfunc.cc.
References add(), List< T >::concat(), cond_false, const_item, and fields.
Referenced by check_equality().
03843 { 03844 fields.concat(&item->fields); 03845 Item *c= item->const_item; 03846 if (c) 03847 { 03848 /* 03849 The flag cond_false will be set to 1 after this, if 03850 the multiple equality already contains a constant and its 03851 value is not equal to the value of c. 03852 */ 03853 add(c); 03854 } 03855 cond_false|= item->cond_false; 03856 }
Here is the call graph for this function:

Here is the caller graph for this function:

| void Item_equal::print | ( | String * | str | ) | [virtual] |
Reimplemented from Item_func.
Definition at line 4039 of file item_cmpfunc.cc.
References String::append(), Item_func::const_item(), fields, func_name(), and Item::print().
04040 { 04041 str->append(func_name()); 04042 str->append('('); 04043 List_iterator_fast<Item_field> it(fields); 04044 Item *item; 04045 if (const_item) 04046 const_item->print(str); 04047 else 04048 { 04049 item= it++; 04050 item->print(str); 04051 } 04052 while ((item= it++)) 04053 { 04054 str->append(','); 04055 str->append(' '); 04056 item->print(str); 04057 } 04058 str->append(')'); 04059 }
Here is the call graph for this function:

| optimize_type Item_equal::select_optimize | ( | ) | const [inline, virtual] |
Reimplemented from Item_func.
Definition at line 1292 of file item_cmpfunc.h.
References Item_func::OPTIMIZE_EQUAL.
01292 { return OPTIMIZE_EQUAL; }
| void Item_equal::sort | ( | Item_field_cmpfunc | cmp, | |
| void * | arg | |||
| ) |
Definition at line 3883 of file item_cmpfunc.cc.
References cmp, FALSE, fields, List_iterator< T >::ref(), List_iterator< T >::rewind(), mySTL::swap(), and TRUE.
Referenced by substitute_for_best_equal_field().
03884 { 03885 bool swap; 03886 List_iterator<Item_field> it(fields); 03887 do 03888 { 03889 Item_field *item1= it++; 03890 Item_field **ref1= it.ref(); 03891 Item_field *item2; 03892 03893 swap= FALSE; 03894 while ((item2= it++)) 03895 { 03896 Item_field **ref2= it.ref(); 03897 if (cmp(item1, item2, arg) < 0) 03898 { 03899 Item_field *item= *ref1; 03900 *ref1= *ref2; 03901 *ref2= item; 03902 swap= TRUE; 03903 } 03904 else 03905 { 03906 item1= item2; 03907 ref1= ref2; 03908 } 03909 } 03910 it.rewind(); 03911 } while (swap); 03912 }
Here is the call graph for this function:

Here is the caller graph for this function:

| Item * Item_equal::transform | ( | Item_transformer | transformer, | |
| byte * | arg | |||
| ) | [virtual] |
Reimplemented from Item_func.
Definition at line 4024 of file item_cmpfunc.cc.
References fields, Item::new_item(), List_iterator< T >::replace(), Item_func::transform(), and Item::transform().
Referenced by build_equal_items_for_cond().
04025 { 04026 List_iterator<Item_field> it(fields); 04027 Item *item; 04028 while ((item= it++)) 04029 { 04030 Item *new_item= item->transform(transformer, arg); 04031 if (!new_item) 04032 return 0; 04033 if (new_item != item) 04034 it.replace((Item_field *) new_item); 04035 } 04036 return Item_func::transform(transformer, arg); 04037 }
Here is the call graph for this function:

Here is the caller graph for this function:

| void Item_equal::update_const | ( | ) |
Definition at line 3932 of file item_cmpfunc.cc.
References add(), Item::const_item(), fields, and List_iterator< T >::remove().
03933 { 03934 List_iterator<Item_field> it(fields); 03935 Item *item; 03936 while ((item= it++)) 03937 { 03938 if (item->const_item()) 03939 { 03940 it.remove(); 03941 add(item); 03942 } 03943 } 03944 }
Here is the call graph for this function:

| void Item_equal::update_used_tables | ( | ) | [virtual] |
Reimplemented from Item_func.
Definition at line 3966 of file item_cmpfunc.cc.
References cond_false, Item::const_item(), Item_func::const_item_cache, fields, Item_func::not_null_tables_cache, Item::update_used_tables(), Item::used_tables(), and Item_func::used_tables_cache.
Referenced by build_equal_items_for_cond().
03967 { 03968 List_iterator_fast<Item_field> li(fields); 03969 Item *item; 03970 not_null_tables_cache= used_tables_cache= 0; 03971 if ((const_item_cache= cond_false)) 03972 return; 03973 while ((item=li++)) 03974 { 03975 item->update_used_tables(); 03976 used_tables_cache|= item->used_tables(); 03977 const_item_cache&= item->const_item(); 03978 } 03979 }
Here is the call graph for this function:

Here is the caller graph for this function:

| longlong Item_equal::val_int | ( | ) | [virtual] |
Implements Item.
Definition at line 3981 of file item_cmpfunc.cc.
References cmp_item::cmp(), cond_false, Item_func::const_item(), st_table::const_table, eval_item, Item_field::field, fields, Item::null_value, cmp_item::store_value(), and Field::table.
03982 { 03983 Item_field *item_field; 03984 if (cond_false) 03985 return 0; 03986 List_iterator_fast<Item_field> it(fields); 03987 Item *item= const_item ? const_item : it++; 03988 if ((null_value= item->null_value)) 03989 return 0; 03990 eval_item->store_value(item); 03991 while ((item_field= it++)) 03992 { 03993 /* Skip fields of non-const tables. They haven't been read yet */ 03994 if (item_field->field->table->const_table) 03995 { 03996 if ((null_value= item_field->null_value) || eval_item->cmp(item_field)) 03997 return 0; 03998 } 03999 } 04000 return 1; 04001 }
Here is the call graph for this function:

| bool Item_equal::walk | ( | Item_processor | processor, | |
| bool | walk_subquery, | |||
| byte * | arg | |||
| ) | [virtual] |
Reimplemented from Item_func.
Definition at line 4012 of file item_cmpfunc.cc.
References fields, Item_func::walk(), and Item::walk().
04013 { 04014 List_iterator_fast<Item_field> it(fields); 04015 Item *item; 04016 while ((item= it++)) 04017 { 04018 if (item->walk(processor, walk_subquery, arg)) 04019 return 1; 04020 } 04021 return Item_func::walk(processor, walk_subquery, arg); 04022 }
Here is the call graph for this function:

friend class Item_equal_iterator [friend] |
Definition at line 1294 of file item_cmpfunc.h.
DTCollation Item_equal::cmp_collation [private] |
bool Item_equal::cond_false [private] |
Definition at line 1272 of file item_cmpfunc.h.
Referenced by add(), Item_equal(), merge(), update_used_tables(), and val_int().
Item* Item_equal::const_item [private] |
cmp_item* Item_equal::eval_item [private] |
List<Item_field> Item_equal::fields [private] |
Definition at line 1269 of file item_cmpfunc.h.
Referenced by add(), compare_collation(), contains(), fix_fields(), get_first(), Item_equal(), members(), merge(), print(), sort(), transform(), update_const(), update_used_tables(), val_int(), and walk().
1.4.7

