X-Git-Url: https://git.stg.codes/stg.git/blobdiff_plain/a500fb72810060e52d87ad2c2e4691531f0bcc5a..2196a3a0cdc5384c082febb7f4aa5994cc7d80db:/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 bf6e9e9f..075f95b8 100644 --- a/projects/stargazer/plugins/store/firebird/firebird_store_users.cpp +++ b/projects/stargazer/plugins/store/firebird/firebird_store_users.cpp @@ -39,7 +39,7 @@ //----------------------------------------------------------------------------- int FIREBIRD_STORE::GetUsersList(std::vector * usersList) const { -STG_LOCKER lock(&mutex); +std::lock_guard lock(m_mutex); IBPP::Transaction tr = IBPP::TransactionFactory(db, IBPP::amRead, til, tlr); IBPP::Statement st = IBPP::StatementFactory(db, tr); @@ -70,7 +70,7 @@ return 0; //----------------------------------------------------------------------------- int FIREBIRD_STORE::AddUser(const std::string & name) const { -STG_LOCKER lock(&mutex); +std::lock_guard lock(m_mutex); IBPP::Transaction tr = IBPP::TransactionFactory(db, IBPP::amWrite, til, tlr); IBPP::Statement st = IBPP::StatementFactory(db, tr); @@ -98,7 +98,7 @@ return 0; //----------------------------------------------------------------------------- int FIREBIRD_STORE::DelUser(const std::string & login) const { -STG_LOCKER lock(&mutex); +std::lock_guard lock(m_mutex); IBPP::Transaction tr = IBPP::TransactionFactory(db, IBPP::amWrite, til, tlr); IBPP::Statement st = IBPP::StatementFactory(db, tr); @@ -126,7 +126,7 @@ return 0; int FIREBIRD_STORE::SaveUserStat(const STG::UserStat & stat, const std::string & login) const { -STG_LOCKER lock(&mutex); +std::lock_guard lock(m_mutex); return SaveStat(stat, login); } @@ -231,7 +231,7 @@ return 0; int FIREBIRD_STORE::SaveUserConf(const STG::UserConf & conf, const std::string & login) const { -STG_LOCKER lock(&mutex); +std::lock_guard lock(m_mutex); IBPP::Transaction tr = IBPP::TransactionFactory(db, IBPP::amWrite, til, tlr); IBPP::Statement st = IBPP::StatementFactory(db, tr); @@ -336,7 +336,7 @@ try st->Execute(); st->Prepare("insert into tb_allowed_ip (fk_user, ip, mask) values (?, ?, ?)"); - for(size_t j = 0; i < conf.ips.count(); j++) + for(size_t j = 0; j < conf.ips.count(); j++) { st->Set(1, uid); st->Set(2, (int32_t)conf.ips[j].ip); @@ -359,7 +359,7 @@ return 0; int FIREBIRD_STORE::RestoreUserStat(STG::UserStat * stat, const std::string & login) const { -STG_LOCKER lock(&mutex); +std::lock_guard lock(m_mutex); IBPP::Transaction tr = IBPP::TransactionFactory(db, IBPP::amRead, til, tlr); IBPP::Statement st = IBPP::StatementFactory(db, tr); @@ -446,7 +446,7 @@ return 0; int FIREBIRD_STORE::RestoreUserConf(STG::UserConf * conf, const std::string & login) const { -STG_LOCKER lock(&mutex); +std::lock_guard lock(m_mutex); IBPP::Transaction tr = IBPP::TransactionFactory(db, IBPP::amRead, til, tlr); IBPP::Statement st = IBPP::StatementFactory(db, tr); @@ -573,7 +573,7 @@ int FIREBIRD_STORE::WriteUserChgLog(const std::string & login, const std::string & newValue, const std::string & message = "") const { -STG_LOCKER lock(&mutex); +std::lock_guard lock(m_mutex); IBPP::Transaction tr = IBPP::TransactionFactory(db, IBPP::amWrite, til, tlr); IBPP::Statement st = IBPP::StatementFactory(db, tr); @@ -633,7 +633,7 @@ return 0; //----------------------------------------------------------------------------- int FIREBIRD_STORE::WriteUserConnect(const std::string & login, uint32_t ip) const { -STG_LOCKER lock(&mutex); +std::lock_guard lock(m_mutex); IBPP::Transaction tr = IBPP::TransactionFactory(db, IBPP::amWrite, til, tlr); IBPP::Statement st = IBPP::StatementFactory(db, tr); @@ -670,7 +670,7 @@ int FIREBIRD_STORE::WriteUserDisconnect(const std::string & login, double /*freeMb*/, const std::string & /*reason*/) const { -STG_LOCKER lock(&mutex); +std::lock_guard lock(m_mutex); IBPP::Transaction tr = IBPP::TransactionFactory(db, IBPP::amWrite, til, tlr); IBPP::Statement st = IBPP::StatementFactory(db, tr); @@ -718,7 +718,7 @@ int FIREBIRD_STORE::WriteDetailedStat(const STG::TraffStat & statTree, time_t lastStat, const std::string & login) const { -STG_LOCKER lock(&mutex); +std::lock_guard lock(m_mutex); IBPP::Transaction tr = IBPP::TransactionFactory(db, IBPP::amWrite, til, tlr); IBPP::Statement st = IBPP::StatementFactory(db, tr); @@ -768,7 +768,7 @@ return 0; //----------------------------------------------------------------------------- int FIREBIRD_STORE::SaveMonthStat(const STG::UserStat & stat, int month, int year, const std::string & login) const { -STG_LOCKER lock(&mutex); +std::lock_guard lock(m_mutex); IBPP::Transaction tr = IBPP::TransactionFactory(db, IBPP::amWrite, til, tlr); IBPP::Statement st = IBPP::StatementFactory(db, tr);