| 6726 | |
| 6727 | |
| 6728 | static void check_database(thread_db* tdbb, bool async) |
| 6729 | { |
| 6730 | /************************************** |
| 6731 | * |
| 6732 | * c h e c k _ d a t a b a s e |
| 6733 | * |
| 6734 | ************************************** |
| 6735 | * |
| 6736 | * Functional description |
| 6737 | * Check an attachment for validity. |
| 6738 | * |
| 6739 | **************************************/ |
| 6740 | SET_TDBB(tdbb); |
| 6741 | |
| 6742 | Database* const dbb = tdbb->getDatabase(); |
| 6743 | Jrd::Attachment* const attachment = tdbb->getAttachment(); |
| 6744 | |
| 6745 | // Test for persistent errors |
| 6746 | |
| 6747 | if (dbb->dbb_flags & DBB_bugcheck) |
| 6748 | { |
| 6749 | static const char string[] = "can't continue after bugcheck"; |
| 6750 | status_exception::raise(Arg::Gds(isc_bug_check) << Arg::Str(string)); |
| 6751 | } |
| 6752 | |
| 6753 | if ((attachment->att_flags & ATT_shutdown) && |
| 6754 | (attachment->att_purge_tid != Thread::getCurrentThreadId()) || |
| 6755 | ((dbb->dbb_ast_flags & DBB_shutdown) && |
| 6756 | ((dbb->dbb_ast_flags & DBB_shutdown_full) || !attachment->locksmith(tdbb, ACCESS_SHUTDOWN_DATABASE)))) |
| 6757 | { |
| 6758 | if (dbb->dbb_ast_flags & DBB_shutdown) |
| 6759 | { |
| 6760 | const PathName& filename = attachment->att_filename; |
| 6761 | status_exception::raise(Arg::Gds(isc_shutdown) << Arg::Str(filename)); |
| 6762 | } |
| 6763 | |
| 6764 | Arg::Gds err(isc_att_shutdown); |
| 6765 | |
| 6766 | if (attachment->getStable() && attachment->getStable()->getShutError()) |
| 6767 | err << Arg::Gds(attachment->getStable()->getShutError()); |
| 6768 | |
| 6769 | err.raise(); |
| 6770 | } |
| 6771 | |
| 6772 | // No further checks for the async calls |
| 6773 | |
| 6774 | if (async) |
| 6775 | return; |
| 6776 | |
| 6777 | // Test for temporary errors |
| 6778 | |
| 6779 | if ((attachment->att_flags & ATT_cancel_raise) && |
| 6780 | !(attachment->att_flags & ATT_cancel_disable)) |
| 6781 | { |
| 6782 | attachment->att_flags &= ~ATT_cancel_raise; |
| 6783 | status_exception::raise(Arg::Gds(isc_cancelled)); |
| 6784 | } |
| 6785 |
no test coverage detected