X-Git-Url: https://git.stg.codes/stg.git/blobdiff_plain/33e9c4df9ccc56e63480168ec1dc301b05b9a18c..a39afcce76c3a02331385af96a474207d057fb09:/projects/stargazer/plugins/store/mysql/mysql_store.cpp diff --git a/projects/stargazer/plugins/store/mysql/mysql_store.cpp b/projects/stargazer/plugins/store/mysql/mysql_store.cpp index 567d6950..9d8f9c83 100644 --- a/projects/stargazer/plugins/store/mysql/mysql_store.cpp +++ b/projects/stargazer/plugins/store/mysql/mysql_store.cpp @@ -12,6 +12,7 @@ #include "stg/user_conf.h" #include "stg/user_stat.h" #include "stg/blowfish.h" +#include "stg/plugin_creator.h" #include "mysql_store.h" #define adm_enc_passwd "cjeifY8m3" @@ -95,42 +96,23 @@ int GetULongLongInt(const string & str, uint64_t * val, uint64_t defaultVal) return 0; } -class MYSQL_STORE_CREATOR -{ -private: - MYSQL_STORE * ms; - -public: - MYSQL_STORE_CREATOR() - : ms(new MYSQL_STORE()) - { - }; - ~MYSQL_STORE_CREATOR() - { - delete ms; - }; - - MYSQL_STORE * GetStore() - { - return ms; - }; -} msc; +PLUGIN_CREATOR msc; //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- STORE * GetStore() { -return msc.GetStore(); +return msc.GetPlugin(); } //----------------------------------------------------------------------------- MYSQL_STORE_SETTINGS::MYSQL_STORE_SETTINGS() - : settings(NULL) -{ -} -//----------------------------------------------------------------------------- -MYSQL_STORE_SETTINGS::~MYSQL_STORE_SETTINGS() + : settings(NULL), + errorStr(), + dbUser(), + dbPass(), + dbName(), + dbHost() { - } //----------------------------------------------------------------------------- int MYSQL_STORE_SETTINGS::ParseParam(const vector & moduleParams, @@ -169,54 +151,23 @@ if (ParseParam(s.moduleParams, "server", dbHost) < 0 && return 0; } //----------------------------------------------------------------------------- -const string & MYSQL_STORE_SETTINGS::GetStrError() const -{ -return errorStr; -} -//----------------------------------------------------------------------------- -string MYSQL_STORE_SETTINGS::GetDBUser() const -{ -return dbUser; -} -//----------------------------------------------------------------------------- -string MYSQL_STORE_SETTINGS::GetDBPassword() const -{ -return dbPass; -} -//----------------------------------------------------------------------------- -string MYSQL_STORE_SETTINGS::GetDBHost() const -{ -return dbHost; -} -//----------------------------------------------------------------------------- -string MYSQL_STORE_SETTINGS::GetDBName() const -{ -return dbName; -} -//----------------------------------------------------------------------------- //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- MYSQL_STORE::MYSQL_STORE() + : errorStr(), + version("mysql_store v.0.67"), + storeSettings(), + settings() { -version = "mysql_store v.0.67"; -}; -//----------------------------------------------------------------------------- -MYSQL_STORE::~MYSQL_STORE() -{ }; //----------------------------------------------------------------------------- -void MYSQL_STORE::SetSettings(const MODULE_SETTINGS & s) -{ -settings = s; -} -//----------------------------------------------------------------------------- int MYSQL_STORE::MysqlQuery(const char* sQuery,MYSQL * sock) const { - int ret,i; + int ret; if( (ret = mysql_query(sock,sQuery)) ) { - for(i=0; i(id)); if(MysqlGetQuery(qbuf,sock)) {