| 858 | */ |
| 859 | |
| 860 | int update_server(THD *thd, FOREIGN_SERVER *existing, FOREIGN_SERVER *altered) |
| 861 | { |
| 862 | int error; |
| 863 | TABLE *table; |
| 864 | TABLE_LIST tables; |
| 865 | DBUG_ENTER("update_server"); |
| 866 | |
| 867 | tables.init_one_table(&MYSQL_SCHEMA_NAME, &MYSQL_SERVERS_NAME, 0, TL_WRITE); |
| 868 | |
| 869 | table= open_ltable(thd, &tables, TL_WRITE, MYSQL_LOCK_IGNORE_TIMEOUT); |
| 870 | if (!table || !servers_table_is_valid(table)) |
| 871 | { |
| 872 | error= my_errno; |
| 873 | goto end; |
| 874 | } |
| 875 | |
| 876 | if (unlikely((error= update_server_record(table, altered)))) |
| 877 | goto end; |
| 878 | |
| 879 | error= update_server_record_in_cache(existing, altered); |
| 880 | |
| 881 | /* |
| 882 | Perform a reload so we don't have a 'hole' in our mem_root |
| 883 | */ |
| 884 | servers_load(thd, &tables); |
| 885 | |
| 886 | end: |
| 887 | DBUG_RETURN(error); |
| 888 | } |
| 889 | |
| 890 | |
| 891 | /* |
no test coverage detected