| 25288 | */ |
| 25289 | |
| 25290 | static int |
| 25291 | join_read_const(JOIN_TAB *tab) |
| 25292 | { |
| 25293 | int error; |
| 25294 | TABLE *table= tab->table; |
| 25295 | if (table->status & STATUS_GARBAGE) // If first read |
| 25296 | { |
| 25297 | table->status= 0; |
| 25298 | if (cp_buffer_from_ref(tab->join->thd, table, &tab->ref)) |
| 25299 | error=HA_ERR_KEY_NOT_FOUND; |
| 25300 | else |
| 25301 | { |
| 25302 | handler *file= table->file; |
| 25303 | if (table->covering_keys.is_set(tab->ref.key) && !table->no_keyread && |
| 25304 | (int) table->reginfo.lock_type <= (int) TL_READ_HIGH_PRIORITY) |
| 25305 | { |
| 25306 | file->ha_start_keyread(tab->ref.key); |
| 25307 | /* This is probably needed for analyze table */ |
| 25308 | tab->index= tab->ref.key; |
| 25309 | } |
| 25310 | error= file-> |
| 25311 | ha_index_read_idx_map(table->record[0],tab->ref.key, |
| 25312 | (uchar*) tab->ref.key_buff, |
| 25313 | make_prev_keypart_map(tab->ref.key_parts), |
| 25314 | HA_READ_KEY_EXACT); |
| 25315 | file->ha_end_keyread(); |
| 25316 | } |
| 25317 | if (unlikely(error)) |
| 25318 | { |
| 25319 | table->status= STATUS_NOT_FOUND; |
| 25320 | mark_as_null_row(tab->table); |
| 25321 | empty_record(table); |
| 25322 | if (error != HA_ERR_KEY_NOT_FOUND && error != HA_ERR_END_OF_FILE) |
| 25323 | return report_error(table, error); |
| 25324 | return -1; |
| 25325 | } |
| 25326 | store_record(table,record[1]); |
| 25327 | } |
| 25328 | else if (!(table->status & ~STATUS_NULL_ROW)) // Only happens with left join |
| 25329 | { |
| 25330 | table->status=0; |
| 25331 | restore_record(table,record[1]); // restore old record |
| 25332 | } |
| 25333 | table->null_row=0; |
| 25334 | return table->status ? -1 : 0; |
| 25335 | } |
| 25336 | |
| 25337 | /* |
| 25338 | eq_ref access method implementation: "read_first" function |
no test coverage detected