| 466 | } |
| 467 | |
| 468 | StableAttachmentPart* 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 | |
| 500 | void WorkerAttachment::doDetach(FbStatusVector* status, StableAttachmentPart* sAtt) |
| 501 | { |
no test coverage detected