diff --git a/loginserver/database_mysql.cpp b/loginserver/database_mysql.cpp index 62f75d0af..e49795459 100644 --- a/loginserver/database_mysql.cpp +++ b/loginserver/database_mysql.cpp @@ -37,7 +37,7 @@ extern LoginServer server; * @param port * @param name */ -DatabaseMySQL::DatabaseMySQL( +Database::Database( std::string user, std::string pass, std::string host, @@ -97,7 +97,7 @@ DatabaseMySQL::DatabaseMySQL( /** * Deconstructor */ -DatabaseMySQL::~DatabaseMySQL() +Database::~Database() { if (database) { mysql_close(database); @@ -111,7 +111,7 @@ DatabaseMySQL::~DatabaseMySQL() * @param id * @return */ -bool DatabaseMySQL::GetLoginDataFromAccountInfo( +bool Database::GetLoginDataFromAccountInfo( const std::string &name, const std::string &loginserver, std::string &password, @@ -167,7 +167,7 @@ bool DatabaseMySQL::GetLoginDataFromAccountInfo( * @param user * @return */ -bool DatabaseMySQL::GetLoginTokenDataFromToken( +bool Database::GetLoginTokenDataFromToken( const std::string &token, const std::string &ip, unsigned int &db_account_id, @@ -229,7 +229,7 @@ bool DatabaseMySQL::GetLoginTokenDataFromToken( * @param loginserver * @return */ -unsigned int DatabaseMySQL::GetFreeID(const std::string &loginserver) +unsigned int Database::GetFreeID(const std::string &loginserver) { if (!database) { return false; @@ -273,7 +273,7 @@ unsigned int DatabaseMySQL::GetFreeID(const std::string &loginserver) * @param id * @return */ -bool DatabaseMySQL::CreateLoginData( +bool Database::CreateLoginData( const std::string &name, const std::string &password, const std::string &loginserver, @@ -290,7 +290,7 @@ bool DatabaseMySQL::CreateLoginData( * @param id * @return */ -bool DatabaseMySQL::CreateLoginDataWithID( +bool Database::CreateLoginDataWithID( const std::string &name, const std::string &password, const std::string &loginserver, @@ -326,7 +326,7 @@ bool DatabaseMySQL::CreateLoginDataWithID( * @param id * @return */ -bool DatabaseMySQL::DoesLoginServerAccountExist( +bool Database::DoesLoginServerAccountExist( const std::string &name, const std::string &password, const std::string &loginserver, @@ -357,7 +357,7 @@ bool DatabaseMySQL::DoesLoginServerAccountExist( * @param loginserver * @param hash */ -void DatabaseMySQL::UpdateLoginHash( +void Database::UpdateLoginHash( const std::string &name, const std::string &loginserver, const std::string &hash @@ -395,7 +395,7 @@ void DatabaseMySQL::UpdateLoginHash( * @param password * @return */ -bool DatabaseMySQL::GetWorldRegistration( +bool Database::GetWorldRegistration( std::string long_name, std::string short_name, unsigned int &id, @@ -484,7 +484,7 @@ bool DatabaseMySQL::GetWorldRegistration( * @param id * @param ip_address */ -void DatabaseMySQL::UpdateLSAccountData(unsigned int id, std::string ip_address) +void Database::UpdateLSAccountData(unsigned int id, std::string ip_address) { auto query = fmt::format( "UPDATE {0} SET LastIPAddress = '{2}', LastLoginDate = now() where LoginServerId = {3}", @@ -502,7 +502,7 @@ void DatabaseMySQL::UpdateLSAccountData(unsigned int id, std::string ip_address) * @param password * @param email */ -void DatabaseMySQL::UpdateLSAccountInfo( +void Database::UpdateLSAccountInfo( unsigned int id, std::string name, std::string password, @@ -527,7 +527,7 @@ void DatabaseMySQL::UpdateLSAccountInfo( * @param long_name * @param ip_address */ -void DatabaseMySQL::UpdateWorldRegistration(unsigned int id, std::string long_name, std::string ip_address) +void Database::UpdateWorldRegistration(unsigned int id, std::string long_name, std::string ip_address) { auto query = fmt::format( "UPDATE {0} SET ServerLastLoginDate = NOW(), ServerLastIPAddr = '{1}', ServerLongName = '{2}' WHERE ServerID = {3}", @@ -546,7 +546,7 @@ void DatabaseMySQL::UpdateWorldRegistration(unsigned int id, std::string long_na * @param id * @return */ -bool DatabaseMySQL::CreateWorldRegistration(std::string long_name, std::string short_name, unsigned int &id) +bool Database::CreateWorldRegistration(std::string long_name, std::string short_name, unsigned int &id) { if (!database) { return false; diff --git a/loginserver/database_mysql.h b/loginserver/database_mysql.h index 3b4c5c0cc..dab6de6ef 100644 --- a/loginserver/database_mysql.h +++ b/loginserver/database_mysql.h @@ -28,10 +28,10 @@ #include #include -class DatabaseMySQL : public DBcore { +class Database : public DBcore { public: - DatabaseMySQL() { database = nullptr; } + Database() { database = nullptr; } /** * Constructor, tries to set our database to connect to the supplied options. @@ -42,12 +42,12 @@ public: * @param port * @param name */ - DatabaseMySQL(std::string user, std::string pass, std::string host, std::string port, std::string name); + Database(std::string user, std::string pass, std::string host, std::string port, std::string name); /** * Destructor, frees our database if needed. */ - ~DatabaseMySQL(); + ~Database(); bool IsConnected() { return (database != nullptr); } /** diff --git a/loginserver/login_server.h b/loginserver/login_server.h index 4696e8120..9d3553ce1 100644 --- a/loginserver/login_server.h +++ b/loginserver/login_server.h @@ -38,7 +38,7 @@ public: LoginServer() : db(nullptr), server_manager(nullptr) { } EQ::JsonConfigFile config; - DatabaseMySQL *db; + Database *db; Options options; ServerManager *server_manager; ClientManager *client_manager; diff --git a/loginserver/main.cpp b/loginserver/main.cpp index 70b48ca54..217db1a2f 100644 --- a/loginserver/main.cpp +++ b/loginserver/main.cpp @@ -133,7 +133,7 @@ int main() */ Log(Logs::General, Logs::Login_Server, "MySQL Database Init."); - server.db = new DatabaseMySQL( + server.db = new Database( server.config.GetVariableString("database", "user", "root"), server.config.GetVariableString("database", "password", ""), server.config.GetVariableString("database", "host", "localhost"),