| 559 | */ |
| 560 | |
| 561 | static SQL_HANDLER *mysql_ha_find_handler(THD *thd, const LEX_CSTRING *name) |
| 562 | { |
| 563 | SQL_HANDLER *handler; |
| 564 | if ((my_hash_inited(&thd->handler_tables_hash)) && |
| 565 | (handler= (SQL_HANDLER*) my_hash_search(&thd->handler_tables_hash, |
| 566 | (const uchar*) name->str, |
| 567 | name->length + 1))) |
| 568 | { |
| 569 | DBUG_PRINT("info-in-hash",("'%s'.'%s' as '%s' table: %p", |
| 570 | handler->db.str, |
| 571 | handler->table_name.str, |
| 572 | handler->handler_name.str, handler->table)); |
| 573 | if (!handler->table) |
| 574 | { |
| 575 | /* The handler table has been closed. Re-open it. */ |
| 576 | TABLE_LIST tmp; |
| 577 | tmp.init_one_table(&handler->db, &handler->table_name, |
| 578 | &handler->handler_name, TL_READ); |
| 579 | |
| 580 | if (mysql_ha_open(thd, &tmp, handler)) |
| 581 | { |
| 582 | DBUG_PRINT("exit",("reopen failed")); |
| 583 | return 0; |
| 584 | } |
| 585 | } |
| 586 | } |
| 587 | else |
| 588 | { |
| 589 | my_error(ER_UNKNOWN_TABLE, MYF(0), name->str, "HANDLER"); |
| 590 | return 0; |
| 591 | } |
| 592 | return handler; |
| 593 | } |
| 594 | |
| 595 | |
| 596 | /** |
no test coverage detected