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

Function openDb

src/jrd/DbCreators.cpp:72–100  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

70}
71
72bool 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

Callers 2

checkCreateDatabaseGrantFunction · 0.85
getListMethod · 0.85

Calls 13

fb_strlenFunction · 0.85
containsErrorCodeFunction · 0.85
insertByteMethod · 0.80
assignRefNoIncrMethod · 0.80
checkFunction · 0.70
insertStringMethod · 0.45
attachDatabaseMethod · 0.45
getBufferLengthMethod · 0.45
getBufferMethod · 0.45
getStateMethod · 0.45
getErrorsMethod · 0.45
insertTagMethod · 0.45

Tested by

no test coverage detected