Read a constant table when there is at most one matching row, using a table scan. @param tab Table to read @retval 0 Row was found @retval -1 Row was not found @retval 1 Got an error (other than row not found) during read */
| 25251 | @retval 1 Got an error (other than row not found) during read |
| 25252 | */ |
| 25253 | static int |
| 25254 | join_read_system(JOIN_TAB *tab) |
| 25255 | { |
| 25256 | TABLE *table= tab->table; |
| 25257 | int error; |
| 25258 | if (table->status & STATUS_GARBAGE) // If first read |
| 25259 | { |
| 25260 | if (unlikely((error= |
| 25261 | table->file->ha_read_first_row(table->record[0], |
| 25262 | table->s->primary_key)))) |
| 25263 | { |
| 25264 | if (error != HA_ERR_END_OF_FILE) |
| 25265 | return report_error(table, error); |
| 25266 | table->const_table= 1; |
| 25267 | mark_as_null_row(tab->table); |
| 25268 | empty_record(table); // Make empty record |
| 25269 | return -1; |
| 25270 | } |
| 25271 | store_record(table,record[1]); |
| 25272 | } |
| 25273 | else if (!table->status) // Only happens with left join |
| 25274 | restore_record(table,record[1]); // restore old record |
| 25275 | table->null_row=0; |
| 25276 | return table->status ? -1 : 0; |
| 25277 | } |
| 25278 | |
| 25279 | |
| 25280 | /** |
no test coverage detected