*/
/*
- * Author : Maxim Mamontov <faust@stargazer.dp.ua>
+ * Author : Maksym Mamontov <stg@madf.info>
*/
/*
#include <ctime>
#include <string>
#include <vector>
-#include <map>
#include "stg/store.h"
#include "stg/locker.h"
#include "stg/ibpp.h"
+#include "stg/logger.h"
struct ToLower {
- char operator() (char c) const { return std::tolower(c); }
+ char operator() (char c) const { return static_cast<char>(std::tolower(c)); }
};
-extern "C" STORE * GetStore();
-
class FIREBIRD_STORE : public STORE {
public:
FIREBIRD_STORE();
int GetTariffsList(std::vector<std::string> * 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;
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<std::string> * servicesList) const;
int SaveService(const SERVICE_CONF & sc) const;
std::string version;
mutable std::string strError;
- mutable std::string db_server, db_database, db_user, db_password;
+ std::string db_server, db_database, db_user, db_password;
MODULE_SETTINGS settings;
mutable IBPP::Database db;
mutable pthread_mutex_t mutex;
- mutable IBPP::TIL til;
- mutable IBPP::TLR tlr;
+ 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 <typename T>
+inline
+T Get(IBPP::Statement st, size_t pos)
+{
+ T value;
+ st->Get(pos, value);
+ return value;
+}
+
#endif //FIREBIRD_STORE_H