| 2806 | |
| 2807 | |
| 2808 | void Locked_tables_list::unlink_from_list(THD *thd, |
| 2809 | TABLE_LIST *table_list, |
| 2810 | bool remove_from_locked_tables) |
| 2811 | { |
| 2812 | /* |
| 2813 | If mode is not LTM_LOCK_TABLES, we needn't do anything. Moreover, |
| 2814 | outside this mode pos_in_locked_tables value is not trustworthy. |
| 2815 | */ |
| 2816 | if (thd->locked_tables_mode != LTM_LOCK_TABLES && |
| 2817 | thd->locked_tables_mode != LTM_PRELOCKED_UNDER_LOCK_TABLES) |
| 2818 | return; |
| 2819 | |
| 2820 | /* |
| 2821 | table_list must be set and point to pos_in_locked_tables of some |
| 2822 | table. |
| 2823 | */ |
| 2824 | DBUG_ASSERT(table_list->table->pos_in_locked_tables == table_list); |
| 2825 | |
| 2826 | /* Clear the pointer, the table will be returned to the table cache. */ |
| 2827 | table_list->table->pos_in_locked_tables= NULL; |
| 2828 | |
| 2829 | /* Mark the table as closed in the locked tables list. */ |
| 2830 | table_list->table= NULL; |
| 2831 | |
| 2832 | /* |
| 2833 | If the table is being dropped or renamed, remove it from |
| 2834 | the locked tables list (implicitly drop the LOCK TABLES lock |
| 2835 | on it). |
| 2836 | */ |
| 2837 | if (remove_from_locked_tables) |
| 2838 | { |
| 2839 | *table_list->prev_global= table_list->next_global; |
| 2840 | if (table_list->next_global == NULL) |
| 2841 | m_locked_tables_last= table_list->prev_global; |
| 2842 | else |
| 2843 | table_list->next_global->prev_global= table_list->prev_global; |
| 2844 | m_locked_tables_count--; |
| 2845 | } |
| 2846 | } |
| 2847 | |
| 2848 | /** |
| 2849 | This is an attempt to recover (somewhat) in case of an error. |
no outgoing calls
no test coverage detected