| 25480 | */ |
| 25481 | |
| 25482 | static int |
| 25483 | join_read_always_key(JOIN_TAB *tab) |
| 25484 | { |
| 25485 | int error; |
| 25486 | TABLE *table= tab->table; |
| 25487 | |
| 25488 | /* Initialize the index first */ |
| 25489 | if (!table->file->inited) |
| 25490 | { |
| 25491 | if (unlikely((error= table->file->ha_index_init(tab->ref.key, |
| 25492 | tab->sorted)))) |
| 25493 | { |
| 25494 | (void) report_error(table, error); |
| 25495 | return 1; |
| 25496 | } |
| 25497 | } |
| 25498 | |
| 25499 | if (unlikely(cp_buffer_from_ref(tab->join->thd, table, &tab->ref))) |
| 25500 | return -1; |
| 25501 | if (unlikely((error= |
| 25502 | table->file->prepare_index_key_scan_map(tab->ref.key_buff, |
| 25503 | make_prev_keypart_map(tab->ref.key_parts))))) |
| 25504 | { |
| 25505 | report_error(table,error); |
| 25506 | return -1; |
| 25507 | } |
| 25508 | if ((error= table->file->ha_index_read_map(table->record[0], |
| 25509 | tab->ref.key_buff, |
| 25510 | make_prev_keypart_map(tab->ref.key_parts), |
| 25511 | HA_READ_KEY_EXACT))) |
| 25512 | { |
| 25513 | if (error != HA_ERR_KEY_NOT_FOUND && error != HA_ERR_END_OF_FILE) |
| 25514 | return report_error(table, error); |
| 25515 | return -1; /* purecov: inspected */ |
| 25516 | } |
| 25517 | return 0; |
| 25518 | } |
| 25519 | |
| 25520 | |
| 25521 | /** |
no test coverage detected