MCPcopy Create free account
hub / github.com/ClickHouse/ClickHouse / initialize

Method initialize

programs/keeper-client/KeeperClient.cpp:400–448  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

398}
399
400void KeeperClient::initialize(Poco::Util::Application & /* self */)
401{
402 suggest.setCompletionsCallback(
403 [&](const String & prefix, size_t /* prefix_length */) { return getCompletions(prefix); });
404
405 String home_path;
406 const char * home_path_cstr = getenv("HOME"); // NOLINT(concurrency-mt-unsafe)
407 if (home_path_cstr)
408 home_path = home_path_cstr;
409
410 if (config().has("history-file"))
411 history_file = config().getString("history-file");
412 else
413 history_file = home_path + "/.keeper-client-history";
414
415 if (!history_file.empty() && !fs::exists(history_file))
416 {
417 try
418 {
419 FS::createFile(history_file);
420 }
421 catch (const ErrnoException & e)
422 {
423 if (e.getErrno() != EEXIST)
424 throw;
425 }
426 }
427
428 history_max_entries = config().getUInt("history-max-entries", 1000000);
429
430 String default_log_level;
431 if (config().has("query"))
432 /// We don't want to see any information log in query mode, unless it was set explicitly
433 default_log_level = "error";
434 else
435 default_log_level = "information";
436
437 Poco::Logger::root().setLevel(config().getString("log-level", default_log_level));
438
439 EventNotifier::init();
440
441 const char * env_password = getenv("CLICKHOUSE_KEEPER_PASSWORD"); // NOLINT(concurrency-mt-unsafe)
442 if (env_password && !config().has("password"))
443 config().setString("password", env_password);
444
445 const char * env_identity = getenv("CLICKHOUSE_KEEPER_IDENTITY"); // NOLINT(concurrency-mt-unsafe)
446 if (env_identity && !config().has("identity"))
447 config().setString("identity", env_identity);
448}
449
450bool KeeperClient::processQueryText(const String & text, bool is_interactive)
451{

Callers

nothing calls this directly

Calls 11

getErrnoMethod · 0.80
existsFunction · 0.50
createFileFunction · 0.50
initFunction · 0.50
hasMethod · 0.45
getStringMethod · 0.45
emptyMethod · 0.45
getUIntMethod · 0.45
setLevelMethod · 0.45
setStringMethod · 0.45

Tested by

no test coverage detected