@@ -12685,27 +12685,21 @@ static bool check_row_equality(THD *thd, Item *left_row, Item_row *right_row,
1268512685           or, if the procedure fails by a fatal error.
1268612686*/
1268712687
12688- static  bool check_equality(THD *thd, Item *item , COND_EQUAL *cond_equal,
12689-                            List<Item> *eq_list)
12688+ bool Item_func_eq:: check_equality(THD *thd, COND_EQUAL *cond_equal,
12689+                                    List<Item> *eq_list)
1269012690{
12691-   if (item->type() == Item::FUNC_ITEM &&
12692-          ((Item_func*) item)->functype() == Item_func::EQ_FUNC)
12693-   {
12694-     Item *left_item= ((Item_func*) item)->arguments()[0];
12695-     Item *right_item= ((Item_func*) item)->arguments()[1];
12691+   Item *left_item= arguments()[0];
12692+   Item *right_item= arguments()[1];
1269612693
12697-     if (left_item->type() == Item::ROW_ITEM &&
12698-         right_item->type() == Item::ROW_ITEM)
12699-     {
12700-       return check_row_equality(thd,
12701-                                 (Item_row *) left_item,
12702-                                 (Item_row *) right_item,
12703-                                 cond_equal, eq_list);
12704-     }
12705-     else 
12706-       return check_simple_equality(left_item, right_item, item, cond_equal);
12707-   } 
12708-   return FALSE;
12694+   if (left_item->type() == Item::ROW_ITEM &&
12695+       right_item->type() == Item::ROW_ITEM)
12696+   {
12697+     return check_row_equality(thd,
12698+                               (Item_row *) left_item,
12699+                               (Item_row *) right_item,
12700+                               cond_equal, eq_list);
12701+   }
12702+   return check_simple_equality(left_item, right_item, this, cond_equal);
1270912703}
1271012704
1271112705
@@ -12804,7 +12798,7 @@ COND *Item_cond_and::build_equal_items(THD *thd,
1280412798      structure here because it's restored before each
1280512799      re-execution of any prepared statement/stored procedure.
1280612800    */
12807-     if (check_equality(thd, item , &cond_equal, &eq_list))
12801+     if (item-> check_equality(thd, &cond_equal, &eq_list))
1280812802      li.remove();
1280912803  }
1281012804
@@ -12893,9 +12887,9 @@ COND *Item_cond::build_equal_items(THD *thd,
1289312887}
1289412888
1289512889
12896- COND *Item_func ::build_equal_items(THD *thd,
12897-                                    COND_EQUAL *inherited,
12898-                                    bool link_item_fields)
12890+ COND *Item_func_eq ::build_equal_items(THD *thd,
12891+                                        COND_EQUAL *inherited,
12892+                                        bool link_item_fields)
1289912893{
1290012894  COND_EQUAL cond_equal;
1290112895  cond_equal.upper_levels= inherited;
@@ -12910,7 +12904,7 @@ COND *Item_func::build_equal_items(THD *thd,
1291012904    for WHERE a=b AND c=d AND (b=c OR d=5)
1291112905    b=c is replaced by =(a,b,c,d).  
1291212906   */
12913-   if (check_equality(thd, this , &cond_equal, &eq_list))
12907+   if (Item_func_eq:: check_equality(thd, &cond_equal, &eq_list))
1291412908  {
1291512909    Item_equal *item_equal;
1291612910    int n= cond_equal.current_level.elements + eq_list.elements;
@@ -12955,6 +12949,13 @@ COND *Item_func::build_equal_items(THD *thd,
1295512949      return and_cond;
1295612950    }
1295712951  }
12952+   return Item_func::build_equal_items(thd, inherited, link_item_fields);
12953+ }
12954+ 
12955+ 
12956+ COND *Item_func::build_equal_items(THD *thd, COND_EQUAL *inherited,
12957+                                    bool link_item_fields)
12958+ {
1295812959  /* 
1295912960    For each field reference in cond, not from equal item predicates,
1296012961    set a pointer to the multiple equality it belongs to (if there is any)
0 commit comments