diff --git a/dAuthServer/AuthServer.cpp b/dAuthServer/AuthServer.cpp index 67590fa0..c7f51487 100644 --- a/dAuthServer/AuthServer.cpp +++ b/dAuthServer/AuthServer.cpp @@ -57,7 +57,7 @@ int main(int argc, char** argv) { Database::Connect(mysql_host, mysql_database, mysql_username, mysql_password); } catch (sql::SQLException& ex) { Game::logger->Log("AuthServer", "Got an error while connecting to the database: %s\n", ex.what()); - Database::Destroy(); + Database::Destroy("AuthServer"); delete Game::server; delete Game::logger; return 0; @@ -143,7 +143,7 @@ int main(int argc, char** argv) { } //Delete our objects here: - Database::Destroy(); + Database::Destroy("AuthServer"); delete Game::server; delete Game::logger; diff --git a/dChatServer/ChatServer.cpp b/dChatServer/ChatServer.cpp index 81904d41..7835737f 100644 --- a/dChatServer/ChatServer.cpp +++ b/dChatServer/ChatServer.cpp @@ -61,7 +61,7 @@ int main(int argc, char** argv) { } catch (sql::SQLException& ex) { Game::logger->Log("ChatServer", "Got an error while connecting to the database: %s\n", ex.what()); - Database::Destroy(); + Database::Destroy("ChatServer"); delete Game::server; delete Game::logger; return 0; @@ -150,7 +150,7 @@ int main(int argc, char** argv) { } //Delete our objects here: - Database::Destroy(); + Database::Destroy("ChatServer"); delete Game::server; delete Game::logger; diff --git a/dDatabase/Database.cpp b/dDatabase/Database.cpp index cdadbbaa..7ba138cf 100644 --- a/dDatabase/Database.cpp +++ b/dDatabase/Database.cpp @@ -26,9 +26,10 @@ void Database::Connect(const string& host, const string& database, const string& con->setClientOption("MYSQL_OPT_RECONNECT", &myTrue); } //Connect -void Database::Destroy() { +void Database::Destroy(std::string source) { if (!con) return; - Game::logger->Log("Database", "Destroying MySQL connection!\n"); + if (source != "") Game::logger->Log("Database", "Destroying MySQL connection from %s!\n", source.c_str()); + else Game::logger->Log("Database", "Destroying MySQL connection!\n"); con->close(); delete con; } //Destroy diff --git a/dDatabase/Database.h b/dDatabase/Database.h index 8e4cf5dc..6e458065 100644 --- a/dDatabase/Database.h +++ b/dDatabase/Database.h @@ -22,7 +22,7 @@ private: public: static void Connect(const std::string& host, const std::string& database, const std::string& username, const std::string& password); - static void Destroy(); + static void Destroy(std::string source=""); static sql::Statement* CreateStmt(); static sql::PreparedStatement* CreatePreppedStmt(const std::string& query); };