]> git.stg.codes - stg.git/commitdiff
При записи детальной статистики данные теперь передаются не по указателю
authorMaxim Mamontov <faust@gts.dp.ua>
Mon, 6 Dec 2010 14:30:02 +0000 (16:30 +0200)
committerMaxim Mamontov <faust@gts.dp.ua>
Mon, 6 Dec 2010 14:30:02 +0000 (16:30 +0200)
я по ссылке. Соответственно, исправлены все плагины хранилищ.

include/base_store.h
projects/stargazer/plugins/store/files/file_store.cpp
projects/stargazer/plugins/store/files/file_store.h
projects/stargazer/plugins/store/firebird/firebird_store.h
projects/stargazer/plugins/store/firebird/firebird_store_users.cpp
projects/stargazer/plugins/store/mysql/mysql_store.cpp
projects/stargazer/plugins/store/mysql/mysql_store.h
projects/stargazer/plugins/store/postgresql/postgresql_store.h
projects/stargazer/plugins/store/postgresql/postgresql_store_users.cpp

index e593962336c5b253bdd19e0e357b867c3af60240..c35b49c7395fd74cffe60be677094a76b08043f8 100644 (file)
@@ -73,7 +73,7 @@ public:
                                     double freeMb,
                                     const std::string & reason) const = 0;
 
                                     double freeMb,
                                     const std::string & reason) const = 0;
 
-    virtual int WriteDetailedStat(const map<IP_DIR_PAIR, STAT_NODE> * statTree,
+    virtual int WriteDetailedStat(const map<IP_DIR_PAIR, STAT_NODE> & statTree,
                                   time_t lastStat,
                                   const string & login) const = 0;
 
                                   time_t lastStat,
                                   const string & login) const = 0;
 
index 07638400fe1c0dd9177cfe1dd50cca523a986655..556bf8cfd648e0e0510002957a644023ece9ca01 100644 (file)
@@ -1766,7 +1766,7 @@ switch (td.tariffConf.traffType)
 return 0;
 }
 //-----------------------------------------------------------------------------
 return 0;
 }
 //-----------------------------------------------------------------------------
-int FILES_STORE::WriteDetailedStat(const map<IP_DIR_PAIR, STAT_NODE> * statTree,
+int FILES_STORE::WriteDetailedStat(const map<IP_DIR_PAIR, STAT_NODE> & statTree,
                                    time_t lastStat,
                                    const string & login) const
 {
                                    time_t lastStat,
                                    const string & login) const
 {
@@ -1899,9 +1899,9 @@ if (fprintf(statFile, "-> %02d.%02d.%02d - %02d.%02d.%02d\n",
     }
 
 map<IP_DIR_PAIR, STAT_NODE>::const_iterator stIter;
     }
 
 map<IP_DIR_PAIR, STAT_NODE>::const_iterator stIter;
-stIter = statTree->begin();
+stIter = statTree.begin();
 
 
-while (stIter != statTree->end())
+while (stIter != statTree.end())
     {
     string u, d;
     x2str(stIter->second.up, u);
     {
     string u, d;
     x2str(stIter->second.up, u);
index 4734a54d69cf46f965417050c22215dfbc61248b..38fea5e1e68a99cce6c6317870c3c0f97ec9459b 100644 (file)
@@ -137,7 +137,7 @@ public:
                                     double freeMb,
                                     const std::string & reason) const;
 
                                     double freeMb,
                                     const std::string & reason) const;
 
-    virtual int WriteDetailedStat(const map<IP_DIR_PAIR, STAT_NODE> * statTree,
+    virtual int WriteDetailedStat(const map<IP_DIR_PAIR, STAT_NODE> & statTree,
                                   time_t lastStat,
                                   const string & login) const;
 
                                   time_t lastStat,
                                   const string & login) const;
 
index 2cc62cfa884f716622d409ea0a6f4cde20b71298..55333888e57cccd91ce86804562fbf3326d832f2 100644 (file)
@@ -73,7 +73,7 @@ public:
                             double cash,
                             double freeMb,
                             const std::string & reason) const;
                             double cash,
                             double freeMb,
                             const std::string & reason) const;
-    int WriteDetailedStat(const std::map<IP_DIR_PAIR, STAT_NODE> * statTree,
+    int WriteDetailedStat(const std::map<IP_DIR_PAIR, STAT_NODE> & statTree,
                           time_t lastStat,
                           const std::string & login) const;
 
                           time_t lastStat,
                           const std::string & login) const;
 
index 035ae134e3385fa8348c7114b708b39ca69c34f3..6d2d36bf4cd2bda5692e1b78f9d184c5919878a2 100644 (file)
@@ -717,7 +717,7 @@ catch (IBPP::Exception & ex)
 return 0;
 }
 //-----------------------------------------------------------------------------
 return 0;
 }
 //-----------------------------------------------------------------------------
-int FIREBIRD_STORE::WriteDetailedStat(const map<IP_DIR_PAIR, STAT_NODE> * statTree,
+int FIREBIRD_STORE::WriteDetailedStat(const map<IP_DIR_PAIR, STAT_NODE> & statTree,
                                       time_t lastStat,
                                       const string & login) const
 {
                                       time_t lastStat,
                                       const string & login) const
 {
@@ -735,14 +735,14 @@ try
     {
     tr->Start();
     map<IP_DIR_PAIR, STAT_NODE>::const_iterator it;
     {
     tr->Start();
     map<IP_DIR_PAIR, STAT_NODE>::const_iterator it;
-    it = statTree->begin();
+    it = statTree.begin();
     st->Prepare("insert into tb_detail_stats \
                     (till_time, from_time, fk_user, dir_num, \
                      ip, download, upload, cost) \
                  values (?, ?, (select pk_user from tb_users \
                                 where name = ?), \
                      ?, ?, ?, ?, ?)");
     st->Prepare("insert into tb_detail_stats \
                     (till_time, from_time, fk_user, dir_num, \
                      ip, download, upload, cost) \
                  values (?, ?, (select pk_user from tb_users \
                                 where name = ?), \
                      ?, ?, ?, ?, ?)");
-    while (it != statTree->end())
+    while (it != statTree.end())
         {
         st->Set(1, now);
         st->Set(2, statTime);
         {
         st->Set(1, now);
         st->Set(2, statTime);
index 94503c78d06e4f7982afac73e43fd5e1ed6fe24c..f78586fb1cc7a2164013466409e5c991db0c2c60 100644 (file)
@@ -1689,7 +1689,7 @@ if(MysqlSetQuery(res.c_str()))
 return 0;
 }
 //-----------------------------------------------------------------------------
 return 0;
 }
 //-----------------------------------------------------------------------------
-int MYSQL_STORE::WriteDetailedStat(const map<IP_DIR_PAIR, STAT_NODE> * statTree, 
+int MYSQL_STORE::WriteDetailedStat(const map<IP_DIR_PAIR, STAT_NODE> & statTree, 
                                    time_t lastStat, 
                                    const string & login) const
 {
                                    time_t lastStat, 
                                    const string & login) const
 {
@@ -1776,9 +1776,9 @@ strprintf(&res,"INSERT INTO detailstat_%02d_%4d SET login='%s',"\
 
 int retRes;
 map<IP_DIR_PAIR, STAT_NODE>::const_iterator stIter;
 
 int retRes;
 map<IP_DIR_PAIR, STAT_NODE>::const_iterator stIter;
-stIter = statTree->begin();
+stIter = statTree.begin();
 
 
-while (stIter != statTree->end())
+while (stIter != statTree.end())
     {
         strprintf(&tempStr,"IP='%s', dir=%d, down=%lld, up=%lld, cash=%f", 
                 inet_ntostring(stIter->first.ip).c_str(),
     {
         strprintf(&tempStr,"IP='%s', dir=%d, down=%lld, up=%lld, cash=%f", 
                 inet_ntostring(stIter->first.ip).c_str(),
index 649cb8588349ffb3b96c6b4e22bd2de881e43f32..7b48712f10771829961b870da22f7374534b0529 100644 (file)
@@ -78,7 +78,7 @@ public:
                                     double freeMb,
                                     const std::string & reason) const;
 
                                     double freeMb,
                                     const std::string & reason) const;
 
-    virtual int WriteDetailedStat(const map<IP_DIR_PAIR, STAT_NODE> * statTree,
+    virtual int WriteDetailedStat(const map<IP_DIR_PAIR, STAT_NODE> & statTree,
                                   time_t lastStat,
                                   const string & login) const;
 
                                   time_t lastStat,
                                   const string & login) const;
 
index 67119db2a77c7ed38e44da884ca68a183eafb1a2..a731fbf9485ca8c11943f19602350670a7d828bb 100644 (file)
@@ -72,7 +72,7 @@ public:
                             double cash,
                             double freeMb,
                             const std::string & reason) const;
                             double cash,
                             double freeMb,
                             const std::string & reason) const;
-    int WriteDetailedStat(const std::map<IP_DIR_PAIR, STAT_NODE> * statTree,
+    int WriteDetailedStat(const std::map<IP_DIR_PAIR, STAT_NODE> & statTree,
                           time_t lastStat,
                           const std::string & login) const;
 
                           time_t lastStat,
                           const std::string & login) const;
 
index 0e26327b58fbeb5741ca103bdd62d50daecdccb3..2c66cc7f425fb4b251b2c3ef57bbf3bef365b456 100644 (file)
@@ -1330,7 +1330,7 @@ return 0;
 }
 
 //-----------------------------------------------------------------------------
 }
 
 //-----------------------------------------------------------------------------
-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
 {
                                       time_t lastStat,
                                       const string & login) const
 {
@@ -1370,7 +1370,7 @@ if (EscapeString(elogin))
 map<IP_DIR_PAIR, STAT_NODE>::const_iterator it;
 time_t currTime = time(NULL);
 
 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 "
     {
     std::stringstream query;
     query << "INSERT INTO tb_detail_stats "