| 362 | // |
| 363 | |
| 364 | bool TDR_reconnect_multiple(FB_API_HANDLE handle, TraNumber id, const TEXT* name, SINT64 switches) |
| 365 | { |
| 366 | ISC_STATUS_ARRAY status_vector; |
| 367 | |
| 368 | // get the state of all the associated transactions |
| 369 | |
| 370 | tdr* trans = MET_get_transaction(status_vector, handle, id); |
| 371 | if (!trans) |
| 372 | return reconnect(handle, id, name, switches); |
| 373 | |
| 374 | reattach_databases(trans); |
| 375 | TDR_get_states(trans); |
| 376 | |
| 377 | // analyze what to do with them; if the advice contradicts the user's |
| 378 | // desire, make them confirm it; otherwise go with the flow. |
| 379 | |
| 380 | const USHORT advice = TDR_analyze(trans); |
| 381 | |
| 382 | if (!advice) |
| 383 | { |
| 384 | print_description(trans); |
| 385 | switches = ask(); |
| 386 | } |
| 387 | else |
| 388 | { |
| 389 | switch (advice) |
| 390 | { |
| 391 | case TRA_rollback: |
| 392 | if (switches & sw_commit) |
| 393 | { |
| 394 | ALICE_print(74, SafeArg() << trans->tdr_id); |
| 395 | // msg 74: A commit of transaction %ld will violate two-phase commit. |
| 396 | print_description(trans); |
| 397 | switches = ask(); |
| 398 | } |
| 399 | else if (switches & sw_rollback) |
| 400 | switches |= sw_rollback; |
| 401 | else if (switches & sw_two_phase) |
| 402 | switches |= sw_rollback; |
| 403 | else if (switches & sw_prompt) |
| 404 | { |
| 405 | ALICE_print(75, SafeArg() << trans->tdr_id); |
| 406 | // msg 75: A rollback of transaction %ld is needed to preserve two-phase commit. |
| 407 | print_description(trans); |
| 408 | switches = ask(); |
| 409 | } |
| 410 | break; |
| 411 | |
| 412 | case TRA_commit: |
| 413 | if (switches & sw_rollback) |
| 414 | { |
| 415 | ALICE_print(76, SafeArg() << trans->tdr_id); |
| 416 | // msg 76: Transaction %ld has already been partially committed. |
| 417 | ALICE_print(77); |
| 418 | // msg 77: A rollback of this transaction will violate two-phase commit. |
| 419 | print_description(trans); |
| 420 | switches = ask(); |
| 421 | } |
no test coverage detected