| 1075 | */ |
| 1076 | |
| 1077 | static int |
| 1078 | delete_server_record(TABLE *table, LEX_CSTRING *name) |
| 1079 | { |
| 1080 | int error; |
| 1081 | DBUG_ENTER("delete_server_record"); |
| 1082 | DBUG_ASSERT(!table->file->row_logging); |
| 1083 | |
| 1084 | table->use_all_columns(); |
| 1085 | |
| 1086 | /* set the field that's the PK to the value we're looking for */ |
| 1087 | table->field[SERVER_NAME_FIELD]->store(name->str, name->length, system_charset_info); |
| 1088 | |
| 1089 | if ((error= table->file->ha_index_read_idx_map(table->record[0], 0, |
| 1090 | (uchar *)table->field[SERVER_NAME_FIELD]->ptr, |
| 1091 | HA_WHOLE_KEY, HA_READ_KEY_EXACT))) |
| 1092 | { |
| 1093 | if (error != HA_ERR_KEY_NOT_FOUND && error != HA_ERR_END_OF_FILE) |
| 1094 | table->file->print_error(error, MYF(0)); |
| 1095 | DBUG_PRINT("info",("server not found!")); |
| 1096 | error= ER_FOREIGN_SERVER_DOESNT_EXIST; |
| 1097 | } |
| 1098 | else |
| 1099 | { |
| 1100 | if (unlikely((error= table->file->ha_delete_row(table->record[0])))) |
| 1101 | table->file->print_error(error, MYF(0)); |
| 1102 | } |
| 1103 | |
| 1104 | DBUG_RETURN(error); |
| 1105 | } |
| 1106 | |
| 1107 | /* |
| 1108 |
no test coverage detected