From e731cfd48d15f51b81f7466ece7529e1d9d4d611 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Thu, 21 Aug 2014 15:32:20 -0700 Subject: [PATCH] RemoveTempFactions converted to QueryDatabase --- zone/zonedb.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/zone/zonedb.cpp b/zone/zonedb.cpp index f0c2f2afc..bfad721e2 100644 --- a/zone/zonedb.cpp +++ b/zone/zonedb.cpp @@ -2162,14 +2162,15 @@ void ZoneDatabase::SavePetInfo(Client *client) { } -void ZoneDatabase::RemoveTempFactions(Client *c){ - char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; +void ZoneDatabase::RemoveTempFactions(Client *client) { + + std::string query = StringFormat("DELETE FROM faction_values " + "WHERE temp = 1 AND char_id = %u", + client->CharacterID()); + auto results = QueryDatabase(query); + if (!results.Success()) + std::cerr << "Error in RemoveTempFactions query '" << query << "' " << results.ErrorMessage() << std::endl; - if (!RunQuery(query, MakeAnyLenString(&query, "DELETE FROM faction_values WHERE temp = 1 AND char_id=%u", c->CharacterID()), errbuf)) { - std::cerr << "Error in RemoveTempFactions query '" << query << "' " << errbuf << std::endl; - } - safe_delete_array(query); } void ZoneDatabase::LoadPetInfo(Client *c) {