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

Method main

programs/client/Client.cpp:352–478  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

350
351
352int Client::main(const std::vector<std::string> & /*args*/)
353try
354{
355 setupSignalHandler();
356
357 output_stream << std::fixed << std::setprecision(3);
358 error_stream << std::fixed << std::setprecision(3);
359
360 registerFormats();
361 registerFunctions();
362 registerAggregateFunctions();
363
364 processConfig();
365 adjustSettings(client_context);
366
367 initTTYBuffer(
368 toProgressOption(config().getString("progress", "default")), toProgressOption(config().getString("progress-table", "default")));
369 initKeystrokeInterceptor();
370
371 /// Includes delayed_interactive.
372 if (is_interactive)
373 {
374 clearTerminal();
375 showClientVersion();
376 }
377
378#if USE_JWT_CPP && USE_SSL
379 if (config().getBool("login", false))
380 {
381 login();
382 }
383#endif
384
385 bool asked_password = false;
386 bool asked_2fa = false;
387 for (;;)
388 {
389 try
390 {
391 connect();
392 break;
393 }
394 catch (const Exception & e)
395 {
396 auto code = e.code();
397
398 bool should_ask_password = !asked_password && is_interactive &&
399 (code == ErrorCodes::AUTHENTICATION_FAILED || code == ErrorCodes::REQUIRED_PASSWORD) &&
400 !config().has("password") && !config().getBool("ask-password", false) &&
401 !config().has("ssh-key-file");
402
403 if (should_ask_password)
404 {
405 asked_password = true;
406 config().setBool("ask-password", true);
407 continue;
408 }
409

Callers

nothing calls this directly

Calls 15

registerFormatsFunction · 0.85
registerFunctionsFunction · 0.85
toProgressOptionFunction · 0.85
connectFunction · 0.85
getCurrentExceptionCodeFunction · 0.85
getStringMethod · 0.45
getBoolMethod · 0.45
codeMethod · 0.45
hasMethod · 0.45

Tested by

no test coverage detected