Clear converted to QueryDatabase

This commit is contained in:
Arthur Ice 2014-08-18 13:12:52 -07:00
parent 3cde8d9af8
commit f052c6004a

View File

@ -346,27 +346,19 @@ bool PTimerList::Store(Database *db) {
bool PTimerList::Clear(Database *db) { bool PTimerList::Clear(Database *db) {
_list.clear(); _list.clear();
char errbuf[MYSQL_ERRMSG_SIZE]; std::string query = StringFormat("DELETE FROM timers WHERE char_id=%lu ", (unsigned long)_char_id);
char *query = 0;
uint32 qlen = 0;
qlen = MakeAnyLenString(&query, "DELETE FROM timers "
" WHERE char_id=%lu ", (unsigned long)_char_id);
#ifdef DEBUG_PTIMERS #ifdef DEBUG_PTIMERS
printf("Storing all timers for char %lu: '%s'\n", (unsigned long)_char_id, query); printf("Storing all timers for char %lu: '%s'\n", (unsigned long)_char_id, query.c_str());
#endif #endif
auto results = db->QueryDatabase(query);
if (!db->RunQuery(query, qlen, errbuf)) { if (!results.Success()) {
safe_delete_array(query);
#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;
} }
void PTimerList::Start(pTimerType type, uint32 duration) { void PTimerList::Start(pTimerType type, uint32 duration) {