X-Git-Url: https://git.stg.codes/stg.git/blobdiff_plain/a34c929363e920ccf0cfd83992866851e184b495..0e1a152a317a37c709c2b360a55023995b516cd8:/projects/stargazer/plugins/store/mysql/mysql_store.cpp?ds=sidebyside diff --git a/projects/stargazer/plugins/store/mysql/mysql_store.cpp b/projects/stargazer/plugins/store/mysql/mysql_store.cpp index 3e61498f..1e4c235d 100644 --- a/projects/stargazer/plugins/store/mysql/mysql_store.cpp +++ b/projects/stargazer/plugins/store/mysql/mysql_store.cpp @@ -1625,24 +1625,7 @@ if (GetDouble(row[1+8*DIR_NUM], &td->tariffConf.passiveCost, 0.0) < 0) return -1; } -if (!strcasecmp(str.c_str(), "up")) - td->tariffConf.traffType = TRAFF_UP; -else - if (!strcasecmp(str.c_str(), "down")) - td->tariffConf.traffType = TRAFF_DOWN; - else - if (!strcasecmp(str.c_str(), "up+down")) - td->tariffConf.traffType = TRAFF_UP_DOWN; - else - if (!strcasecmp(str.c_str(), "max")) - td->tariffConf.traffType = TRAFF_MAX; - else - { - mysql_free_result(res); - errorStr = "Cannot read tariff " + tariffName + ". Parameter TraffType incorrect"; - mysql_close(sock); - return -1; - } +td->tariffConf.traffType = TARIFF::StringToTraffType(str); if (schemaVersion > 0) { @@ -1726,21 +1709,7 @@ res += param; strprintf(¶m, " Free=%f,", td.tariffConf.free); res += param; -switch (td.tariffConf.traffType) - { - case TRAFF_UP: - res += " TraffType='up'"; - break; - case TRAFF_DOWN: - res += " TraffType='down'"; - break; - case TRAFF_UP_DOWN: - res += " TraffType='up+down'"; - break; - case TRAFF_MAX: - res += " TraffType='max'"; - break; - } +res += " TraffType='" + TARIFF::TraffTypeToString(td.tariffConf.traffType) + "'"; if (schemaVersion > 0) res += ", Period='" + TARIFF::PeriodToString(td.tariffConf.period) + "'";