From 02bc3dd84fb8560c8486136eca346a3e8f87a428 Mon Sep 17 00:00:00 2001 From: Eduardo Dantas Date: Sun, 24 Nov 2024 00:43:21 -0300 Subject: [PATCH] fix: remove db --- src/creatures/players/components/player_forge_history.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/creatures/players/components/player_forge_history.cpp b/src/creatures/players/components/player_forge_history.cpp index f2728395912..ac79f20a862 100644 --- a/src/creatures/players/components/player_forge_history.cpp +++ b/src/creatures/players/components/player_forge_history.cpp @@ -63,8 +63,6 @@ bool PlayerForgeHistory::save() { auto playerGUID = m_player.getGUID(); - Database &db = Database::getInstance(); - if (!m_removedHistoryIds.empty()) { std::string idsToDelete = fmt::format("{}", fmt::join(m_removedHistoryIds, ", ")); std::string deleteQuery = fmt::format( @@ -72,7 +70,7 @@ bool PlayerForgeHistory::save() { playerGUID, idsToDelete ); - if (!db.executeQuery(deleteQuery)) { + if (!g_database().executeQuery(deleteQuery)) { g_logger().error("Failed to delete forge history entries for player with ID: {}", playerGUID); return false; } @@ -84,7 +82,7 @@ bool PlayerForgeHistory::save() { insertQuery.upsert({ "action_type", "description", "done_at", "is_success" }); for (const auto &history : m_modifiedHistory) { - auto row = fmt::format("{}, {}, {}, {}, {}, {}", history.id, playerGUID, history.actionType, db.escapeString(history.description), history.createdAt, history.success ? 1 : 0); + auto row = fmt::format("{}, {}, {}, {}, {}, {}", history.id, playerGUID, history.actionType, g_database().escapeString(history.description), history.createdAt, history.success ? 1 : 0); if (!insertQuery.addRow(row)) { g_logger().warn("Failed to add forge history entry for player with ID: {}", playerGUID);