mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-15 20:51:29 +00:00
ClearOffline converted to QueryDatabase
This commit is contained in:
parent
f052c6004a
commit
1253fa2a25
@ -436,26 +436,19 @@ void PTimerList::ToVector(std::vector< std::pair<pTimerType, PersistentTimer *>
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool PTimerList::ClearOffline(Database *db, uint32 char_id, pTimerType type) {
|
bool PTimerList::ClearOffline(Database *db, uint32 char_id, pTimerType type) {
|
||||||
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 (offline): char %lu of type %u: '%s'\n", (unsigned long)char_id, type, query);
|
printf("Clearing timer (offline): char %lu of type %u: '%s'\n", (unsigned long)char_id, type, 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 PTimerList::ClearOffline, error: %s", errbuf);
|
LogFile->write(EQEMuLog::Error, "Error in PTimerList::ClearOffline, error: %s", results.ErrorMessage().c_str());
|
||||||
#endif
|
#endif
|
||||||
return(false);
|
return false;
|
||||||
}
|
}
|
||||||
safe_delete_array(query);
|
|
||||||
|
|
||||||
return(true);
|
|
||||||
|
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user