mirror of
https://github.com/liyunfan1223/azerothcore-wotlk.git
synced 2026-08-08 15:58:04 +00:00
fix(Scripts/Commands): escape string before query on go creature command (#23036)
This commit is contained in:
@@ -137,10 +137,7 @@ public:
|
|||||||
|
|
||||||
// Make sure we don't pass double quotes into the SQL query. Otherwise it causes a MySQL error
|
// Make sure we don't pass double quotes into the SQL query. Otherwise it causes a MySQL error
|
||||||
std::string str = name.data(); // Making subtractions to the last character does not with in string_view
|
std::string str = name.data(); // Making subtractions to the last character does not with in string_view
|
||||||
if (str.front() == '"')
|
WorldDatabase.EscapeString(str);
|
||||||
str = str.substr(1);
|
|
||||||
if (str.back() == '"')
|
|
||||||
str = str.substr(0, str.size() - 1);
|
|
||||||
|
|
||||||
QueryResult result = WorldDatabase.Query("SELECT entry FROM creature_template WHERE name = \"{}\" LIMIT 1", str);
|
QueryResult result = WorldDatabase.Query("SELECT entry FROM creature_template WHERE name = \"{}\" LIMIT 1", str);
|
||||||
if (!result)
|
if (!result)
|
||||||
|
|||||||
Reference in New Issue
Block a user