2017-04-01 09:19:00 +00:00
|
|
|
#include <Common/getMultipleKeysFromConfig.h>
|
2017-03-21 19:08:09 +00:00
|
|
|
|
|
|
|
#include <Poco/Util/AbstractConfiguration.h>
|
2018-01-15 19:07:47 +00:00
|
|
|
#include <Common/StringUtils/StringUtils.h>
|
2017-03-21 19:08:09 +00:00
|
|
|
|
|
|
|
namespace DB
|
|
|
|
{
|
2017-08-07 13:36:03 +00:00
|
|
|
std::vector<std::string> getMultipleKeysFromConfig(const Poco::Util::AbstractConfiguration & config, const std::string & root, const std::string & name)
|
2017-03-21 19:08:09 +00:00
|
|
|
{
|
2017-04-01 07:20:54 +00:00
|
|
|
std::vector<std::string> values;
|
|
|
|
Poco::Util::AbstractConfiguration::Keys config_keys;
|
|
|
|
config.keys(root, config_keys);
|
|
|
|
for (const auto & key : config_keys)
|
|
|
|
{
|
|
|
|
if (key != name && !(startsWith(key.data(), name + "[") && endsWith(key.data(), "]")))
|
|
|
|
continue;
|
|
|
|
values.emplace_back(key);
|
|
|
|
}
|
|
|
|
return values;
|
2017-03-21 19:08:09 +00:00
|
|
|
}
|
2017-06-22 18:56:40 +00:00
|
|
|
|
|
|
|
|
2017-08-07 13:36:03 +00:00
|
|
|
std::vector<std::string> getMultipleValuesFromConfig(const Poco::Util::AbstractConfiguration & config, const std::string & root, const std::string & name)
|
2017-06-22 18:56:40 +00:00
|
|
|
{
|
|
|
|
std::vector<std::string> values;
|
|
|
|
for (const auto & key : DB::getMultipleKeysFromConfig(config, root, name))
|
|
|
|
values.emplace_back(config.getString(key));
|
|
|
|
return values;
|
|
|
|
}
|
|
|
|
|
2017-03-21 19:08:09 +00:00
|
|
|
}
|