| 12426 | */ |
| 12427 | |
| 12428 | bool |
| 12429 | st_select_lex::build_pushable_cond_for_having_pushdown(THD *thd, Item *cond) |
| 12430 | { |
| 12431 | List<Item> equalities; |
| 12432 | |
| 12433 | /* Condition can't be pushed */ |
| 12434 | if (cond->get_extraction_flag() == MARKER_NO_EXTRACTION) |
| 12435 | return false; |
| 12436 | |
| 12437 | /** |
| 12438 | Condition can be pushed entirely. |
| 12439 | Transform its multiple equalities and add to attach_to_conds list. |
| 12440 | */ |
| 12441 | if (cond->get_extraction_flag() == MARKER_FULL_EXTRACTION) |
| 12442 | { |
| 12443 | Item *result= cond->top_level_transform(thd, |
| 12444 | &Item::multiple_equality_transformer, (uchar *)this); |
| 12445 | if (!result) |
| 12446 | return true; |
| 12447 | if (result->type() == Item::COND_ITEM && |
| 12448 | ((Item_cond*) result)->functype() == Item_func::COND_AND_FUNC) |
| 12449 | { |
| 12450 | List_iterator<Item> li(*((Item_cond*) result)->argument_list()); |
| 12451 | Item *item; |
| 12452 | while ((item= li++)) |
| 12453 | { |
| 12454 | if (attach_to_conds.push_back(item, thd->mem_root)) |
| 12455 | return true; |
| 12456 | } |
| 12457 | } |
| 12458 | else |
| 12459 | { |
| 12460 | if (attach_to_conds.push_back(result, thd->mem_root)) |
| 12461 | return true; |
| 12462 | } |
| 12463 | return false; |
| 12464 | } |
| 12465 | |
| 12466 | /** |
| 12467 | There is no flag set for this condition. It means that some |
| 12468 | part of this condition can be pushed. |
| 12469 | */ |
| 12470 | if (cond->type() != Item::COND_ITEM) |
| 12471 | return false; |
| 12472 | |
| 12473 | if (((Item_cond *)cond)->functype() != Item_cond::COND_AND_FUNC) |
| 12474 | { |
| 12475 | /* |
| 12476 | cond is not a conjunctive formula and it cannot be pushed into WHERE. |
| 12477 | Try to extract a formula that can be pushed. |
| 12478 | */ |
| 12479 | Item *fix= cond->build_pushable_cond(thd, 0, 0); |
| 12480 | if (!fix) |
| 12481 | return false; |
| 12482 | if (attach_to_conds.push_back(fix, thd->mem_root)) |
| 12483 | return true; |
| 12484 | } |
| 12485 | else |
nothing calls this directly
no test coverage detected