Fix build and style

This commit is contained in:
alesapin 2019-10-17 12:05:48 +03:00
parent 842a31be8b
commit 3987a45ea2
3 changed files with 10 additions and 7 deletions

View File

@ -111,7 +111,8 @@ void buildLayoutConfiguration(
void buildRangeConfiguration(AutoPtr<Document> doc, AutoPtr<Element> root, const ASTDictionaryRange * range) void buildRangeConfiguration(AutoPtr<Document> doc, AutoPtr<Element> root, const ASTDictionaryRange * range)
{ {
// appends <key><name>value</name></key> to root // appends <key><name>value</name></key> to root
auto appendElem = [&doc, &root](const std::string & key, const std::string & value) { auto appendElem = [&doc, &root](const std::string & key, const std::string & value)
{
AutoPtr<Element> element(doc->createElement(key)); AutoPtr<Element> element(doc->createElement(key));
AutoPtr<Element> name(doc->createElement("name")); AutoPtr<Element> name(doc->createElement("name"));
AutoPtr<Text> text(doc->createTextNode(value)); AutoPtr<Text> text(doc->createTextNode(value));
@ -268,6 +269,9 @@ void buildPrimaryKeyConfiguration(
break; break;
} }
} }
if (!found)
throw Exception(
"Primary key field '" + key_name + "' not found among attributes.", ErrorCodes::INCORRECT_DICTIONARY_DEFINITION);
} }
} }
} }

View File

@ -1,6 +1,5 @@
#include <map> #include <map>
#include <set> #include <set>
#include <Common/StackTrace.h>
#include <optional> #include <optional>
#include <memory> #include <memory>
#include <Poco/Mutex.h> #include <Poco/Mutex.h>

View File

@ -110,21 +110,21 @@ private:
for (const auto & [name, repo_with_settings] : repositories) for (const auto & [name, repo_with_settings] : repositories)
{ {
const auto names = repo_with_settings.first->getAllLoadablesDefinitionNames(); const auto names = repo_with_settings.first->getAllLoadablesDefinitionNames();
for (const auto & name : names) for (const auto & loadable_name : names)
{ {
auto it = loadables_infos.find(name); auto it = loadables_infos.find(loadable_name);
if (it != loadables_infos.end()) if (it != loadables_infos.end())
{ {
LoadablesInfos & loadable_info = it->second; LoadablesInfos & loadable_info = it->second;
if (readLoadablesInfo(*repo_with_settings.first, name, repo_with_settings.second, loadable_info)) if (readLoadablesInfo(*repo_with_settings.first, loadable_name, repo_with_settings.second, loadable_info))
changed = true; changed = true;
} }
else else
{ {
LoadablesInfos loadable_info; LoadablesInfos loadable_info;
if (readLoadablesInfo(*repo_with_settings.first, name, repo_with_settings.second, loadable_info)) if (readLoadablesInfo(*repo_with_settings.first, loadable_name, repo_with_settings.second, loadable_info))
{ {
loadables_infos.emplace(name, std::move(loadable_info)); loadables_infos.emplace(loadable_name, std::move(loadable_info));
changed = true; changed = true;
} }
} }