Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make changes to allow Windows to run under a debug environment #804

Merged
merged 2 commits into from
Nov 3, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions dDatabase/Database.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ void Database::Connect(const string& host, const string& database, const string&
}

void Database::Connect() {
con = driver->connect(Database::props);
con->setSchema(Database::database);
con = driver->connect(Database::props["hostName"].c_str(), Database::props["user"].c_str(), Database::props["password"].c_str());
con->setSchema(Database::database.c_str());
}

void Database::Destroy(std::string source, bool log) {
Expand Down
10 changes: 5 additions & 5 deletions dDatabase/MigrationRunner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ void MigrationRunner::RunMigrations() {
}

stmt = Database::CreatePreppedStmt("SELECT name FROM migration_history WHERE name = ?;");
stmt->setString(1, migration.name);
stmt->setString(1, migration.name.c_str());
auto* res = stmt->executeQuery();
bool doExit = res->next();
delete res;
Expand All @@ -56,11 +56,11 @@ void MigrationRunner::RunMigrations() {
if (migration.name == "5_brick_model_sd0.sql") {
runSd0Migrations = true;
} else {
finalSQL.append(migration.data);
finalSQL.append(migration.data.c_str());
}

stmt = Database::CreatePreppedStmt("INSERT INTO migration_history (name) VALUES (?);");
stmt->setString(1, migration.name);
stmt->setString(1, migration.name.c_str());
stmt->execute();
delete stmt;
}
Expand All @@ -76,7 +76,7 @@ void MigrationRunner::RunMigrations() {
for (auto& query : migration) {
try {
if (query.empty()) continue;
simpleStatement->execute(query);
simpleStatement->execute(query.c_str());
} catch (sql::SQLException& e) {
Game::logger->Log("MigrationRunner", "Encountered error running migration: %s", e.what());
}
Expand All @@ -103,7 +103,7 @@ void MigrationRunner::RunSQLiteMigrations() {
if (migration.data.empty()) continue;

stmt = Database::CreatePreppedStmt("SELECT name FROM migration_history WHERE name = ?;");
stmt->setString(1, migration.name);
stmt->setString(1, migration.name.c_str());
auto* res = stmt->executeQuery();
bool doExit = res->next();
delete res;
Expand Down
4 changes: 2 additions & 2 deletions dMasterServer/MasterServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -237,15 +237,15 @@ int main(int argc, char** argv) {
//If we found a server, update it's IP and port to the current one.
if (result->next()) {
auto* updateStatement = Database::CreatePreppedStmt("UPDATE `servers` SET `ip` = ?, `port` = ? WHERE `id` = ?");
updateStatement->setString(1, master_server_ip);
updateStatement->setString(1, master_server_ip.c_str());
updateStatement->setInt(2, Game::server->GetPort());
updateStatement->setInt(3, result->getInt("id"));
updateStatement->execute();
delete updateStatement;
} else {
//If we didn't find a server, create one.
auto* insertStatement = Database::CreatePreppedStmt("INSERT INTO `servers` (`name`, `ip`, `port`, `state`, `version`) VALUES ('master', ?, ?, 0, 171023)");
insertStatement->setString(1, master_server_ip);
insertStatement->setString(1, master_server_ip.c_str());
insertStatement->setInt(2, Game::server->GetPort());
insertStatement->execute();
delete insertStatement;
Expand Down