| 469 | */ |
| 470 | |
| 471 | static int |
| 472 | insert_server(THD *thd, FOREIGN_SERVER *server) |
| 473 | { |
| 474 | int error= -1; |
| 475 | TABLE_LIST tables; |
| 476 | TABLE *table; |
| 477 | DBUG_ENTER("insert_server"); |
| 478 | |
| 479 | tables.init_one_table(&MYSQL_SCHEMA_NAME, &MYSQL_SERVERS_NAME, 0, TL_WRITE); |
| 480 | |
| 481 | /* need to open before acquiring THR_LOCK_plugin or it will deadlock */ |
| 482 | table= open_ltable(thd, &tables, TL_WRITE, MYSQL_LOCK_IGNORE_TIMEOUT); |
| 483 | if (!table || !servers_table_is_valid(table)) |
| 484 | goto end; |
| 485 | |
| 486 | table->file->row_logging= 0; // Don't log to binary log |
| 487 | |
| 488 | /* insert the server into the table */ |
| 489 | if (unlikely(error= insert_server_record(table, server))) |
| 490 | goto end; |
| 491 | |
| 492 | /* insert the server into the cache */ |
| 493 | if (unlikely((error= insert_server_record_into_cache(server)))) |
| 494 | goto end; |
| 495 | |
| 496 | end: |
| 497 | DBUG_RETURN(error); |
| 498 | } |
| 499 | |
| 500 | |
| 501 | /* |
no test coverage detected