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

Method internalAttach

src/jrd/jrd.cpp:1626–2306  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1624}
1625
1626JAttachment* JProvider::internalAttach(CheckStatusWrapper* user_status, const char* const filename,
1627 unsigned int dpb_length, const unsigned char* dpb, const UserId* existingId)
1628{
1629/**************************************
1630 *
1631 * g d s _ $ a t t a c h _ d a t a b a s e
1632 *
1633 **************************************
1634 *
1635 * Functional description
1636 * Attach a moldy, grungy, old database
1637 * sullied by user data.
1638 *
1639 **************************************/
1640 try
1641 {
1642 ThreadContextHolder tdbb(user_status);
1643
1644 DatabaseOptions options;
1645 RefPtr<const Config> config;
1646 bool invalid_client_SQL_dialect = false;
1647 PathName org_filename, expanded_name;
1648 bool is_alias = false;
1649 MutexEnsureUnlock guardDbInit(dbInitMutex, FB_FUNCTION);
1650 LateRefGuard lateBlocking(FB_FUNCTION);
1651 Mapping mapping(Mapping::MAP_THROW_NOT_FOUND, cryptCallback);
1652
1653 try
1654 {
1655 // Process database parameter block
1656 options.get(dpb, dpb_length, invalid_client_SQL_dialect);
1657
1658 // And provide info about auth block to mapping
1659 mapping.setAuthBlock(options.dpb_auth_block);
1660
1661 if (options.dpb_org_filename.hasData())
1662 org_filename = options.dpb_org_filename;
1663 else
1664 {
1665 org_filename = filename;
1666
1667 if (!options.dpb_utf8_filename)
1668 ISC_systemToUtf8(org_filename);
1669
1670 ISC_unescape(org_filename);
1671 }
1672
1673 ISC_utf8ToSystem(org_filename);
1674
1675 // Resolve given alias name
1676 is_alias = expandDatabaseName(org_filename, expanded_name, &config);
1677 if (!is_alias)
1678 {
1679 expanded_name = filename;
1680
1681 if (!options.dpb_utf8_filename)
1682 ISC_systemToUtf8(expanded_name);
1683

Callers

nothing calls this directly

Calls 15

ISC_systemToUtf8Function · 0.85
ISC_unescapeFunction · 0.85
ISC_utf8ToSystemFunction · 0.85
expandDatabaseNameFunction · 0.85
ISC_check_if_remoteFunction · 0.85
GdsClass · 0.85
trace_failed_attachFunction · 0.85
verifyDatabaseNameFunction · 0.85
raiseFunction · 0.85
StrClass · 0.85
initAttachmentFunction · 0.85
getDefCryptCallbackFunction · 0.85

Tested by

no test coverage detected