Attach a database through the first subsystem that recognizes it.
| 1631 | |
| 1632 | // Attach a database through the first subsystem that recognizes it. |
| 1633 | ISC_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. |
nothing calls this directly
no test coverage detected