]> git.stg.codes - stg.git/blobdiff - projects/stargazer/plugins/store/postgresql/postgresql_store_tariffs.cpp
Merge branch 'stg-2.409-radius'
[stg.git] / projects / stargazer / plugins / store / postgresql / postgresql_store_tariffs.cpp
index 0dd74902531b09fd678858ba4fac78ca3a242b86..fd0b38bca4f9a6056a52d9d3d9ca178290435c86 100644 (file)
@@ -33,6 +33,7 @@
 
 #include <libpq-fe.h>
 
+#include "stg/common.h"
 #include "postgresql_store.h"
 #include "stg/locker.h"
 
@@ -319,7 +320,7 @@ int32_t id;
 
     if (version > 7)
         query << ", change_policy = '" << TARIFF::ChangePolicyToString(td.tariffConf.changePolicy) << "', \
-                  change_policy_timeout = CAST('" << Int2TS(td.tariffConf.changePolicyTimeout) << "' AS TIMESTAMP)";
+                  change_policy_timeout = CAST('" << formatTime(td.tariffConf.changePolicyTimeout) << "' AS TIMESTAMP)";
 
     query << " WHERE pk_tariff = " << id;
 
@@ -460,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 << "'";
 
@@ -513,7 +515,10 @@ 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);