X-Git-Url: https://git.stg.codes/stg.git/blobdiff_plain/927918006fcfee6009fb83800b3d63d483ab43c1..9c340da9ffa670c20c3658a2be43d35868a9f5d9:/projects/stargazer/plugins/store/postgresql/postgresql_store_tariffs.cpp diff --git a/projects/stargazer/plugins/store/postgresql/postgresql_store_tariffs.cpp b/projects/stargazer/plugins/store/postgresql/postgresql_store_tariffs.cpp index 5e3a0540..42775c7d 100644 --- a/projects/stargazer/plugins/store/postgresql/postgresql_store_tariffs.cpp +++ b/projects/stargazer/plugins/store/postgresql/postgresql_store_tariffs.cpp @@ -15,7 +15,7 @@ */ /* - * Author : Maxim Mamontov + * Author : Maksym Mamontov */ /* @@ -33,6 +33,7 @@ #include +#include "stg/common.h" #include "postgresql_store.h" #include "stg/locker.h" @@ -318,7 +319,8 @@ int32_t id; query << ", period = '" << TARIFF::PeriodToString(td.tariffConf.period) << "'"; if (version > 7) - query << ", change_policy = '" << TARIFF::ChangePolicyToString(td.tariffConf.changePolicy) << "'"; + query << ", change_policy = '" << TARIFF::ChangePolicyToString(td.tariffConf.changePolicy) << "', \ + change_policy_timeout = CAST('" << formatTime(td.tariffConf.changePolicyTimeout) << "' AS TIMESTAMP)"; query << " WHERE pk_tariff = " << id; @@ -459,7 +461,8 @@ if (version > 6) query << ", period"; if (version > 7) - query << ", change_policy"; + query << ", change_policy \ + , change_policy_timeout"; query << " FROM tb_tariffs WHERE name = '" << ename << "'"; @@ -511,6 +514,12 @@ int id; if (version > 6) td->tariffConf.period = TARIFF::StringToPeriod(PQgetvalue(result, 0, 5)); +if (version > 7) + { + td->tariffConf.changePolicy = TARIFF::StringToChangePolicy(PQgetvalue(result, 0, 6)); + td->tariffConf.changePolicyTimeout = readTime(PQgetvalue(result, 0, 7)); + } + PQclear(result); query.str("");