MCPcopy Create free account
hub / github.com/ByConity/ByConity / init

Method init

programs/local/LocalServer.cpp:598–701  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

596}
597
598void LocalServer::init(int argc, char ** argv)
599{
600 namespace po = boost::program_options;
601
602 /// Don't parse options with Poco library, we prefer neat boost::program_options
603 stopOptionsProcessing();
604
605 po::options_description description = createOptionsDescription("Main options", getTerminalWidth());
606 description.add_options()
607 ("help", "produce help message")
608 ("config-file,c", po::value<std::string>(), "config-file path")
609 ("query,q", po::value<std::string>(), "query")
610 ("queries-file, qf", po::value<std::string>(), "file path with queries to execute")
611 ("database,d", po::value<std::string>(), "database")
612
613 ("table,N", po::value<std::string>(), "name of the initial table")
614 /// If structure argument is omitted then initial query is not generated
615 ("structure,S", po::value<std::string>(), "structure of the initial table (list of column and type names)")
616 ("file,f", po::value<std::string>(), "path to file with data of the initial table (stdin if not specified)")
617 ("input-format", po::value<std::string>(), "input format of the initial table data")
618 ("format,f", po::value<std::string>(), "default output format (clickhouse-client compatibility)")
619 ("output-format", po::value<std::string>(), "default output format")
620
621 ("stacktrace", "print stack traces of exceptions")
622 ("echo", "print query before execution")
623 ("verbose", "print query and other debugging info")
624 ("logger.console", po::value<bool>()->implicit_value(true), "Log to console")
625 ("logger.log", po::value<std::string>(), "Log file name")
626 ("logger.level", po::value<std::string>(), "Log level")
627 ("ignore-error", "do not stop processing if a query failed")
628 ("no-system-tables", "do not attach system tables (better startup time)")
629 ("version,V", "print version information and exit")
630 ("progress", "print progress of queries execution")
631 ;
632
633 cmd_settings.addProgramOptions(description);
634
635 /// Parse main commandline options.
636 po::parsed_options parsed = po::command_line_parser(argc, argv).options(description).run();
637 po::variables_map options;
638 po::store(parsed, options);
639 po::notify(options);
640
641 if (options.count("version") || options.count("V"))
642 {
643 showClientVersion();
644 exit(0);
645 }
646
647 if (options.empty() || options.count("help"))
648 {
649 std::cout << getHelpHeader() << "\n";
650 std::cout << description << "\n";
651 std::cout << getHelpFooter() << "\n";
652 exit(0);
653 }
654
655 /// Save received data into the internal config.

Callers 10

mainMethod · 0.45
mainEntryClickHouseLocalFunction · 0.45
ODBCBlockOutputStreamMethod · 0.45
ODBCBlockInputStreamMethod · 0.45
writeDataFunction · 0.45
handleRequestMethod · 0.45

Calls 14

createOptionsDescriptionFunction · 0.85
getTerminalWidthFunction · 0.85
storeFunction · 0.85
showClientVersionFunction · 0.85
getHelpHeaderFunction · 0.85
getHelpFooterFunction · 0.85
argsToConfigFunction · 0.85
addProgramOptionsMethod · 0.80
setStringMethod · 0.80
configFunction · 0.50
runMethod · 0.45
countMethod · 0.45

Tested by 1