MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / internalDropDatabase

Method internalDropDatabase

src/jrd/jrd.cpp:3411–3570  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3409
3410
3411void JAttachment::internalDropDatabase(CheckStatusWrapper* user_status)
3412{
3413/**************************************
3414 *
3415 * i s c _ d r o p _ d a t a b a s e
3416 *
3417 **************************************
3418 *
3419 * Functional description
3420 * Close down and purge a database.
3421 *
3422 **************************************/
3423 try
3424 {
3425 EngineContextHolder tdbb(user_status, this, FB_FUNCTION, AttachmentHolder::ATT_LOCK_ASYNC);
3426 Attachment* attachment = getHandle();
3427 Database* const dbb = tdbb->getDatabase();
3428
3429 try
3430 {
3431 EnsureUnlock<StableAttachmentPart::Sync, NotRefCounted> guard(*(getStable()->getSync()), FB_FUNCTION);
3432 if (!guard.tryEnter())
3433 {
3434 status_exception::raise(Arg::Gds(isc_attachment_in_use));
3435 }
3436
3437 // Prepare to set ODS to 0
3438 WIN window(HEADER_PAGE_NUMBER);
3439 Ods::header_page* header = NULL;
3440 XThreadEnsureUnlock threadGuard(dbb->dbb_thread_mutex, FB_FUNCTION);
3441
3442 try
3443 {
3444 Sync sync(&dbb->dbb_sync, "JAttachment::dropDatabase()");
3445
3446 if (attachment->att_in_use || attachment->att_use_count)
3447 status_exception::raise(Arg::Gds(isc_attachment_in_use));
3448
3449 const PathName& file_name = attachment->att_filename;
3450
3451 SCL_check_database(tdbb, SCL_drop);
3452
3453 if (attachment->att_flags & ATT_shutdown)
3454 {
3455 const ISC_STATUS err = getStable()->getShutError();
3456
3457 if (dbb->dbb_ast_flags & DBB_shutdown)
3458 ERR_post(Arg::Gds(isc_shutdown) << Arg::Str(file_name));
3459
3460 if (err)
3461 ERR_post(Arg::Gds(isc_att_shutdown) << Arg::Gds(err));
3462
3463 ERR_post(Arg::Gds(isc_att_shutdown));
3464 }
3465
3466 // try to block special threads before taking exclusive lock on database
3467 if (!threadGuard.tryEnter())
3468 {

Callers

nothing calls this directly

Calls 15

raiseFunction · 0.85
GdsClass · 0.85
StrClass · 0.85
CCH_exclusiveFunction · 0.85
CCH_FETCHFunction · 0.85
purge_transactionsFunction · 0.85
CCH_MARK_MUST_WRITEFunction · 0.85
CCH_RELEASEFunction · 0.85
CCH_release_exclusiveFunction · 0.85
release_attachmentFunction · 0.85
JRD_shutdown_databaseFunction · 0.85
drop_filesFunction · 0.85

Tested by

no test coverage detected