]> git.stg.codes - stg.git/blobdiff - projects/stargazer/plugins/store/mysql/mysql_store.cpp
DB store plugin params unified
[stg.git] / projects / stargazer / plugins / store / mysql / mysql_store.cpp
index f62a846f723988ff721b5b23ceb42f1aba5ffd53..54e13f864deaebe8eeeca50420f821b3b16d897c 100644 (file)
@@ -8,11 +8,11 @@
 #include <mysql.h>
 #include <errmsg.h>
 
-#include "user_ips.h"
-#include "user_conf.h"
-#include "user_stat.h"
+#include "stg/user_ips.h"
+#include "stg/user_conf.h"
+#include "stg/user_stat.h"
+#include "stg/blowfish.h"
 #include "mysql_store.h"
-#include "blowfish.h"
 
 #define adm_enc_passwd "cjeifY8m3"
 char qbuf[4096];
@@ -118,7 +118,7 @@ public:
 //-----------------------------------------------------------------------------
 //-----------------------------------------------------------------------------
 //-----------------------------------------------------------------------------
-BASE_STORE * GetStore()
+STORE * GetStore()
 {
 return msc.GetStore();
 }
@@ -153,13 +153,17 @@ return 0;
 //-----------------------------------------------------------------------------
 int MYSQL_STORE_SETTINGS::ParseSettings(const MODULE_SETTINGS & s)
 {
-if (ParseParam(s.moduleParams, "dbuser", dbUser) < 0)
+if (ParseParam(s.moduleParams, "user", dbUser) < 0 &&
+    ParseParam(s.moduleParams, "dbuser", dbUser) < 0)
     return -1;
-if (ParseParam(s.moduleParams, "rootdbpass", dbPass) < 0)
+if (ParseParam(s.moduleParams, "password", dbPass) < 0 &&
+    ParseParam(s.moduleParams, "rootdbpass", dbPass) < 0)
     return -1;
-if (ParseParam(s.moduleParams, "dbname", dbName) < 0)
+if (ParseParam(s.moduleParams, "database", dbName) < 0 &&
+    ParseParam(s.moduleParams, "dbname", dbName) < 0)
     return -1;
-if (ParseParam(s.moduleParams, "dbhost", dbHost) < 0)
+if (ParseParam(s.moduleParams, "server", dbHost) < 0 &&
+    ParseParam(s.moduleParams, "dbhost", dbHost) < 0)
     return -1;
 
 return 0;
@@ -804,7 +808,7 @@ try
     {
     i = StrToIPS(ipStr);
     }
-catch (string s)
+catch (const string & s)
     {
     mysql_free_result(res);
     errorStr = "User \'" + login + "\' data not read. Parameter IP address. " + s;