]> git.stg.codes - stg.git/blobdiff - projects/stargazer/plugins/store/firebird/firebird_store_services.cpp
More jthreads.
[stg.git] / projects / stargazer / plugins / store / firebird / firebird_store_services.cpp
index f7167acbdb7fe9211d6156b7dfdaf1c9c63d0fd1..539fcf73d31868d848705cdc86ef92bc93aea9d5 100644 (file)
  */
 
 #include "firebird_store.h"
+
 #include "stg/ibpp.h"
+#include "stg/service_conf.h"
+#include "stg/common.h"
 
 //-----------------------------------------------------------------------------
-int FIREBIRD_STORE::GetServicesList(vector<string> * servicesList) const
+int FIREBIRD_STORE::GetServicesList(std::vector<std::string> * servicesList) 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);
 
-string name;
-
 try
     {
     tr->Start();
     st->Execute("select name from tb_services");
     while (st->Fetch())
         {
+        std::string name;
         st->Get(1, name);
         servicesList->push_back(name);
         }
@@ -63,9 +65,9 @@ catch (IBPP::Exception & ex)
 return 0;
 }
 //-----------------------------------------------------------------------------
-int FIREBIRD_STORE::SaveService(const SERVICE_CONF & sc) const
+int FIREBIRD_STORE::SaveService(const STG::ServiceConf & sc) 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);
@@ -80,7 +82,7 @@ try
          where name = ?");
     st->Set(1, sc.comment);
     st->Set(2, sc.cost);
-    st->Set(3, static_cast<long>(sc.payDay));
+    st->Set(3, static_cast<int16_t>(sc.payDay));
     st->Set(4, sc.name);
     st->Execute();
     tr->Commit();
@@ -97,10 +99,10 @@ catch (IBPP::Exception & ex)
 return 0;
 }
 //-----------------------------------------------------------------------------
-int FIREBIRD_STORE::RestoreService(SERVICE_CONF * sc,
-                                   const string & name) const
+int FIREBIRD_STORE::RestoreService(STG::ServiceConf * sc,
+                                   const std::string & name) 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);
@@ -115,9 +117,9 @@ try
         {
         st->Get(3, sc->comment);
         st->Get(4, sc->cost);
-        long pd;
+        int16_t pd;
         st->Get(5, pd);
-        sc->payDay = pd;
+        sc->payDay = static_cast<uint8_t>(pd);
         }
     else
         {
@@ -140,9 +142,9 @@ catch (IBPP::Exception & ex)
 return 0;
 }
 //-----------------------------------------------------------------------------
-int FIREBIRD_STORE::AddService(const string & name) const
+int FIREBIRD_STORE::AddService(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);
@@ -168,9 +170,9 @@ catch (IBPP::Exception & ex)
 return 0;
 }
 //-----------------------------------------------------------------------------
-int FIREBIRD_STORE::DelService(const string & name) const
+int FIREBIRD_STORE::DelService(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);