X-Git-Url: https://git.stg.codes/stg.git/blobdiff_plain/bd66b226090397493de8d87649b2bbad3ac89e36..2574a28cbf000603bc31f61593dbf061ff56c1d5:/projects/stargazer/plugins/store/firebird/firebird_store_messages.cpp diff --git a/projects/stargazer/plugins/store/firebird/firebird_store_messages.cpp b/projects/stargazer/plugins/store/firebird/firebird_store_messages.cpp index c6180c26..d2c4a3ee 100644 --- a/projects/stargazer/plugins/store/firebird/firebird_store_messages.cpp +++ b/projects/stargazer/plugins/store/firebird/firebird_store_messages.cpp @@ -27,15 +27,16 @@ * */ -#include - #include "firebird_store.h" + #include "stg/ibpp.h" +#include "stg/message.h" +#include "stg/common.h" //----------------------------------------------------------------------------- -int FIREBIRD_STORE::AddMessage(STG_MSG * msg, const string & login) const +int FIREBIRD_STORE::AddMessage(STG::Message * msg, const std::string & login) const { -STG_LOCKER lock(&mutex, __FILE__, __LINE__); +std::lock_guard lock(m_mutex); IBPP::Transaction tr = IBPP::TransactionFactory(db, IBPP::amWrite, til, tlr); IBPP::Statement st = IBPP::StatementFactory(db, tr); @@ -69,10 +70,10 @@ catch (IBPP::Exception & ex) return 0; } //----------------------------------------------------------------------------- -int FIREBIRD_STORE::EditMessage(const STG_MSG & msg, - const string & login) const +int FIREBIRD_STORE::EditMessage(const STG::Message & msg, + const std::string & login) const { -STG_LOCKER lock(&mutex, __FILE__, __LINE__); +std::lock_guard lock(m_mutex); IBPP::Transaction tr = IBPP::TransactionFactory(db, IBPP::amWrite, til, tlr); IBPP::Statement st = IBPP::StatementFactory(db, tr); @@ -107,10 +108,10 @@ return 0; } //----------------------------------------------------------------------------- int FIREBIRD_STORE::GetMessage(uint64_t id, - STG_MSG * msg, - const string &) const + STG::Message * msg, + const std::string &) const { -STG_LOCKER lock(&mutex, __FILE__, __LINE__); +std::lock_guard lock(m_mutex); IBPP::Transaction tr = IBPP::TransactionFactory(db, IBPP::amRead, til, tlr); IBPP::Statement st = IBPP::StatementFactory(db, tr); @@ -154,9 +155,9 @@ catch (IBPP::Exception & ex) return 0; } //----------------------------------------------------------------------------- -int FIREBIRD_STORE::DelMessage(uint64_t id, const string &) const +int FIREBIRD_STORE::DelMessage(uint64_t id, const std::string &) const { -STG_LOCKER lock(&mutex, __FILE__, __LINE__); +std::lock_guard lock(m_mutex); IBPP::Transaction tr = IBPP::TransactionFactory(db, IBPP::amWrite, til, tlr); IBPP::Statement st = IBPP::StatementFactory(db, tr); @@ -181,15 +182,15 @@ catch (IBPP::Exception & ex) return 0; } //----------------------------------------------------------------------------- -int FIREBIRD_STORE::GetMessageHdrs(vector * hdrsList, - const string & login) const +int FIREBIRD_STORE::GetMessageHdrs(std::vector * hdrsList, + const std::string & login) const { -STG_LOCKER lock(&mutex, __FILE__, __LINE__); +std::lock_guard lock(m_mutex); IBPP::Transaction tr = IBPP::TransactionFactory(db, IBPP::amRead, til, tlr); IBPP::Statement st = IBPP::StatementFactory(db, tr); -STG_MSG_HDR header; +STG::Message::Header header; try {