| 326 | |
| 327 | |
| 328 | bool sp_head::restore_lex(THD *thd) |
| 329 | { |
| 330 | LEX *sublex= thd->lex; |
| 331 | |
| 332 | sublex->set_trg_event_type_for_tables(); |
| 333 | |
| 334 | LEX *oldlex= (LEX *) m_parser_data.pop_lex(); |
| 335 | |
| 336 | if (!oldlex) |
| 337 | return false; // Nothing to restore |
| 338 | |
| 339 | /* If this substatement is unsafe, the entire routine is too. */ |
| 340 | DBUG_PRINT("info", ("lex->get_stmt_unsafe_flags: 0x%x", |
| 341 | thd->lex->get_stmt_unsafe_flags())); |
| 342 | unsafe_flags|= sublex->get_stmt_unsafe_flags(); |
| 343 | |
| 344 | /* |
| 345 | Add routines which are used by statement to respective set for |
| 346 | this routine. |
| 347 | */ |
| 348 | // if (sp_update_sp_used_routines(&m_sroutines, &sublex->sroutines)) |
| 349 | // return true; |
| 350 | |
| 351 | /* If this substatement is a update query, then mark MODIFIES_DATA */ |
| 352 | if (is_update_query(sublex->sql_command)) |
| 353 | m_flags|= MODIFIES_DATA; |
| 354 | |
| 355 | /* |
| 356 | Merge tables used by this statement (but not by its functions or |
| 357 | procedures) to multiset of tables used by this routine. |
| 358 | */ |
| 359 | merge_table_list(thd, sublex->query_tables, sublex); |
| 360 | |
| 361 | if (!sublex->sp_lex_in_use) |
| 362 | { |
| 363 | sublex->sphead= NULL; |
| 364 | lex_end(sublex); |
| 365 | delete sublex; |
| 366 | } |
| 367 | |
| 368 | thd->lex= oldlex; |
| 369 | return false; |
| 370 | } |
| 371 | |
| 372 | |
| 373 |
nothing calls this directly
no test coverage detected