From: Maxim Mamontov Date: Mon, 6 Dec 2010 14:30:02 +0000 (+0200) Subject: При записи детальной статистики данные теперь передаются не по указателю X-Git-Tag: 2.407-rc3~344 X-Git-Url: https://git.stg.codes/stg.git/commitdiff_plain/1bf5ae378079e212f6918d09d87dec5420a0d6ec При записи детальной статистики данные теперь передаются не по указателю я по ссылке. Соответственно, исправлены все плагины хранилищ. --- diff --git a/include/base_store.h b/include/base_store.h index e5939623..c35b49c7 100644 --- a/include/base_store.h +++ b/include/base_store.h @@ -73,7 +73,7 @@ public: double freeMb, const std::string & reason) const = 0; - virtual int WriteDetailedStat(const map * statTree, + virtual int WriteDetailedStat(const map & statTree, time_t lastStat, const string & login) const = 0; diff --git a/projects/stargazer/plugins/store/files/file_store.cpp b/projects/stargazer/plugins/store/files/file_store.cpp index 07638400..556bf8cf 100644 --- a/projects/stargazer/plugins/store/files/file_store.cpp +++ b/projects/stargazer/plugins/store/files/file_store.cpp @@ -1766,7 +1766,7 @@ switch (td.tariffConf.traffType) return 0; } //----------------------------------------------------------------------------- -int FILES_STORE::WriteDetailedStat(const map * statTree, +int FILES_STORE::WriteDetailedStat(const map & statTree, time_t lastStat, const string & login) const { @@ -1899,9 +1899,9 @@ if (fprintf(statFile, "-> %02d.%02d.%02d - %02d.%02d.%02d\n", } map::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); diff --git a/projects/stargazer/plugins/store/files/file_store.h b/projects/stargazer/plugins/store/files/file_store.h index 4734a54d..38fea5e1 100644 --- a/projects/stargazer/plugins/store/files/file_store.h +++ b/projects/stargazer/plugins/store/files/file_store.h @@ -137,7 +137,7 @@ public: double freeMb, const std::string & reason) const; - virtual int WriteDetailedStat(const map * statTree, + virtual int WriteDetailedStat(const map & statTree, time_t lastStat, const string & login) const; diff --git a/projects/stargazer/plugins/store/firebird/firebird_store.h b/projects/stargazer/plugins/store/firebird/firebird_store.h index 2cc62cfa..55333888 100644 --- a/projects/stargazer/plugins/store/firebird/firebird_store.h +++ b/projects/stargazer/plugins/store/firebird/firebird_store.h @@ -73,7 +73,7 @@ public: double cash, double freeMb, const std::string & reason) const; - int WriteDetailedStat(const std::map * statTree, + int WriteDetailedStat(const std::map & statTree, time_t lastStat, const std::string & login) const; diff --git a/projects/stargazer/plugins/store/firebird/firebird_store_users.cpp b/projects/stargazer/plugins/store/firebird/firebird_store_users.cpp index 035ae134..6d2d36bf 100644 --- a/projects/stargazer/plugins/store/firebird/firebird_store_users.cpp +++ b/projects/stargazer/plugins/store/firebird/firebird_store_users.cpp @@ -717,7 +717,7 @@ catch (IBPP::Exception & ex) return 0; } //----------------------------------------------------------------------------- -int FIREBIRD_STORE::WriteDetailedStat(const map * statTree, +int FIREBIRD_STORE::WriteDetailedStat(const map & statTree, time_t lastStat, const string & login) const { @@ -735,14 +735,14 @@ try { tr->Start(); map::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 = ?), \ ?, ?, ?, ?, ?)"); - while (it != statTree->end()) + while (it != statTree.end()) { st->Set(1, now); st->Set(2, statTime); diff --git a/projects/stargazer/plugins/store/mysql/mysql_store.cpp b/projects/stargazer/plugins/store/mysql/mysql_store.cpp index 94503c78..f78586fb 100644 --- a/projects/stargazer/plugins/store/mysql/mysql_store.cpp +++ b/projects/stargazer/plugins/store/mysql/mysql_store.cpp @@ -1689,7 +1689,7 @@ if(MysqlSetQuery(res.c_str())) return 0; } //----------------------------------------------------------------------------- -int MYSQL_STORE::WriteDetailedStat(const map * statTree, +int MYSQL_STORE::WriteDetailedStat(const map & statTree, time_t lastStat, const string & login) const { @@ -1776,9 +1776,9 @@ strprintf(&res,"INSERT INTO detailstat_%02d_%4d SET login='%s',"\ int retRes; map::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(), diff --git a/projects/stargazer/plugins/store/mysql/mysql_store.h b/projects/stargazer/plugins/store/mysql/mysql_store.h index 649cb858..7b48712f 100644 --- a/projects/stargazer/plugins/store/mysql/mysql_store.h +++ b/projects/stargazer/plugins/store/mysql/mysql_store.h @@ -78,7 +78,7 @@ public: double freeMb, const std::string & reason) const; - virtual int WriteDetailedStat(const map * statTree, + virtual int WriteDetailedStat(const map & statTree, time_t lastStat, const string & login) const; diff --git a/projects/stargazer/plugins/store/postgresql/postgresql_store.h b/projects/stargazer/plugins/store/postgresql/postgresql_store.h index 67119db2..a731fbf9 100644 --- a/projects/stargazer/plugins/store/postgresql/postgresql_store.h +++ b/projects/stargazer/plugins/store/postgresql/postgresql_store.h @@ -72,7 +72,7 @@ public: double cash, double freeMb, const std::string & reason) const; - int WriteDetailedStat(const std::map * statTree, + int WriteDetailedStat(const std::map & statTree, time_t lastStat, const std::string & login) const; diff --git a/projects/stargazer/plugins/store/postgresql/postgresql_store_users.cpp b/projects/stargazer/plugins/store/postgresql/postgresql_store_users.cpp index 0e26327b..2c66cc7f 100644 --- a/projects/stargazer/plugins/store/postgresql/postgresql_store_users.cpp +++ b/projects/stargazer/plugins/store/postgresql/postgresql_store_users.cpp @@ -1330,7 +1330,7 @@ return 0; } //----------------------------------------------------------------------------- -int POSTGRESQL_STORE::WriteDetailedStat(const map * statTree, +int POSTGRESQL_STORE::WriteDetailedStat(const map & statTree, time_t lastStat, const string & login) const { @@ -1370,7 +1370,7 @@ if (EscapeString(elogin)) map::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 "