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

Function expandDatabaseName

src/common/db_alias.cpp:488–560  ·  view source on GitHub ↗

Full processing of database name Returns true if alias was found in databases.conf

Source from the content-addressed store, hash-verified

486// Full processing of database name
487// Returns true if alias was found in databases.conf
488bool expandDatabaseName(Firebird::PathName alias,
489 Firebird::PathName& file,
490 Firebird::RefPtr<const Config>* config)
491{
492 try
493 {
494 aliasesConf().checkLoadConfig();
495 }
496 catch (const fatal_exception& ex)
497 {
498 gds__log("File databases.conf contains bad data: %s", ex.what());
499 Arg::Gds(isc_server_misconfigured).raise();
500 }
501
502 // remove whitespaces from database name
503 alias.trim();
504
505 ReadLockGuard guard(aliasesConf().rwLock, "expandDatabaseName");
506
507 // First of all check in databases.conf
508 if (resolveAlias(alias, file, config))
509 {
510 return true;
511 }
512
513 // Now try ISC_PATH environment variable
514 if (!setPath(alias, file))
515 {
516 // At this step check DatabaseAccess paths in firebird.conf
517 if (!resolveDatabaseAccess(alias, file))
518 {
519 // Last chance - regular filename expansion
520 file = alias;
521
522 ISC_systemToUtf8(file);
523 ISC_unescape(file);
524 ISC_utf8ToSystem(file);
525
526 ISC_expand_filename(file, true);
527
528 ISC_systemToUtf8(file);
529 ISC_escape(file);
530 ISC_utf8ToSystem(file);
531 }
532 }
533
534 // Search for correct config in databases.conf
535 if (config)
536 {
537 DbName* db = aliasesConf().dbHash.lookup(file);
538#ifdef HAVE_ID_BY_NAME
539 if (!db)
540 {
541 UCharBuffer id;
542 os_utils::getUniqueFileId(file.c_str(), id);
543 if (id.hasData())
544 {
545 Id* i = aliasesConf().idHash.lookup(id);

Callers 15

REMOTE_get_configFunction · 0.85
gbakFunction · 0.85
MVOL_get_cryptFunction · 0.85
start_cryptFunction · 0.85
NBackupMethod · 0.85
readConfigMethod · 0.85
CLIB_ROUTINE mainFunction · 0.85
internalAttachMethod · 0.85
createDatabaseMethod · 0.85
putDatabaseMethod · 0.85
validateFunction · 0.85
ServiceMethod · 0.85

Calls 15

GdsClass · 0.85
resolveAliasFunction · 0.85
setPathFunction · 0.85
resolveDatabaseAccessFunction · 0.85
ISC_systemToUtf8Function · 0.85
ISC_unescapeFunction · 0.85
ISC_utf8ToSystemFunction · 0.85
ISC_escapeFunction · 0.85
checkLoadConfigMethod · 0.80
ISC_expand_filenameFunction · 0.70
getUniqueFileIdFunction · 0.50
whatMethod · 0.45

Tested by

no test coverage detected