]> git.stg.codes - stg.git/blobdiff - projects/stargazer/plugins/store/mysql/mysql_store.cpp
Fixed installation path for rlm_stg project.
[stg.git] / projects / stargazer / plugins / store / mysql / mysql_store.cpp
index 122c921478590184b82859eb3c44bb0f0d25fc70..79ec39e35f8edafb791f709d79ff88886e94592c 100644 (file)
@@ -102,17 +102,17 @@ PLUGIN_CREATOR<MYSQL_STORE> msc;
 //-----------------------------------------------------------------------------
 STORE * GetStore()
 {
 //-----------------------------------------------------------------------------
 STORE * GetStore()
 {
-return msc.GetStore();
+return msc.GetPlugin();
 }
 //-----------------------------------------------------------------------------
 MYSQL_STORE_SETTINGS::MYSQL_STORE_SETTINGS()
 }
 //-----------------------------------------------------------------------------
 MYSQL_STORE_SETTINGS::MYSQL_STORE_SETTINGS()
-    : settings(NULL)
+    : settings(NULL),
+      errorStr(),
+      dbUser(),
+      dbPass(),
+      dbName(),
+      dbHost()
 {
 {
-}
-//-----------------------------------------------------------------------------
-MYSQL_STORE_SETTINGS::~MYSQL_STORE_SETTINGS()
-{
-
 }
 //-----------------------------------------------------------------------------
 int MYSQL_STORE_SETTINGS::ParseParam(const vector<PARAM_VALUE> & moduleParams, 
 }
 //-----------------------------------------------------------------------------
 int MYSQL_STORE_SETTINGS::ParseParam(const vector<PARAM_VALUE> & moduleParams, 
@@ -151,54 +151,24 @@ if (ParseParam(s.moduleParams, "server", dbHost) < 0 &&
 return 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()
 //-----------------------------------------------------------------------------
 //-----------------------------------------------------------------------------
 MYSQL_STORE::MYSQL_STORE()
+    : errorStr(),
+      version("mysql_store v.0.67"),
+      storeSettings(),
+      settings(),
+      logger(GetPluginLogger(GetStgLogger(), "store_mysql"))
 {
 {
-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    MYSQL_STORE::MysqlQuery(const char* sQuery,MYSQL * sock) const
 {
-    int ret,i;
+    int ret;
 
     if( (ret = mysql_query(sock,sQuery)) )
     {
 
     if( (ret = mysql_query(sock,sQuery)) )
     {
-        for(i=0; i<RepitTimes; i++)
+        for(int i=0; i<RepitTimes; i++)
         {
             if( (ret = mysql_query(sock,sQuery)) )
                 ;//need to send error result
         {
             if( (ret = mysql_query(sock,sQuery)) )
                 ;//need to send error result
@@ -271,16 +241,6 @@ else
 return ret;
 }
 //-----------------------------------------------------------------------------
 return ret;
 }
 //-----------------------------------------------------------------------------
-const string & MYSQL_STORE::GetStrError() const
-{
-return errorStr;
-}
-//-----------------------------------------------------------------------------
-const string & MYSQL_STORE::GetVersion() const
-{
-return version;
-}
-//-----------------------------------------------------------------------------
 bool MYSQL_STORE::IsTablePresent(const string & str,MYSQL * sock)
 {
 MYSQL_RES* result;
 bool MYSQL_STORE::IsTablePresent(const string & str,MYSQL * sock)
 {
 MYSQL_RES* result;
@@ -1110,8 +1070,8 @@ int MYSQL_STORE::WriteUserDisconnect(const string & login,
                                      const DIR_TRAFF & sessionUp,
                                      const DIR_TRAFF & sessionDown,
                                      double cash,
                                      const DIR_TRAFF & sessionUp,
                                      const DIR_TRAFF & sessionDown,
                                      double cash,
-                                     double freeMb,
-                                     const std::string & reason) const
+                                     double /*freeMb*/,
+                                     const std::string & /*reason*/) const
 {
 string logStr = "Disconnect, ";
 stringstream sssu;
 {
 string logStr = "Disconnect, ";
 stringstream sssu;
@@ -1859,8 +1819,8 @@ MYSQL_RES *res;
 MYSQL_ROW row;
 MYSQL * sock;
 
 MYSQL_ROW row;
 MYSQL * sock;
 
-sprintf(qbuf,"SELECT * FROM messages WHERE login='%s' AND id=%lld LIMIT 1",
-    login.c_str(), id);
+sprintf(qbuf,"SELECT * FROM messages WHERE login='%s' AND id=%llu LIMIT 1",
+        login.c_str(), static_cast<unsigned long long>(id));
     
 if(MysqlGetQuery(qbuf,sock))
 {
     
 if(MysqlGetQuery(qbuf,sock))
 {