| 1440 | */ |
| 1441 | |
| 1442 | Item *transform_condition_or_part(THD *thd, |
| 1443 | Item *cond, |
| 1444 | Item_transformer transformer, |
| 1445 | uchar *arg) |
| 1446 | { |
| 1447 | if (cond->type() != Item::COND_ITEM || |
| 1448 | ((Item_cond*) cond)->functype() != Item_func::COND_AND_FUNC) |
| 1449 | { |
| 1450 | Item *new_item= cond->transform(thd, transformer, arg); |
| 1451 | // Indicate that the condition is not pushable |
| 1452 | if (!new_item) |
| 1453 | cond->clear_extraction_flag(); |
| 1454 | return new_item; |
| 1455 | } |
| 1456 | |
| 1457 | List_iterator<Item> li(*((Item_cond*) cond)->argument_list()); |
| 1458 | Item *item; |
| 1459 | while ((item=li++)) |
| 1460 | { |
| 1461 | Item *new_item= item->transform(thd, transformer, arg); |
| 1462 | if (!new_item) |
| 1463 | { |
| 1464 | // Indicate that the condition is not pushable |
| 1465 | item->clear_extraction_flag(); |
| 1466 | li.remove(); |
| 1467 | } |
| 1468 | else |
| 1469 | li.replace(new_item); |
| 1470 | } |
| 1471 | |
| 1472 | switch (((Item_cond*) cond)->argument_list()->elements) |
| 1473 | { |
| 1474 | case 0: |
| 1475 | return NULL; |
| 1476 | case 1: |
| 1477 | return ((Item_cond*) cond)->argument_list()->head(); |
| 1478 | default: |
| 1479 | return cond; |
| 1480 | } |
| 1481 | } |
| 1482 | |
| 1483 | |
| 1484 | /** |
no test coverage detected