X-Git-Url: https://git.stg.codes/stg.git/blobdiff_plain/2395ee39f86d9ec56e74c3d8dd388b3d2c2e1aaf..e3e2d6326db86d7ca22d2cba1193aa64a8e33b2d:/projects/stargazer/plugins/store/firebird/firebird_store_services.cpp diff --git a/projects/stargazer/plugins/store/firebird/firebird_store_services.cpp b/projects/stargazer/plugins/store/firebird/firebird_store_services.cpp index 84eab5fa..539fcf73 100644 --- a/projects/stargazer/plugins/store/firebird/firebird_store_services.cpp +++ b/projects/stargazer/plugins/store/firebird/firebird_store_services.cpp @@ -28,24 +28,26 @@ */ #include "firebird_store.h" + #include "stg/ibpp.h" +#include "stg/service_conf.h" +#include "stg/common.h" //----------------------------------------------------------------------------- -int FIREBIRD_STORE::GetServicesList(vector * servicesList) const +int FIREBIRD_STORE::GetServicesList(std::vector * 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); @@ -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); @@ -117,7 +119,7 @@ try st->Get(4, sc->cost); int16_t pd; st->Get(5, pd); - sc->payDay = pd; + sc->payDay = static_cast(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);