From 52730c039f769595a539e97ff8ed0361194a5b30 Mon Sep 17 00:00:00 2001 From: Zach Toogood Date: Fri, 20 Dec 2024 20:02:41 +0000 Subject: [PATCH] Modules: Replace p.stmt with query inside LoadLuaModules --- src/map/utils/moduleutils.cpp | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/src/map/utils/moduleutils.cpp b/src/map/utils/moduleutils.cpp index 6cb6b70ab57..dcd2a4f8d27 100644 --- a/src/map/utils/moduleutils.cpp +++ b/src/map/utils/moduleutils.cpp @@ -232,10 +232,21 @@ namespace moduleutils // we need to sanity check them here by checking the name and port against the database. if (parts.size() >= 3 && parts[0] == "xi" && parts[1] == "zones") { - auto zoneName = parts[2]; - auto currentPort = map_port == 0 ? settings::get("network.MAP_PORT") : map_port; + const auto zoneName = parts[2]; + const auto currentPort = map_port == 0 ? settings::get("network.MAP_PORT") : map_port; - auto rset = db::preparedStmt("SELECT `name`, zoneport FROM zone_settings WHERE `name` = ? AND zoneport = ?", zoneName, currentPort); + /* + TODO: Why doesn't preparedStmt work here? + + auto rset = db::preparedStmt("SELECT name, zoneport FROM zone_settings WHERE name = ? AND zoneport = ?", zoneName, currentPort); + + [debug] preparedStmt: SELECT name, zoneport FROM zone_settings WHERE name = ? AND zoneport = ? (db::preparedStmt::::()::::operator ():517) + [debug] binding 1: GM_Home (db::detail::bindValue:368) + [debug] binding 2: 54230 (db::detail::bindValue:368) + + But then no rows in the rset? + */ + const auto rset = db::query(fmt::format("SELECT name, zoneport FROM zone_settings WHERE name = {} AND zoneport = {}", zoneName, currentPort).c_str()); if (rset && rset->rowsCount() == 0) { DebugModules(fmt::format("{} does not appear to exist on this process.", zoneName));