X-Git-Url: https://git.stg.codes/stg.git/blobdiff_plain/73f478b15a61946b2c78843b968ba69b95551c09..b03704fded1595009a39b4d935f938258fe08875:/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 38ff457d..d9c6af24 100644 --- a/projects/stargazer/plugins/store/firebird/firebird_store.h +++ b/projects/stargazer/plugins/store/firebird/firebird_store.h @@ -32,7 +32,6 @@ #include #include #include -#include #include "stg/store.h" #include "stg/locker.h" @@ -40,11 +39,9 @@ #include "stg/logger.h" struct ToLower { - char operator() (char c) const { return std::tolower(c); } + char operator() (char c) const { return static_cast(std::tolower(c)); } }; -extern "C" STORE * GetStore(); - class FIREBIRD_STORE : public STORE { public: FIREBIRD_STORE(); @@ -93,7 +90,7 @@ public: int GetTariffsList(std::vector * tariffsList) const; int AddTariff(const std::string & name) const; - int DelTariff(const string & name) const; + int DelTariff(const std::string & name) const; int SaveTariff(const TARIFF_DATA & td, const std::string & tariffName) const; int RestoreTariff(TARIFF_DATA * td, const std::string & tariffName) const; @@ -103,12 +100,12 @@ public: int AddCorp(const std::string & name) const; int DelCorp(const std::string & name) const; - inline void SetSettings(const MODULE_SETTINGS & s) { settings = s; }; + inline void SetSettings(const MODULE_SETTINGS & s) { settings = s; } int ParseSettings(); - inline const string & GetStrError() const { return strError; }; + inline const std::string & GetStrError() const { return strError; } - inline const string & GetVersion() const { return version; }; + inline const std::string & GetVersion() const { return version; } int GetServicesList(std::vector * servicesList) const; int SaveService(const SERVICE_CONF & sc) const; @@ -128,13 +125,24 @@ private: mutable pthread_mutex_t mutex; IBPP::TIL til; IBPP::TLR tlr; + int schemaVersion; PLUGIN_LOGGER logger; int SaveStat(const USER_STAT & stat, const std::string & login, int year = 0, int month = 0) const; + int CheckVersion(); }; 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); +template +inline +T Get(IBPP::Statement st, size_t pos) +{ + T value; + st->Get(pos, value); + return value; +} + #endif //FIREBIRD_STORE_H