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

Method loadConfig

src/common/db_alias.cpp:262–344  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

260 }
261
262 void loadConfig()
263 {
264 clear();
265
266 PathName confName = getFileName();
267 const char* rootDir = Config::getRootDirectory();
268 const FB_SIZE_T rootLen = strlen(rootDir);
269
270 if ((confName.length() > rootLen) && (confName.compare(0, rootLen, rootDir, rootLen) == 0))
271 confName.erase(0, rootLen);
272
273 ConfigFile aliasConfig(getFileName(), ConfigFile::HAS_SUB_CONF, this);
274 const ConfigFile::Parameters& params = aliasConfig.getParameters();
275
276 for (FB_SIZE_T n = 0; n < params.getCount(); ++n)
277 {
278 const ConfigFile::Parameter* par = &params[n];
279
280 PathName file(par->value.ToPathName());
281 PathUtils::fixupSeparators(file);
282 if (PathUtils::isRelative(file) && !ISC_check_if_remote(file, false))
283 {
284 gds__log("Value %s configured for alias %s "
285 "is not a fully qualified path name nor remote server reference, ignored",
286 file.c_str(), par->name.c_str());
287 continue;
288 }
289 DbName* db = dbHash.lookup(file);
290 if (! db)
291 {
292 db = FB_NEW_POOL(getPool()) DbName(getPool(), file);
293#ifdef HAVE_ID_BY_NAME
294 UCharBuffer id;
295 os_utils::getUniqueFileId(db->name.c_str(), id);
296 if (id.hasData())
297 {
298 Id* i = idHash.lookup(id);
299 if (i)
300 {
301 delete db;
302 fatal_exception::raiseFmt("Same ID for databases %s and %s\n",
303 file.c_str(), i->db->name.c_str());
304 }
305
306 linkId(db, id);
307 }
308#endif
309 databases.add(db);
310 dbHash.add(db);
311 }
312 else
313 {
314 // check for duplicated config
315 if (par->sub && db->config.hasData())
316 {
317 fatal_exception::raiseFmt("Duplicated configuration for database %s\n",
318 file.c_str());
319 }

Callers

nothing calls this directly

Calls 15

ISC_check_if_remoteFunction · 0.85
DbNameClass · 0.85
AliasNameClass · 0.85
ToPathNameMethod · 0.80
clearClass · 0.50
getUniqueFileIdFunction · 0.50
ConfigClass · 0.50
lengthMethod · 0.45
compareMethod · 0.45
eraseMethod · 0.45
getCountMethod · 0.45
c_strMethod · 0.45

Tested by

no test coverage detected