Clear converted to QueryDatabase

This commit is contained in:
Arthur Ice 2014-08-18 12:37:33 -07:00
parent e360ba5209
commit cbed61db7e

View File

@ -179,28 +179,23 @@ bool PersistentTimer::Store(Database *db) {
} }
bool PersistentTimer::Clear(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 #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 #endif
if (!db->RunQuery(query, qlen, errbuf)) { auto results = db->QueryDatabase(query);
safe_delete_array(query); if (!results.Success()) {
#if EQDEBUG > 5 #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 #endif
return(false); return false;
} }
safe_delete_array(query);
return(true); return true;
} }