| 1327 | */ |
| 1328 | |
| 1329 | static void |
| 1330 | prepare_server_struct_for_update(LEX_SERVER_OPTIONS *server_options, |
| 1331 | FOREIGN_SERVER *existing, |
| 1332 | FOREIGN_SERVER *altered) |
| 1333 | { |
| 1334 | DBUG_ENTER("prepare_server_struct_for_update"); |
| 1335 | |
| 1336 | altered->server_name= existing->server_name; |
| 1337 | altered->server_name_length= existing->server_name_length; |
| 1338 | DBUG_PRINT("info", ("existing name %s altered name %s", |
| 1339 | existing->server_name, altered->server_name)); |
| 1340 | |
| 1341 | /* |
| 1342 | The logic here is this: is this value set AND is it different |
| 1343 | than the existing value? |
| 1344 | */ |
| 1345 | #define SET_ALTERED(X) \ |
| 1346 | do { \ |
| 1347 | altered->X= \ |
| 1348 | (server_options->X.str && strcmp(server_options->X.str, existing->X)) \ |
| 1349 | ? strmake_root(&mem, server_options->X.str, server_options->X.length) \ |
| 1350 | : 0; \ |
| 1351 | } while(0) |
| 1352 | |
| 1353 | SET_ALTERED(host); |
| 1354 | SET_ALTERED(db); |
| 1355 | SET_ALTERED(username); |
| 1356 | SET_ALTERED(password); |
| 1357 | SET_ALTERED(socket); |
| 1358 | SET_ALTERED(scheme); |
| 1359 | SET_ALTERED(owner); |
| 1360 | merge_engine_options(existing->option_list, server_options->option_list, |
| 1361 | &altered->option_list, &mem); |
| 1362 | |
| 1363 | /* |
| 1364 | port is initialised to -1, so if unset, it will be -1 |
| 1365 | */ |
| 1366 | altered->port= (server_options->port > -1 && |
| 1367 | server_options->port != existing->port) ? |
| 1368 | server_options->port : -1; |
| 1369 | |
| 1370 | DBUG_VOID_RETURN; |
| 1371 | } |
| 1372 | |
| 1373 | /* |
| 1374 |
no test coverage detected