Skip to content

Commit

Permalink
Use macros so we can use more properties (#1640)
Browse files Browse the repository at this point in the history
makes it so we can adjust many more settings since the segfault only happens in windows debug, why remove the functionality for all users?
Tested that windows debug, windows RelWithDebInfo and ubuntu default all build and run without issues (will contact luxaritas about pipe testing)
  • Loading branch information
EmosewaMC authored Oct 30, 2024
1 parent bfe6900 commit af94327
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions dDatabase/GameDatabase/MySQL/MySQLDatabase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include "Game.h"
#include "dConfig.h"
#include "Logger.h"
#include "dPlatforms.h"

namespace {
std::string databaseName;
Expand Down Expand Up @@ -39,14 +40,13 @@ void MySQLDatabase::Connect() {
properties["autoReconnect"] = "true";

databaseName = Game::config->GetValue("mysql_database").c_str();

// `connect(const Properties& props)` segfaults in windows debug, but
// `connect(const SQLString& host, const SQLString& user, const SQLString& pwd)` doesn't handle pipes/unix sockets correctly
if (properties.find("localSocket") != properties.end() || properties.find("pipe") != properties.end()) {
con = driver->connect(properties);
} else {
#if defined(DARKFLAME_PLATFORM_WIN32) && defined(_DEBUG)
con = driver->connect(properties["hostName"].c_str(), properties["user"].c_str(), properties["password"].c_str());
}
#else
con = driver->connect(properties);
#endif
con->setSchema(databaseName.c_str());
}

Expand Down

0 comments on commit af94327

Please sign in to comment.