| 1359 | |
| 1360 | |
| 1361 | static |
| 1362 | TABLE_LIST* |
| 1363 | find_table(THD *thd, TABLE_LIST *table, TABLE_LIST *table_list, |
| 1364 | uint check_flag, SELECT_LEX *sel, find_table_callback callback ) |
| 1365 | { |
| 1366 | TABLE_LIST *dup; |
| 1367 | |
| 1368 | table= table->find_table_for_update(); |
| 1369 | |
| 1370 | if (table->table && |
| 1371 | table->table->file->ha_table_flags() & HA_CAN_MULTISTEP_MERGE) |
| 1372 | { |
| 1373 | TABLE_LIST *child; |
| 1374 | dup= NULL; |
| 1375 | /* Check duplicates of all merge children. */ |
| 1376 | for (child= table->next_global; child; |
| 1377 | child= child->next_global) |
| 1378 | { |
| 1379 | if (child->table && |
| 1380 | child->table->file->ha_table_flags() & HA_CAN_MULTISTEP_MERGE) |
| 1381 | continue; |
| 1382 | |
| 1383 | /* |
| 1384 | Ensure that the child has one parent that is the table that is |
| 1385 | updated. |
| 1386 | */ |
| 1387 | TABLE_LIST *tmp_parent= child; |
| 1388 | while ((tmp_parent= tmp_parent->parent_l)) |
| 1389 | { |
| 1390 | if (tmp_parent == table) |
| 1391 | break; |
| 1392 | } |
| 1393 | if (!tmp_parent) |
| 1394 | break; |
| 1395 | |
| 1396 | if ((dup= (*callback)(thd, child, child->next_global, check_flag, sel))) |
| 1397 | break; |
| 1398 | } |
| 1399 | } |
| 1400 | else |
| 1401 | dup= (*callback)(thd, table, table_list, check_flag, sel); |
| 1402 | return dup; |
| 1403 | } |
| 1404 | |
| 1405 | |
| 1406 | /* |
no test coverage detected