mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-13 18:51:29 +00:00
GetAdventureStats converted to QueryDatabase
This commit is contained in:
parent
28212ab8f8
commit
01991f4beb
@ -2679,18 +2679,21 @@ void Database::UpdateAdventureStatsEntry(uint32 char_id, uint8 theme, bool win)
|
||||
bool Database::GetAdventureStats(uint32 char_id, uint32 &guk_w, uint32 &mir_w, uint32 &mmc_w, uint32 &ruj_w,
|
||||
uint32 &tak_w, uint32 &guk_l, uint32 &mir_l, uint32 &mmc_l, uint32 &ruj_l, uint32 &tak_l)
|
||||
{
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
char *query = 0;
|
||||
MYSQL_RES *result;
|
||||
MYSQL_ROW row;
|
||||
char *query = nullptr;
|
||||
|
||||
if (RunQuery(query, MakeAnyLenString(&query, "SELECT `guk_wins`, `mir_wins`, `mmc_wins`, `ruj_wins`, `tak_wins`, "
|
||||
auto results = QueryDatabase(query, MakeAnyLenString(&query, "SELECT `guk_wins`, `mir_wins`, `mmc_wins`, `ruj_wins`, `tak_wins`, "
|
||||
"`guk_losses`, `mir_losses`, `mmc_losses`, `ruj_losses`, `tak_losses` FROM `adventure_stats` WHERE player_id=%u",
|
||||
char_id), errbuf, &result))
|
||||
{
|
||||
char_id));
|
||||
safe_delete_array(query);
|
||||
while((row = mysql_fetch_row(result)) != nullptr)
|
||||
{
|
||||
|
||||
if (!results.Success())
|
||||
return false;
|
||||
|
||||
if (results.RowCount() == 0)
|
||||
return false;
|
||||
|
||||
auto row = results.begin();
|
||||
|
||||
guk_w = atoi(row[0]);
|
||||
mir_w = atoi(row[1]);
|
||||
mmc_w = atoi(row[2]);
|
||||
@ -2701,16 +2704,9 @@ bool Database::GetAdventureStats(uint32 char_id, uint32 &guk_w, uint32 &mir_w, u
|
||||
mmc_l = atoi(row[7]);
|
||||
ruj_l = atoi(row[8]);
|
||||
tak_l = atoi(row[9]);
|
||||
}
|
||||
mysql_free_result(result);
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
safe_delete_array(query);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
uint32 Database::GetGuildDBIDByCharID(uint32 char_id) {
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user