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

Method processConfig

programs/client/Client.cpp:1053–1110  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1051
1052
1053void Client::processConfig()
1054{
1055 if (!queries.empty() && !queries_files.empty())
1056 throw Exception(ErrorCodes::BAD_ARGUMENTS, "Options '--query' and '--queries-file' cannot be specified at the same time");
1057
1058 /// Batch mode is enabled if one of the following is true:
1059 /// - -q (--query) command line option is present.
1060 /// The value of the option is used as the text of query (or of multiple queries).
1061 /// If stdin is not a terminal, INSERT data for the first query is read from it.
1062 /// - stdin is not a terminal. In this case queries are read from it.
1063 /// - --queries-file command line option is present.
1064 /// The value of the option is used as file with query (or of multiple queries) to execute.
1065
1066 delayed_interactive = config().has("interactive") && (!queries.empty() || !queries_files.empty());
1067 if (stdin_is_a_tty && (delayed_interactive || (queries.empty() && queries_files.empty())))
1068 {
1069 is_interactive = true;
1070 }
1071 else
1072 {
1073 ignore_error = config().getBool("ignore-error", false);
1074
1075 query_id = config().getString("query_id", "");
1076 if (!query_id.empty())
1077 client_context->setCurrentQueryId(query_id);
1078 }
1079
1080 setupEchoAndHighlightSettings();
1081
1082 if (is_interactive || delayed_interactive)
1083 {
1084 if (home_path.empty())
1085 {
1086 const char * home_path_cstr = getenv("HOME"); // NOLINT(concurrency-mt-unsafe)
1087 if (home_path_cstr)
1088 home_path = home_path_cstr;
1089 }
1090
1091 /// Load command history if present.
1092 if (config().has("history_file"))
1093 history_file = config().getString("history_file");
1094 else
1095 history_file = ClientBase::getHistoryFilePath();
1096 }
1097
1098 pager = config().getString("pager", "");
1099 enable_highlight = config().getBool("highlight", true);
1100 multiline = config().has("multiline");
1101 rainbow_parentheses = config().getBool("rainbow_parentheses", true);
1102 print_stack_trace = config().getBool("stacktrace", false);
1103 default_database = config().getString("database", "");
1104 inline_insert_data = config().getBool("inline-insert-data", false);
1105
1106 if (inline_insert_data)
1107 client_context->setSetting("send_table_structure_on_insert_with_inline_data", false);
1108
1109 setDefaultFormatsAndCompressionFromConfiguration();
1110}

Callers 3

Install.cppFile · 0.45
startFunction · 0.45
get_configurationFunction · 0.45

Calls 7

setCurrentQueryIdMethod · 0.80
ExceptionClass · 0.50
emptyMethod · 0.45
hasMethod · 0.45
getBoolMethod · 0.45
getStringMethod · 0.45
setSettingMethod · 0.45

Tested by

no test coverage detected