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

Method doAttach

src/jrd/WorkerAttachment.cpp:468–498  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

466}
467
468StableAttachmentPart* WorkerAttachment::doAttach(FbStatusVector* status, Database* dbb)
469{
470 StableAttachmentPart* sAtt = NULL;
471
472 AutoPlugin<JProvider> jInstance(JProvider::getInstance());
473 //jInstance->setDbCryptCallback(&status, tdbb->getAttachment()->att_crypt_callback);
474
475 if (Config::getServerMode() == MODE_SUPER)
476 sAtt = WorkerStableAttachment::create(status, dbb, jInstance, this);
477 else
478 {
479 ClumpletWriter dpb(ClumpletReader::Tagged, MAX_DPB_SIZE, isc_dpb_version1);
480 dpb.insertString(isc_dpb_trusted_auth, DBA_USER_NAME);
481 dpb.insertInt(isc_dpb_worker_attach, 1);
482
483 JAttachment* jAtt = jInstance->attachDatabase(status, dbb->dbb_filename.c_str(),
484 dpb.getBufferLength(), dpb.getBuffer());
485
486 if (!(status->getState() & IStatus::STATE_ERRORS))
487 sAtt = jAtt->getStable();
488 }
489
490 if (sAtt)
491 {
492 sAtt->addRef(); // !!
493 sAtt->getHandle()->setIdleTimeout(WORKER_IDLE_TIMEOUT);
494 jInstance->addRef();
495 }
496
497 return sAtt;
498}
499
500void WorkerAttachment::doDetach(FbStatusVector* status, StableAttachmentPart* sAtt)
501{

Callers 1

getAttachmentMethod · 0.80

Calls 12

createFunction · 0.85
insertStringMethod · 0.45
insertIntMethod · 0.45
attachDatabaseMethod · 0.45
c_strMethod · 0.45
getBufferLengthMethod · 0.45
getBufferMethod · 0.45
getStateMethod · 0.45
getStableMethod · 0.45
addRefMethod · 0.45
setIdleTimeoutMethod · 0.45
getHandleMethod · 0.45

Tested by

no test coverage detected