#pragma once #include #include namespace BuzzHouse { class FuzzConfig; class ExternalIntegrations; }; namespace DB { class Client : public ClientApplicationBase { public: using Arguments = ClientApplicationBase::Arguments; Client(); ~Client() override; void initialize(Poco::Util::Application & self) override; int main(const std::vector & /*args*/) override; bool tryToReconnect(uint32_t max_reconnection_attempts, uint32_t time_to_sleep_between) override; protected: Poco::Util::LayeredConfiguration & getClientConfiguration() override; bool processWithASTFuzzer(std::string_view full_query) override; bool buzzHouse() override; bool processASTFuzzerStep(const String & query_to_execute, const ASTPtr & parsed_query); #if USE_JWT_CPP && USE_SSL void login(); #endif void connect() override; void processError(std::string_view query) const override; String getName() const override { return "client"; } void printHelpMessage(const OptionsDescription & options_description) override; void addExtraOptions(OptionsDescription & options_description) override; void processOptions( const OptionsDescription & options_description, const CommandLineOptions & options, const std::vector & external_tables_arguments, const std::vector & hosts_and_ports_arguments) override; void processConfig() override; void readArguments( int argc, char ** argv, Arguments & common_arguments, std::vector & external_tables_arguments, std::vector & hosts_and_ports_arguments) override; private: String getHelpHeader() const; String getHelpFooter() const; void printChangedSettings() const; void showWarnings(); #if USE_BUZZHOUSE std::unique_ptr fuzz_config; std::unique_ptr external_integrations; /// Invoked whenever `tryToReconnect` establishes a new session, so the fuzzer can drop /// bookkeeping of session-scoped server state (e.g. hypothetical indexes). std::function after_fuzz_reconnect; bool logAndProcessQuery(std::ofstream & outf, const String & full_query); bool processBuzzHouseQuery(const String & full_query); bool fuzzLoopReconnect(); #endif std::vector loadWarningMessages(); QueryScope query_scope; #if USE_JWT_CPP && USE_SSL std::shared_ptr jwt_provider; bool login_was_auto_added = false; #endif }; }