| 730 | */ |
| 731 | |
| 732 | static int drop_server_internal(THD *thd, LEX_SERVER_OPTIONS *server_options) |
| 733 | { |
| 734 | int error; |
| 735 | TABLE_LIST tables; |
| 736 | TABLE *table; |
| 737 | |
| 738 | DBUG_ENTER("drop_server_internal"); |
| 739 | DBUG_PRINT("info", ("server name server->server_name %s", |
| 740 | server_options->server_name.str)); |
| 741 | |
| 742 | tables.init_one_table(&MYSQL_SCHEMA_NAME, &MYSQL_SERVERS_NAME, 0, TL_WRITE); |
| 743 | |
| 744 | /* hit the memory hit first */ |
| 745 | if (unlikely((error= delete_server_record_in_cache(server_options)))) |
| 746 | goto end; |
| 747 | |
| 748 | table= open_ltable(thd, &tables, TL_WRITE, MYSQL_LOCK_IGNORE_TIMEOUT); |
| 749 | if (!table || !servers_table_is_valid(table)) |
| 750 | { |
| 751 | error= my_errno; |
| 752 | goto end; |
| 753 | } |
| 754 | |
| 755 | error= delete_server_record(table, &server_options->server_name); |
| 756 | |
| 757 | close_mysql_tables(thd); |
| 758 | |
| 759 | end: |
| 760 | DBUG_RETURN(error); |
| 761 | } |
| 762 | |
| 763 | |
| 764 | /** |
no test coverage detected