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)
{
char errbuf[MYSQL_ERRMSG_SIZE];
char *query = 0;
MYSQL_RES *result;
MYSQL_ROW row;
bool ret;
char *query = nullptr;
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);
row = mysql_fetch_row(result);
if(row)
{
ret = (atoi(row[0]) == 1) ? true : false;
}
else
{
mysql_free_result(result);
if (!results.Success())
return false;
}
}
else
{
safe_delete_array(query);
if (results.RowCount() == 0)
return false;
}
return ret;
auto row = results.begin();
return (atoi(row[0]) == 1) ? true : false;
}
void Database::UpdateAdventureStatsEntry(uint32 char_id, uint8 theme, bool win)