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

Method get

src/jrd/replication/Config.cpp:275–493  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

273// Therefore it checks only the necessary settings.
274
275Config* Config::get(const PathName& lookupName)
276{
277 fb_assert(lookupName.hasData());
278
279 bool reportErrors = DEFAULT_REPORT_ERRORS;
280 try
281 {
282 const PathName filename =
283 fb_utils::getPrefix(IConfigManager::DIR_CONF, REPLICATION_CFGFILE);
284
285 ConfigFile cfgFile(filename, ConfigFile::HAS_SUB_CONF |
286 ConfigFile::NATIVE_ORDER |
287 ConfigFile::CUSTOM_MACROS);
288
289 AutoPtr<Config> config(FB_NEW Config);
290
291 FbLocalStatus localStatus;
292 bool defaultFound = false, exactMatch = false, replicaSkip = false;
293
294 for (const auto& section : cfgFile.getParameters())
295 {
296 if (section.name != "database")
297 continue;
298
299 PathName dbName(section.value.c_str());
300
301 if (dbName.empty())
302 {
303 if (defaultFound)
304 raiseError("Only one default DATABASE section is allowed");
305
306 defaultFound = true;
307 }
308 else
309 {
310 PathUtils::fixupSeparators(dbName);
311 ISC_expand_filename(dbName, true);
312
313 if (dbName != lookupName)
314 continue;
315
316 config->dbName = dbName;
317
318 exactMatch = true;
319 }
320
321 if (!section.sub)
322 continue;
323
324 for (const auto& el : section.sub->getParameters())
325 {
326 const string key(el.name.c_str());
327 string value(el.value);
328
329 if (value.isEmpty())
330 {
331 configError(&localStatus, "empty value of key",
332 exactMatch ? lookupName.c_str() : section.name.c_str(),

Callers 15

matchTableMethod · 0.45
prepareTransactionMethod · 0.45
commitTransactionMethod · 0.45
rollbackTransactionMethod · 0.45
startSavepointMethod · 0.45
cleanupSavepointMethod · 0.45
insertRecordMethod · 0.45
updateRecordMethod · 0.45
deleteRecordMethod · 0.45
storeBlobMethod · 0.45
executeSqlMethod · 0.45
doInsertMethod · 0.45

Calls 15

getPrefixFunction · 0.85
configErrorFunction · 0.85
parseSyncReplicaFunction · 0.85
ISC_systemToUtf8Function · 0.85
checkAccessFunction · 0.85
parseBooleanFunction · 0.85
logPrimaryStatusFunction · 0.85
composeErrorFunction · 0.85
raiseErrorFunction · 0.70
parseLongFunction · 0.70
ISC_expand_filenameFunction · 0.50
hasDataMethod · 0.45

Tested by

no test coverage detected