]> git.stg.codes - stg.git/blobdiff - projects/stargazer/plugins/store/postgresql/postgresql_store_tariffs.cpp
Ticket 37. The changePolicyTimeout field added in SELECT FROM
[stg.git] / projects / stargazer / plugins / store / postgresql / postgresql_store_tariffs.cpp
index 5e3a05402c3faa61fe0bd946b691dd4a373c42c8..1623988d549e92252e56449bc92d21e89103eb7c 100644 (file)
@@ -318,7 +318,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('" << Int2TS(td.tariffConf.changePolicyTimeout) << "' AS TIMESTAMP)";
 
     query << " WHERE pk_tariff = " << id;
 
@@ -459,7 +460,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 +513,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 = TS2Int(PQgetvalue(result, 0, 7));
+    }
+
 PQclear(result);
 
 query.str("");