]> git.stg.codes - stg.git/blobdiff - projects/stargazer/plugins/store/postgresql/postgresql_store_tariffs.cpp
Ticket 37. The 'change_policy_timeout' field added in the if (version > 7)
[stg.git] / projects / stargazer / plugins / store / postgresql / postgresql_store_tariffs.cpp
index 8620ef600192625c11204f4ca03566a2171a878f..0dd74902531b09fd678858ba4fac78ca3a242b86 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;
 
@@ -458,6 +459,9 @@ query << "SELECT pk_tariff, \
 if (version > 6)
     query << ", period";
 
+if (version > 7)
+    query << ", change_policy";
+
 query << " FROM tb_tariffs WHERE name = '" << ename << "'";
 
 result = PQexec(connection, query.str().c_str());
@@ -508,6 +512,9 @@ 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));
+
 PQclear(result);
 
 query.str("");