X-Git-Url: https://git.stg.codes/stg.git/blobdiff_plain/1bf5ae378079e212f6918d09d87dec5420a0d6ec..f907011b4827e85763372cdea76944b3b1cc3fd2:/projects/stargazer/plugins/store/firebird/firebird_store.h diff --git a/projects/stargazer/plugins/store/firebird/firebird_store.h b/projects/stargazer/plugins/store/firebird/firebird_store.h index 55333888..a5905fef 100644 --- a/projects/stargazer/plugins/store/firebird/firebird_store.h +++ b/projects/stargazer/plugins/store/firebird/firebird_store.h @@ -29,23 +29,24 @@ #ifndef FIREBIRD_STORE_H #define FIREBIRD_STORE_H +#include #include #include #include -#include "base_store.h" -#include "stg_locker.h" -#include "ibpp.h" -//#include "firebird_database.h" +#include "stg/store.h" +#include "stg/locker.h" +#include "stg/ibpp.h" -struct ToLower -{ -char operator() (char c) const { return std::tolower(c); } +struct ToLower { + char operator() (char c) const { return std::tolower(c); } }; -extern "C" BASE_STORE * GetStore(); +extern "C" STORE * GetStore(); -class FIREBIRD_STORE : public BASE_STORE { +class STG_LOGGER; + +class FIREBIRD_STORE : public STORE { public: FIREBIRD_STORE(); virtual ~FIREBIRD_STORE(); @@ -73,7 +74,7 @@ public: double cash, double freeMb, const std::string & reason) const; - int WriteDetailedStat(const std::map & statTree, + int WriteDetailedStat(const TRAFF_STAT & statTree, time_t lastStat, const std::string & login) const; @@ -115,7 +116,11 @@ public: int RestoreService(SERVICE_CONF * sc, const std::string & name) const; int AddService(const std::string & name) const; int DelService(const std::string & name) const; + private: + FIREBIRD_STORE(const FIREBIRD_STORE & rvalue); + FIREBIRD_STORE & operator=(const FIREBIRD_STORE & rvalue); + std::string version; mutable std::string strError; mutable std::string db_server, db_database, db_user, db_password; @@ -124,13 +129,15 @@ private: mutable pthread_mutex_t mutex; mutable IBPP::TIL til; mutable IBPP::TLR tlr; + int schemaVersion; + STG_LOGGER & WriteServLog; int SaveStat(const USER_STAT & stat, const std::string & login, int year = 0, int month = 0) const; - - time_t ts2time_t(const IBPP::Timestamp & ts) const; - void time_t2ts(time_t t, IBPP::Timestamp * ts) const; - void ym2date(int year, int month, IBPP::Date * date) const; + int CheckVersion(); }; -#endif //FIREBIRD_STORE_H +time_t ts2time_t(const IBPP::Timestamp & ts); +void time_t2ts(time_t t, IBPP::Timestamp * ts); +void ym2date(int year, int month, IBPP::Date * date); +#endif //FIREBIRD_STORE_H