X-Git-Url: https://git.stg.codes/stg.git/blobdiff_plain/72229403aae25f742c07d07d625bdc1e313b401d..8c6fa3fbaccc22127280bf77a48fab5a3ee0716e:/projects/stargazer/plugins/store/firebird/firebird_store_users.cpp diff --git a/projects/stargazer/plugins/store/firebird/firebird_store_users.cpp b/projects/stargazer/plugins/store/firebird/firebird_store_users.cpp index 13162207..ab18a40a 100644 --- a/projects/stargazer/plugins/store/firebird/firebird_store_users.cpp +++ b/projects/stargazer/plugins/store/firebird/firebird_store_users.cpp @@ -33,7 +33,7 @@ //----------------------------------------------------------------------------- int FIREBIRD_STORE::GetUsersList(std::vector * usersList) const { -STG_LOCKER lock(&mutex, __FILE__, __LINE__); +STG_LOCKER lock(&mutex); IBPP::Transaction tr = IBPP::TransactionFactory(db, IBPP::amRead, til, tlr); IBPP::Statement st = IBPP::StatementFactory(db, tr); @@ -65,7 +65,7 @@ return 0; //----------------------------------------------------------------------------- int FIREBIRD_STORE::AddUser(const std::string & name) const { -STG_LOCKER lock(&mutex, __FILE__, __LINE__); +STG_LOCKER lock(&mutex); IBPP::Transaction tr = IBPP::TransactionFactory(db, IBPP::amWrite, til, tlr); IBPP::Statement st = IBPP::StatementFactory(db, tr); @@ -93,7 +93,7 @@ return 0; //----------------------------------------------------------------------------- int FIREBIRD_STORE::DelUser(const std::string & login) const { -STG_LOCKER lock(&mutex, __FILE__, __LINE__); +STG_LOCKER lock(&mutex); IBPP::Transaction tr = IBPP::TransactionFactory(db, IBPP::amWrite, til, tlr); IBPP::Statement st = IBPP::StatementFactory(db, tr); @@ -121,15 +121,15 @@ return 0; int FIREBIRD_STORE::SaveUserStat(const USER_STAT & stat, const std::string & login) const { -STG_LOCKER lock(&mutex, __FILE__, __LINE__); +STG_LOCKER lock(&mutex); return SaveStat(stat, login); } //----------------------------------------------------------------------------- int FIREBIRD_STORE::SaveStat(const USER_STAT & stat, - const std::string & login, - int year, - int month) const + const std::string & login, + int year, + int month) const { IBPP::Transaction tr = IBPP::TransactionFactory(db, IBPP::amWrite, til, tlr); IBPP::Statement st = IBPP::StatementFactory(db, tr); @@ -147,7 +147,7 @@ try tr->Rollback(); return -1; } - st->Get(1, uid); + int32_t uid = Get(st, 1); st->Close(); st->Prepare("select first 1 pk_stat from tb_stats where fk_user = ? order by stats_date desc"); st->Set(1, uid); @@ -226,7 +226,7 @@ return 0; int FIREBIRD_STORE::SaveUserConf(const USER_CONF & conf, const std::string & login) const { -STG_LOCKER lock(&mutex, __FILE__, __LINE__); +STG_LOCKER lock(&mutex); IBPP::Transaction tr = IBPP::TransactionFactory(db, IBPP::amWrite, til, tlr); IBPP::Statement st = IBPP::StatementFactory(db, tr); @@ -302,7 +302,7 @@ try st->Prepare("insert into tb_users_services (fk_user, fk_service) \ values (?, (select pk_service from tb_services \ where name = ?))"); - for(std::vector::const_iterator it = conf.service.begin(); it != conf.service.end(); ++it) + for(std::vector::const_iterator it = conf.services.begin(); it != conf.services.end(); ++it) { st->Set(1, uid); st->Set(2, *it); @@ -354,7 +354,7 @@ return 0; int FIREBIRD_STORE::RestoreUserStat(USER_STAT * stat, const std::string & login) const { -STG_LOCKER lock(&mutex, __FILE__, __LINE__); +STG_LOCKER lock(&mutex); IBPP::Transaction tr = IBPP::TransactionFactory(db, IBPP::amRead, til, tlr); IBPP::Statement st = IBPP::StatementFactory(db, tr); @@ -441,7 +441,7 @@ return 0; int FIREBIRD_STORE::RestoreUserConf(USER_CONF * conf, const std::string & login) const { -STG_LOCKER lock(&mutex, __FILE__, __LINE__); +STG_LOCKER lock(&mutex); IBPP::Transaction tr = IBPP::TransactionFactory(db, IBPP::amRead, til, tlr); IBPP::Statement st = IBPP::StatementFactory(db, tr); @@ -516,7 +516,7 @@ try { std::string name; st->Get(1, name); - conf->service.push_back(name); + conf->services.push_back(name); } // User data @@ -537,14 +537,15 @@ try where fk_user = ?"); st->Set(1, uid); st->Execute(); - conf->ips.Erase(); + USER_IPS ips; while (st->Fetch()) { IP_MASK im; st->Get(1, (int32_t &)im.ip); st->Get(2, (int32_t &)im.mask); - conf->ips.Add(im); + ips.Add(im); } + conf->ips = ips; tr->Commit(); } @@ -567,7 +568,7 @@ int FIREBIRD_STORE::WriteUserChgLog(const std::string & login, const std::string & newValue, const std::string & message = "") const { -STG_LOCKER lock(&mutex, __FILE__, __LINE__); +STG_LOCKER lock(&mutex); IBPP::Transaction tr = IBPP::TransactionFactory(db, IBPP::amWrite, til, tlr); IBPP::Statement st = IBPP::StatementFactory(db, tr); @@ -627,7 +628,7 @@ return 0; //----------------------------------------------------------------------------- int FIREBIRD_STORE::WriteUserConnect(const std::string & login, uint32_t ip) const { -STG_LOCKER lock(&mutex, __FILE__, __LINE__); +STG_LOCKER lock(&mutex); IBPP::Transaction tr = IBPP::TransactionFactory(db, IBPP::amWrite, til, tlr); IBPP::Statement st = IBPP::StatementFactory(db, tr); @@ -664,7 +665,7 @@ int FIREBIRD_STORE::WriteUserDisconnect(const std::string & login, double /*freeMb*/, const std::string & /*reason*/) const { -STG_LOCKER lock(&mutex, __FILE__, __LINE__); +STG_LOCKER lock(&mutex); IBPP::Transaction tr = IBPP::TransactionFactory(db, IBPP::amWrite, til, tlr); IBPP::Statement st = IBPP::StatementFactory(db, tr); @@ -712,7 +713,7 @@ int FIREBIRD_STORE::WriteDetailedStat(const std::map & s time_t lastStat, const std::string & login) const { -STG_LOCKER lock(&mutex, __FILE__, __LINE__); +STG_LOCKER lock(&mutex); IBPP::Transaction tr = IBPP::TransactionFactory(db, IBPP::amWrite, til, tlr); IBPP::Statement st = IBPP::StatementFactory(db, tr); @@ -762,7 +763,7 @@ return 0; //----------------------------------------------------------------------------- int FIREBIRD_STORE::SaveMonthStat(const USER_STAT & stat, int month, int year, const std::string & login) const { -STG_LOCKER lock(&mutex, __FILE__, __LINE__); +STG_LOCKER lock(&mutex); IBPP::Transaction tr = IBPP::TransactionFactory(db, IBPP::amWrite, til, tlr); IBPP::Statement st = IBPP::StatementFactory(db, tr);