X-Git-Url: https://git.stg.codes/stg.git/blobdiff_plain/641204dfbdb9fc870cdd2e7f9e3169a44693e7bf..39c6313308afb248b140d98b8052f1b484549df2:/projects/stargazer/plugins/store/mysql/mysql_store.h diff --git a/projects/stargazer/plugins/store/mysql/mysql_store.h b/projects/stargazer/plugins/store/mysql/mysql_store.h index 83a30e6a..d0d4f70d 100644 --- a/projects/stargazer/plugins/store/mysql/mysql_store.h +++ b/projects/stargazer/plugins/store/mysql/mysql_store.h @@ -1,56 +1,60 @@ /* - $Revision: 1.4 $ - $Date: 2010/01/19 11:07:57 $ + $Revision: 1.5 $ + $Date: 2010/10/07 19:45:52 $ */ -#ifndef FILE_STORE_H -#define FILE_STORE_H +#ifndef MYSQL_STORE_H +#define MYSQL_STORE_H + +#include #include -#include "base_settings.h" -#include "base_store.h" -#include "user_traff.h" -#include +#include "stg/module_settings.h" +#include "stg/store.h" +#include "stg/user_traff.h" using namespace std; //----------------------------------------------------------------------------- -extern "C" BASE_STORE * GetStore(); +extern "C" STORE * GetStore(); //----------------------------------------------------------------------------- -class MYSQL_STORE_SETTINGS//: public BASE_SETTINGS +class MYSQL_STORE_SETTINGS { public: MYSQL_STORE_SETTINGS(); - virtual ~MYSQL_STORE_SETTINGS(); + virtual ~MYSQL_STORE_SETTINGS() {} virtual int ParseSettings(const MODULE_SETTINGS & s); - virtual const string & GetStrError() const; + virtual const string & GetStrError() const { return errorStr; } - string GetDBUser() const; - string GetDBPassword() const; - string GetDBHost() const; - string GetDBName() const; + const string & GetDBUser() const { return dbUser; } + const string & GetDBPassword() const { return dbPass; } + const string & GetDBHost() const { return dbHost; } + const string & GetDBName() const { return dbName; } private: + MYSQL_STORE_SETTINGS(const MYSQL_STORE_SETTINGS & rvalue); + MYSQL_STORE_SETTINGS & operator=(const MYSQL_STORE_SETTINGS & rvalue); + const MODULE_SETTINGS * settings; int ParseParam(const vector & moduleParams, - const string & name, string & result); + const string & name, string & result); - string errorStr; + string errorStr; string dbUser; string dbPass; - string dbName; + string dbName; string dbHost; }; //----------------------------------------------------------------------------- -class MYSQL_STORE: public BASE_STORE +class MYSQL_STORE: public STORE { public: MYSQL_STORE(); - virtual ~MYSQL_STORE(); - virtual const string & GetStrError() const; + virtual ~MYSQL_STORE() {} + virtual const string & GetStrError() const { return errorStr; } //User virtual int GetUsersList(vector * usersList) const; @@ -77,7 +81,7 @@ public: double freeMb, const std::string & reason) const; - virtual int WriteDetailedStat(const map * statTree, + virtual int WriteDetailedStat(const map & statTree, time_t lastStat, const string & login) const; @@ -117,28 +121,27 @@ public: virtual int AddService(const string &) const {return 0;}; virtual int DelService(const string &) const {return 0;}; - //virtual BASE_SETTINGS * GetStoreSettings(); - virtual void SetSettings(const MODULE_SETTINGS & s); + virtual void SetSettings(const MODULE_SETTINGS & s) { settings = s; } virtual int ParseSettings(); - virtual const string & GetVersion() const; + virtual const string & GetVersion() const { return version; } private: + MYSQL_STORE(const MYSQL_STORE & rvalue); + MYSQL_STORE & operator=(const MYSQL_STORE & rvalue); + virtual int WriteLogString(const string & str, const string & login) const; - int GetAllParams(vector * ParamList, const string & table, const string & name) const; - int CheckAllTables(MYSQL * sock); - bool IsTablePresent(const string & str,MYSQL * sock); + int GetAllParams(vector * ParamList, const string & table, const string & name) const; + int CheckAllTables(MYSQL * sock); + bool IsTablePresent(const string & str,MYSQL * sock); mutable string errorStr; -// int Reconnect(); - int MysqlQuery(const char* sQuery,MYSQL * sock) const; + int MysqlQuery(const char* sQuery,MYSQL * sock) const; int MysqlGetQuery(const char * Query,MYSQL * & sock) const; int MysqlSetQuery(const char * Query) const; MYSQL * MysqlConnect() const ; string version; MYSQL_STORE_SETTINGS storeSettings; MODULE_SETTINGS settings; - //mutable MYSQL mysql; - //mutable MYSQL* sock; }; //----------------------------------------------------------------------------- -#endif //FILE_STORE_H +#endif