fix(editor): escape user strings in server module map/zone/tele SQL

The map_dbc, area_table_dbc, and game_tele INSERTs previously
embedded mapName/displayName/manifest.mapName as raw strings — a
zone called "King's Land" or anything containing a single quote
would emit malformed SQL that AzerothCore would reject. Promotes
the existing escapeSql helper to a public SQLExporter::escape and
uses it in all three INSERTs.
This commit is contained in:
Kelsi 2026-05-06 06:46:58 -07:00
parent cc1e1cb7fa
commit a8464fc367
3 changed files with 22 additions and 7 deletions

View file

@ -10,8 +10,9 @@
namespace wowee {
namespace editor {
static std::string escapeSql(const std::string& s) {
std::string SQLExporter::escape(const std::string& s) {
std::string out;
out.reserve(s.size());
for (char c : s) {
if (c == '\'') out += "''";
else if (c == '\\') out += "\\\\";
@ -20,6 +21,8 @@ static std::string escapeSql(const std::string& s) {
return out;
}
static std::string escapeSql(const std::string& s) { return SQLExporter::escape(s); }
bool SQLExporter::exportCreatures(const std::vector<CreatureSpawn>& spawns,
const std::string& path,
uint32_t mapId,