MCPcopy Create free account
hub / github.com/MariaDB/server / update_server_record

Function update_server_record

sql/sql_servers.cc:1012–1059  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1010
1011
1012static int
1013update_server_record(TABLE *table, FOREIGN_SERVER *server)
1014{
1015 int error=0;
1016 DBUG_ENTER("update_server_record");
1017 DBUG_ASSERT(!table->file->row_logging);
1018
1019 table->use_all_columns();
1020 /* set the field that's the PK to the value we're looking for */
1021 if (table->field[SERVER_NAME_FIELD]->store(server->server_name,
1022 server->server_name_length,
1023 system_charset_info))
1024 {
1025 DBUG_ASSERT(0); /* Protected by servers_cache */
1026 THD *thd= table->in_use;
1027 DBUG_ASSERT(thd->is_error());
1028 return thd->get_stmt_da()->get_sql_errno();
1029 }
1030
1031 if ((error=table->file->ha_index_read_idx_map(table->record[0], 0,
1032 (uchar *)table->field[SERVER_NAME_FIELD]->ptr,
1033 ~(longlong)0, HA_READ_KEY_EXACT)))
1034 {
1035 if (error != HA_ERR_KEY_NOT_FOUND && error != HA_ERR_END_OF_FILE)
1036 table->file->print_error(error, MYF(0));
1037 DBUG_PRINT("info",("server not found!"));
1038 error= ER_FOREIGN_SERVER_DOESNT_EXIST;
1039 }
1040 else
1041 {
1042 /* ok, so we can update since the record exists in the table */
1043 store_record(table,record[1]);
1044 if ((error= store_server_fields(table, server)))
1045 goto end;
1046 if (unlikely((error=table->file->ha_update_row(table->record[1],
1047 table->record[0])) &&
1048 error != HA_ERR_RECORD_IS_THE_SAME))
1049 {
1050 DBUG_PRINT("info",("problems with ha_update_row %d", error));
1051 goto end;
1052 }
1053 else
1054 error= 0;
1055 }
1056
1057end:
1058 DBUG_RETURN(error);
1059}
1060
1061
1062/*

Callers 1

update_serverFunction · 0.85

Calls 9

store_server_fieldsFunction · 0.85
use_all_columnsMethod · 0.80
get_sql_errnoMethod · 0.80
get_stmt_daMethod · 0.80
ha_index_read_idx_mapMethod · 0.80
ha_update_rowMethod · 0.80
storeMethod · 0.45
is_errorMethod · 0.45
print_errorMethod · 0.45

Tested by

no test coverage detected