mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-12 17:51:28 +00:00
DeleteStalePlayerCorpses converted to QueryDatabase
This commit is contained in:
parent
e19db3f447
commit
e2c84c5f39
@ -1207,33 +1207,25 @@ ItemInst* SharedDatabase::CreateBaseItem(const Item_Struct* item, int16 charges)
|
|||||||
}
|
}
|
||||||
|
|
||||||
int32 SharedDatabase::DeleteStalePlayerCorpses() {
|
int32 SharedDatabase::DeleteStalePlayerCorpses() {
|
||||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
|
||||||
char *query = 0;
|
|
||||||
uint32 affected_rows = 0;
|
|
||||||
|
|
||||||
if(RuleB(Zone, EnableShadowrest))
|
if(RuleB(Zone, EnableShadowrest))
|
||||||
{
|
{
|
||||||
if (!RunQuery(query, MakeAnyLenString(&query, "UPDATE player_corpses SET IsBurried = 1 WHERE IsBurried=0 and "
|
std::string query = StringFormat("UPDATE player_corpses SET IsBurried = 1 WHERE IsBurried = 0 AND "
|
||||||
"(UNIX_TIMESTAMP() - UNIX_TIMESTAMP(timeofdeath)) > %d and not timeofdeath=0",
|
"(UNIX_TIMESTAMP() - UNIX_TIMESTAMP(timeofdeath)) > %d AND NOT timeofdeath = 0",
|
||||||
(RuleI(Character, CorpseDecayTimeMS) / 1000)), errbuf, 0, &affected_rows))
|
(RuleI(Character, CorpseDecayTimeMS) / 1000));
|
||||||
{
|
auto results = QueryDatabase(query);
|
||||||
safe_delete_array(query);
|
if (!results.Success())
|
||||||
return -1;
|
return -1;
|
||||||
}
|
|
||||||
}
|
return results.RowsAffected();
|
||||||
else
|
|
||||||
{
|
|
||||||
if (!RunQuery(query, MakeAnyLenString(&query, "Delete from player_corpses where (UNIX_TIMESTAMP() - "
|
|
||||||
"UNIX_TIMESTAMP(timeofdeath)) > %d and not timeofdeath=0", (RuleI(Character, CorpseDecayTimeMS) / 1000)),
|
|
||||||
errbuf, 0, &affected_rows))
|
|
||||||
{
|
|
||||||
safe_delete_array(query);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
safe_delete_array(query);
|
std::string query = StringFormat("DELETE FROM player_corpses WHERE (UNIX_TIMESTAMP() - UNIX_TIMESTAMP(timeofdeath)) > %d "
|
||||||
return affected_rows;
|
"AND NOT timeofdeath = 0", (RuleI(Character, CorpseDecayTimeMS) / 1000));
|
||||||
|
auto results = QueryDatabase(query);
|
||||||
|
if (!results.Success())
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
return results.RowsAffected();
|
||||||
}
|
}
|
||||||
|
|
||||||
int32 SharedDatabase::DeleteStalePlayerBackups() {
|
int32 SharedDatabase::DeleteStalePlayerBackups() {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user