]> git.stg.codes - stg.git/blobdiff - projects/stargazer/plugins/store/postgresql/postgresql_store_tariffs.cpp
Simplified STG_LOCKER.
[stg.git] / projects / stargazer / plugins / store / postgresql / postgresql_store_tariffs.cpp
index ab78f00fee74a2e1d6e2d8c681a24a38e5bf4272..dabc06db5586a9c5232eebef51fd66936f123986 100644 (file)
@@ -39,7 +39,7 @@
 //-----------------------------------------------------------------------------
 int POSTGRESQL_STORE::GetTariffsList(std::vector<std::string> * tariffsList) const
 {
-STG_LOCKER lock(&mutex, __FILE__, __LINE__);
+STG_LOCKER lock(&mutex);
 
 if (PQstatus(connection) != CONNECTION_OK)
     {
@@ -95,7 +95,7 @@ return 0;
 //-----------------------------------------------------------------------------
 int POSTGRESQL_STORE::AddTariff(const std::string & name) const
 {
-STG_LOCKER lock(&mutex, __FILE__, __LINE__);
+STG_LOCKER lock(&mutex);
 
 if (PQstatus(connection) != CONNECTION_OK)
     {
@@ -158,7 +158,7 @@ return 0;
 //-----------------------------------------------------------------------------
 int POSTGRESQL_STORE::DelTariff(const std::string & name) const
 {
-STG_LOCKER lock(&mutex, __FILE__, __LINE__);
+STG_LOCKER lock(&mutex);
 
 if (PQstatus(connection) != CONNECTION_OK)
     {
@@ -222,7 +222,7 @@ return 0;
 int POSTGRESQL_STORE::SaveTariff(const TARIFF_DATA & td,
                                  const std::string & tariffName) const
 {
-STG_LOCKER lock(&mutex, __FILE__, __LINE__);
+STG_LOCKER lock(&mutex);
 
 if (PQstatus(connection) != CONNECTION_OK)
     {
@@ -288,13 +288,14 @@ if (tuples != 1)
     return -1;
     }
 
+int32_t id;
+
     {
     std::stringstream tuple;
     tuple << PQgetvalue(result, 0, 0);
 
     PQclear(result);
 
-    int32_t id;
     tuple >> id;
     }
 
@@ -402,7 +403,7 @@ return 0;
 int POSTGRESQL_STORE::RestoreTariff(TARIFF_DATA * td,
                                   const std::string & tariffName) const
 {
-STG_LOCKER lock(&mutex, __FILE__, __LINE__);
+STG_LOCKER lock(&mutex);
 
 if (PQstatus(connection) != CONNECTION_OK)
     {