]> git.stg.codes - stg.git/blobdiff - projects/stargazer/plugins/store/firebird/firebird_store_tariffs.cpp
Use std::lock_guard instead of STG_LOCKER.
[stg.git] / projects / stargazer / plugins / store / firebird / firebird_store_tariffs.cpp
index 10c45ab9b6a79698185aa6b47eb558ad8e07a0c9..93360f219bf72f4a089c50d0b3521b8dfd3f49b1 100644 (file)
@@ -45,19 +45,18 @@ const int pt_mega = 1024 * 1024;
 //-----------------------------------------------------------------------------
 int FIREBIRD_STORE::GetTariffsList(std::vector<std::string> * 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);