indexes WIP

This commit is contained in:
2021-11-17 15:35:57 +01:00
parent cc639ee891
commit 411f0fd48c
25 changed files with 609 additions and 807 deletions

View File

@@ -9,7 +9,8 @@ std::vector<std::pair<std::string, std::string>> Settings::m_settings =
{ std::make_pair("DATE_FORMAT", "%Y-%m-%d %H:%M:%S"),
std::make_pair("BOOL_TRUE_LITERAL", "Y"),
std::make_pair("BOOL_FALSE_LITERAL", "N"),
std::make_pair("DOUBLE_FORMAT", "%.2f") };
std::make_pair("DOUBLE_FORMAT", "%.2f"),
std::make_pair("USE_INDEXSCAN", "N") };
@@ -47,23 +48,20 @@ std::string Settings::date_to_string(long date) {
}
bool Settings::string_to_bool(const std::string &boolstr) {
if (boolstr=="true" || boolstr == get_setting("BOOL_TRUE_LITERAL"))
bool Settings::string_to_bool(const std::string &value) {
if (value == "true" || value == get_setting("BOOL_TRUE_LITERAL"))
return true;
if (boolstr=="false" || boolstr == get_setting("BOOL_FALSE_LITERAL"))
if (value == "false" || value == get_setting("BOOL_FALSE_LITERAL"))
return false;
throw Exception("string_to_bool, unrecognized value: " + boolstr);
throw Exception("string_to_bool, unrecognized value: " + value);
}
std::string Settings::bool_to_string(bool boolval) {
return boolval ? "true" : "false";
std::string Settings::bool_to_string(bool value) {
return value ? "true" : "false";
}
std::string Settings::get_setting(const std::string &name) {
for(const auto& pair : m_settings) {
if (pair.first == name) return pair.second;
@@ -71,6 +69,10 @@ std::string Settings::get_setting(const std::string &name) {
throw Exception("unsupported setting name: " + name);
}
bool Settings::get_bool_setting(const std::string &name) {
return string_to_bool(get_setting(name));
}
void Settings::set_setting(const std::string &name, const std::string &value) {
for (auto it = begin(m_settings); it != end(m_settings); ++it) {
if (it->first == name) {