| 11387 | */ |
| 11388 | |
| 11389 | static |
| 11390 | TABLE_LIST *get_trigger_table(THD *thd, const sp_name *trg_name) |
| 11391 | { |
| 11392 | char trn_path_buff[FN_REFLEN]; |
| 11393 | LEX_CSTRING trn_path= { trn_path_buff, 0 }; |
| 11394 | LEX_CSTRING db; |
| 11395 | LEX_CSTRING tbl_name; |
| 11396 | TABLE_LIST *table; |
| 11397 | |
| 11398 | build_trn_path(thd, trg_name, (LEX_STRING*) &trn_path); |
| 11399 | |
| 11400 | if (check_trn_exists(&trn_path)) |
| 11401 | { |
| 11402 | my_error(ER_TRG_DOES_NOT_EXIST, MYF(0)); |
| 11403 | return NULL; |
| 11404 | } |
| 11405 | |
| 11406 | if (load_table_name_for_trigger(thd, trg_name, &trn_path, &tbl_name)) |
| 11407 | return NULL; |
| 11408 | |
| 11409 | /* We need to reset statement table list to be PS/SP friendly. */ |
| 11410 | if (!(table= thd->alloc<TABLE_LIST>(1))) |
| 11411 | return NULL; |
| 11412 | |
| 11413 | db= thd->make_ident_opt_casedn(trg_name->m_db, lower_case_table_names); |
| 11414 | |
| 11415 | tbl_name.str= thd->strmake(tbl_name.str, tbl_name.length); |
| 11416 | |
| 11417 | if (db.str == NULL || tbl_name.str == NULL) |
| 11418 | return NULL; |
| 11419 | |
| 11420 | table->init_one_table(&db, &tbl_name, 0, TL_IGNORE); |
| 11421 | |
| 11422 | return table; |
| 11423 | } |
| 11424 | |
| 11425 | |
| 11426 | /** |
no test coverage detected