Skip to content

Commit

Permalink
Modules: Replace p.stmt with query inside LoadLuaModules
Browse files Browse the repository at this point in the history
  • Loading branch information
zach2good committed Dec 20, 2024
1 parent 96e822c commit 52730c0
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions src/map/utils/moduleutils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<uint16>("network.MAP_PORT") : map_port;
const auto zoneName = parts[2];
const auto currentPort = map_port == 0 ? settings::get<uint16>("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::<lambda_1>::()::<lambda_1>::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));
Expand Down

0 comments on commit 52730c0

Please sign in to comment.