From cbed61db7e61e57b912edcbd4000e05b4d528755 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Mon, 18 Aug 2014 12:37:33 -0700 Subject: [PATCH] Clear converted to QueryDatabase --- common/ptimer.cpp | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/common/ptimer.cpp b/common/ptimer.cpp index c099832ed..d8231c4ca 100644 --- a/common/ptimer.cpp +++ b/common/ptimer.cpp @@ -179,28 +179,23 @@ bool PersistentTimer::Store(Database *db) { } bool PersistentTimer::Clear(Database *db) { - char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; - uint32 qlen = 0; - - qlen = MakeAnyLenString(&query, "DELETE FROM timers " - " WHERE char_id=%lu AND type=%u ", - (unsigned long)_char_id, _type); + std::string query = StringFormat("DELETE FROM timers " + "WHERE char_id = %lu AND type = %u ", + (unsigned long)_char_id, _type); #ifdef DEBUG_PTIMERS - printf("Clearing timer: char %lu of type %u: '%s'\n", (unsigned long)_char_id, _type, query); + printf("Clearing timer: char %lu of type %u: '%s'\n", (unsigned long)_char_id, _type, query.c_str()); #endif - if (!db->RunQuery(query, qlen, errbuf)) { - safe_delete_array(query); + auto results = db->QueryDatabase(query); + if (!results.Success()) { #if EQDEBUG > 5 - LogFile->write(EQEMuLog::Error, "Error in PersistentTimer::Clear, error: %s", errbuf); + LogFile->write(EQEMuLog::Error, "Error in PersistentTimer::Clear, error: %s", results.ErrorMessage().c_str()); #endif - return(false); + return false; } - safe_delete_array(query); - return(true); + return true; }