| 70 | } |
| 71 | |
| 72 | bool openDb(const char* securityDb, RefPtr<IAttachment>& att, RefPtr<ITransaction>& tra) |
| 73 | { |
| 74 | ClumpletWriter embeddedAttach(ClumpletWriter::dpbList, MAX_DPB_SIZE); |
| 75 | embeddedAttach.insertString(isc_dpb_user_name, DBA_USER_NAME, fb_strlen(DBA_USER_NAME)); |
| 76 | embeddedAttach.insertByte(isc_dpb_sec_attach, TRUE); |
| 77 | embeddedAttach.insertString(isc_dpb_config, ParsedList::getNonLoopbackProviders(securityDb)); |
| 78 | embeddedAttach.insertByte(isc_dpb_no_db_triggers, TRUE); |
| 79 | |
| 80 | FbLocalStatus st; |
| 81 | DispatcherPtr prov; |
| 82 | att.assignRefNoIncr(prov->attachDatabase(&st, securityDb, |
| 83 | embeddedAttach.getBufferLength(), embeddedAttach.getBuffer())); |
| 84 | if (st->getState() & IStatus::STATE_ERRORS) |
| 85 | { |
| 86 | if (!fb_utils::containsErrorCode(st->getErrors(), isc_io_error)) |
| 87 | check("IProvider::attachDatabase", &st); |
| 88 | |
| 89 | // missing security DB - checking granted rights not possible |
| 90 | return false; |
| 91 | } |
| 92 | |
| 93 | ClumpletWriter readOnly(ClumpletWriter::Tpb, MAX_DPB_SIZE, isc_tpb_version1); |
| 94 | readOnly.insertTag(isc_tpb_read); |
| 95 | readOnly.insertTag(isc_tpb_wait); |
| 96 | tra.assignRefNoIncr(att->startTransaction(&st, readOnly.getBufferLength(), readOnly.getBuffer())); |
| 97 | check("IAttachment::startTransaction", &st); |
| 98 | |
| 99 | return true; |
| 100 | } |
| 101 | |
| 102 | } // anonymous namespace |
| 103 |
no test coverage detected