*/
/*
- * Author : Maxim Mamontov <faust@stargazer.dp.ua>
+ * Author : Maksym Mamontov <stg@madf.info>
*/
/*
#include <libpq-fe.h>
+#include "stg/common.h"
#include "postgresql_store.h"
#include "stg/locker.h"
if (version > 6)
query << ", period = '" << TARIFF::PeriodToString(td.tariffConf.period) << "'";
+ if (version > 7)
+ query << ", change_policy = '" << TARIFF::ChangePolicyToString(td.tariffConf.changePolicy) << "', \
+ change_policy_timeout = CAST('" << formatTime(td.tariffConf.changePolicyTimeout) << "' AS TIMESTAMP)";
+
query << " WHERE pk_tariff = " << id;
result = PQexec(connection, query.str().c_str());
if (version > 6)
query << ", period";
+if (version > 7)
+ query << ", change_policy \
+ , change_policy_timeout";
+
query << " FROM tb_tariffs WHERE name = '" << ename << "'";
result = PQexec(connection, query.str().c_str());
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("");