#include <libpq-fe.h>
-#include "stg_const.h"
-#include "postgresql_store.h"
-#include "stg_locker.h"
+#include "stg/const.h"
+#include "stg/locker.h"
#include "../../../stg_timer.h"
+#include "postgresql_store.h"
//-----------------------------------------------------------------------------
int POSTGRESQL_STORE::GetUsersList(vector<string> * usersList) const
}
else
{
- conf->userdata[i] = PQgetvalue(result, i, 1);
+ if (num < USERDATA_NUM &&
+ num >= 0)
+ {
+ conf->userdata[num] = PQgetvalue(result, i, 1);
+ }
}
}
query << "SELECT sp_add_param_log_entry("
"'" << elogin << "', "
"'" << eadminLogin << "', CAST('"
- << inet_ntostring(admIP) << "/24' AS INET), "
+ << inet_ntostring(admIP) << "/32' AS INET), "
"'" << eparam << "', "
"CAST('" << Int2TS(stgTime) << "' AS TIMESTAMP), "
"'" << eold << "', "
}
//-----------------------------------------------------------------------------
-int POSTGRESQL_STORE::WriteDetailedStat(const map<IP_DIR_PAIR, STAT_NODE> * statTree,
+int POSTGRESQL_STORE::WriteDetailedStat(const map<IP_DIR_PAIR, STAT_NODE> & statTree,
time_t lastStat,
const string & login) const
{
map<IP_DIR_PAIR, STAT_NODE>::const_iterator it;
time_t currTime = time(NULL);
-for (it = statTree->begin(); it != statTree->end(); ++it)
+for (it = statTree.begin(); it != statTree.end(); ++it)
{
std::stringstream query;
query << "INSERT INTO tb_detail_stats "