| 3177 | */ |
| 3178 | |
| 3179 | void Show_explain_request::call_in_target_thread() |
| 3180 | { |
| 3181 | Query_arena backup_arena; |
| 3182 | bool printed_anything= FALSE; |
| 3183 | |
| 3184 | /* |
| 3185 | Change the arena because JOIN::print_explain and co. are going to allocate |
| 3186 | items. Let them allocate them on our arena. |
| 3187 | */ |
| 3188 | target_thd->set_n_backup_active_arena((Query_arena*)request_thd, |
| 3189 | &backup_arena); |
| 3190 | |
| 3191 | query_str.copy(target_thd->query(), |
| 3192 | target_thd->query_length(), |
| 3193 | target_thd->query_charset()); |
| 3194 | |
| 3195 | DBUG_ASSERT(current_thd == target_thd); |
| 3196 | |
| 3197 | /* |
| 3198 | When producing JSON output, one should not change current_thd. |
| 3199 | (If one does that, they will hit an assert when printing constant item |
| 3200 | fields). |
| 3201 | */ |
| 3202 | if (target_thd->lex->print_explain(explain_buf, 0 /* explain flags*/, |
| 3203 | is_analyze, is_json_format, |
| 3204 | &printed_anything)) |
| 3205 | { |
| 3206 | failed_to_produce= TRUE; |
| 3207 | } |
| 3208 | |
| 3209 | if (!printed_anything) |
| 3210 | failed_to_produce= TRUE; |
| 3211 | |
| 3212 | target_thd->restore_active_arena((Query_arena*)request_thd, &backup_arena); |
| 3213 | } |
| 3214 | |
| 3215 | |
| 3216 | int select_result_explain_buffer::send_data(List<Item> &items) |
no test coverage detected