GlobalInstance converted to QueryDatabase

This commit is contained in:
Arthur Ice 2014-07-06 15:21:59 -07:00 committed by Arthur Ice
parent 167ce7829c
commit 22d06bc3d1

View File

@ -2604,32 +2604,20 @@ void Database::SetInstanceDuration(uint16 instance_id, uint32 new_duration)
bool Database::GlobalInstance(uint16 instance_id) bool Database::GlobalInstance(uint16 instance_id)
{ {
char errbuf[MYSQL_ERRMSG_SIZE]; char *query = nullptr;
char *query = 0;
MYSQL_RES *result;
MYSQL_ROW row;
bool ret;
if (RunQuery(query, MakeAnyLenString(&query, "SELECT is_global from instance_list where id=%u LIMIT 1", instance_id), errbuf, &result)) auto results = QueryDatabase(query, MakeAnyLenString(&query, "SELECT is_global from instance_list where id=%u LIMIT 1", instance_id));
{ safe_delete_array(query);
safe_delete_array(query);
row = mysql_fetch_row(result); if (!results.Success())
if(row)
{
ret = (atoi(row[0]) == 1) ? true : false;
}
else
{
mysql_free_result(result);
return false;
}
}
else
{
safe_delete_array(query);
return false; return false;
}
return ret; if (results.RowCount() == 0)
return false;
auto row = results.begin();
return (atoi(row[0]) == 1) ? true : false;
} }
void Database::UpdateAdventureStatsEntry(uint32 char_id, uint8 theme, bool win) void Database::UpdateAdventureStatsEntry(uint32 char_id, uint8 theme, bool win)