From ec47f8644c218d59e1f6c1aa03b35367ab95dc6f Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Tue, 8 Jul 2014 20:34:44 -0700 Subject: [PATCH] CheckUsedName converted to StringFormat --- common/database.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/common/database.cpp b/common/database.cpp index cb7651321..5637daa59 100644 --- a/common/database.cpp +++ b/common/database.cpp @@ -1295,17 +1295,14 @@ bool Database::UpdateName(const char* oldname, const char* newname) { // If the name is used or an error occurs, it returns false, otherwise it returns true bool Database::CheckUsedName(const char* name) { - char *query = nullptr; - - auto results = QueryDatabase(query, MakeAnyLenString(&query, "SELECT id FROM character_ where name='%s'", name)); + std::string query = StringFormat("SELECT id FROM character_ where name='%s'", name); + auto results = QueryDatabase(query); if (!results.Success()) { std::cerr << "Error in CheckUsedName query '" << query << "' " << results.ErrorMessage() << std::endl; - safe_delete_array(query); return false; } - safe_delete_array(query); if (results.RowCount() > 0) return false;