X-Git-Url: https://git.stg.codes/stg.git/blobdiff_plain/0907aa4037b12b6b88ee24495d4577a064d4f8db..2196a3a0cdc5384c082febb7f4aa5994cc7d80db:/projects/stargazer/plugins/store/firebird/firebird_store_tariffs.cpp diff --git a/projects/stargazer/plugins/store/firebird/firebird_store_tariffs.cpp b/projects/stargazer/plugins/store/firebird/firebird_store_tariffs.cpp index 10c45ab9..93360f21 100644 --- a/projects/stargazer/plugins/store/firebird/firebird_store_tariffs.cpp +++ b/projects/stargazer/plugins/store/firebird/firebird_store_tariffs.cpp @@ -45,19 +45,18 @@ const int pt_mega = 1024 * 1024; //----------------------------------------------------------------------------- int FIREBIRD_STORE::GetTariffsList(std::vector * tariffsList) 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); -std::string name; - try { tr->Start(); st->Execute("select name from tb_tariffs"); while (st->Fetch()) { + std::string name; st->Get(1, name); tariffsList->push_back(name); } @@ -77,7 +76,7 @@ return 0; //----------------------------------------------------------------------------- int FIREBIRD_STORE::AddTariff(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); @@ -105,7 +104,7 @@ return 0; //----------------------------------------------------------------------------- int FIREBIRD_STORE::DelTariff(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); @@ -133,7 +132,7 @@ return 0; int FIREBIRD_STORE::SaveTariff(const STG::TariffData & td, const std::string & tariffName) 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); @@ -268,7 +267,7 @@ return 0; int FIREBIRD_STORE::RestoreTariff(STG::TariffData * td, const std::string & tariffName) 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);