| 16765 | */ |
| 16766 | |
| 16767 | void JOIN_TAB::cleanup() |
| 16768 | { |
| 16769 | DBUG_ENTER("JOIN_TAB::cleanup"); |
| 16770 | |
| 16771 | DBUG_PRINT("enter", ("tab: %p table %s.%s", |
| 16772 | this, |
| 16773 | (table ? table->s->db.str : "?"), |
| 16774 | (table ? table->s->table_name.str : "?"))); |
| 16775 | delete select; |
| 16776 | select= 0; |
| 16777 | delete quick; |
| 16778 | quick= 0; |
| 16779 | if (rowid_filter) |
| 16780 | clear_range_rowid_filter(); |
| 16781 | if (cache) |
| 16782 | { |
| 16783 | cache->free(); |
| 16784 | cache= 0; |
| 16785 | } |
| 16786 | limit= 0; |
| 16787 | // Free select that was created for filesort outside of create_sort_index |
| 16788 | if (filesort && filesort->select && !filesort->own_select) |
| 16789 | delete filesort->select; |
| 16790 | delete filesort; |
| 16791 | filesort= NULL; |
| 16792 | if (table) |
| 16793 | { |
| 16794 | table->file->ha_end_keyread(); |
| 16795 | if (type == JT_FT) |
| 16796 | table->file->ha_ft_end(); |
| 16797 | else if (table->hlindex && table->hlindex->context) |
| 16798 | table->hlindex_read_end(); |
| 16799 | else |
| 16800 | table->file->ha_index_or_rnd_end(); |
| 16801 | preread_init_done= FALSE; |
| 16802 | if (table->pos_in_table_list && table->pos_in_table_list->jtbm_subselect) |
| 16803 | { |
| 16804 | if (table->pos_in_table_list->jtbm_subselect->is_jtbm_const_tab) |
| 16805 | { |
| 16806 | /* |
| 16807 | Set this to NULL so that cleanup_empty_jtbm_semi_joins() doesn't |
| 16808 | attempt to make another free_tmp_table call. |
| 16809 | */ |
| 16810 | table->pos_in_table_list->table= NULL; |
| 16811 | free_tmp_table(join->thd, table); |
| 16812 | } |
| 16813 | else |
| 16814 | { |
| 16815 | TABLE_LIST *tmp= table->pos_in_table_list; |
| 16816 | end_read_record(&read_record); |
| 16817 | tmp->jtbm_subselect->cleanup(); |
| 16818 | /* |
| 16819 | The above call freed the materialized temptable. Set it to NULL so |
| 16820 | that we don't attempt to touch it if JOIN_TAB::cleanup() is invoked |
| 16821 | multiple times (it may be) |
| 16822 | */ |
| 16823 | tmp->table= NULL; |
| 16824 | } |
no test coverage detected