-
Notifications
You must be signed in to change notification settings - Fork 1
Add list of hosts reading #4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -512,6 +512,7 @@ catch (...) | |
|
||
void Client::connect() | ||
{ | ||
config().setString("host", hosts[0]); | ||
connection_parameters = ConnectionParameters(config()); | ||
|
||
if (is_interactive) | ||
|
@@ -998,7 +999,7 @@ void Client::addAndCheckOptions(OptionsDescription & options_description, po::va | |
/// Main commandline options related to client functionality and all parameters from Settings. | ||
options_description.main_description->add_options() | ||
("config,c", po::value<std::string>(), "config-file path (another shorthand)") | ||
("host,h", po::value<std::string>()->default_value("localhost"), "server host") | ||
("host,h", po::value<std::vector<std::string>>()->multitoken()->default_value({"localhost"}, "localhost"), "list of server hosts") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please add more detailed description. For example, like in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok, I will make it when add parsing hosts with port (to call There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You can add it now and when you will change for port, you can also modify description |
||
("port", po::value<int>()->default_value(9000), "server port") | ||
("secure,s", "Use TLS connection") | ||
("user,u", po::value<std::string>()->default_value("default"), "user") | ||
|
@@ -1120,7 +1121,7 @@ void Client::processOptions(const OptionsDescription & options_description, | |
if (options.count("config")) | ||
config().setString("config-file", options["config"].as<std::string>()); | ||
if (options.count("host") && !options["host"].defaulted()) | ||
config().setString("host", options["host"].as<std::string>()); | ||
hosts = options["host"].as<std::vector<std::string>>(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Seems like you need to set config here, but not in the beginning of There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Setting There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
if (options.count("interleave-queries-file")) | ||
interleave_queries_files = options["interleave-queries-file"].as<std::vector<std::string>>(); | ||
if (options.count("pager")) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,6 +29,7 @@ class Client : public ClientBase | |
const std::vector<Arguments> & external_tables_arguments) override; | ||
void processConfig() override; | ||
|
||
std::vector<String> hosts{}; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Where is a single host keeped? You need to find it and keep vector of hosts instead of one host There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A single host is kept originally in configuration object with type I watched, how vectors are saved in other situations (when other vector parametrs are set). I found param And the values are saving in special field of class That is why I've made an similar field for hosts in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Well so you can add it to |
||
private: | ||
void printChangedSettings() const; | ||
std::vector<String> loadWarningMessages(); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line shouldn't be here as soon as you remove field
hosts
fromClient
classThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is a crutch, which I will move to initialization (more you can see in conversation below #4 (comment))
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, so as soon as you don't want to add hosts to config, you just don't need to set it in the beginning. You should either set it in config or don't set at all. I see you want to save hosts anywhere, but please write clean code