MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / API_ROUTINE isc_attach_database

Function API_ROUTINE isc_attach_database

src/yvalve/why.cpp:1633–1667  ·  view source on GitHub ↗

Attach a database through the first subsystem that recognizes it.

Source from the content-addressed store, hash-verified

1631
1632// Attach a database through the first subsystem that recognizes it.
1633ISC_STATUS API_ROUTINE isc_attach_database(ISC_STATUS* userStatus, SSHORT fileLength,
1634 const TEXT* filename, isc_db_handle* publicHandle, SSHORT dpbLength, const SCHAR* dpb)
1635{
1636 StatusVector status(userStatus);
1637 CheckStatusWrapper statusWrapper(&status);
1638
1639 try
1640 {
1641 nullCheck(publicHandle, isc_bad_db_handle);
1642
1643 if (!filename)
1644 status_exception::raise(Arg::Gds(isc_bad_db_format) << Arg::Str(""));
1645
1646 PathName pathName(filename, fileLength ? fileLength : fb_strlen(filename));
1647
1648 RefPtr<Dispatcher> dispatcher(FB_NEW Dispatcher);
1649
1650 dispatcher->setDbCryptCallback(&statusWrapper, TLS_GET(legacyCryptCallback));
1651 if (status.getState() & IStatus::STATE_ERRORS)
1652 return status[1];
1653
1654 YAttachment* attachment = dispatcher->attachDatabase(&statusWrapper, pathName.c_str(),
1655 static_cast<USHORT>(dpbLength), reinterpret_cast<const UCHAR*>(dpb));
1656 if (status.getState() & IStatus::STATE_ERRORS)
1657 return status[1];
1658
1659 *publicHandle = attachment->getHandle();
1660 }
1661 catch (const Exception& e)
1662 {
1663 e.stuffException(&statusWrapper);
1664 }
1665
1666 return status[1];
1667}
1668
1669
1670// Provide information on blob object.

Callers

nothing calls this directly

Calls 11

nullCheckFunction · 0.85
raiseFunction · 0.85
GdsClass · 0.85
StrClass · 0.85
fb_strlenFunction · 0.85
setDbCryptCallbackMethod · 0.45
getStateMethod · 0.45
attachDatabaseMethod · 0.45
c_strMethod · 0.45
getHandleMethod · 0.45
stuffExceptionMethod · 0.45

Tested by

no test coverage detected