mirror of
https://github.com/EQEmu/Server.git
synced 2026-02-16 12:52:25 +00:00
VersionFromInstanceID converted to QueryDatabase
This commit is contained in:
parent
4541bd5369
commit
903a3a9060
@ -2231,35 +2231,20 @@ uint32 Database::ZoneIDFromInstanceID(uint16 instance_id)
|
||||
|
||||
uint32 Database::VersionFromInstanceID(uint16 instance_id)
|
||||
{
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
char *query = 0;
|
||||
MYSQL_RES *result;
|
||||
MYSQL_ROW row;
|
||||
uint32 ret;
|
||||
char *query = nullptr;
|
||||
|
||||
if (RunQuery(query, MakeAnyLenString(&query, "SELECT version FROM instance_list where id=%u", instance_id),
|
||||
errbuf, &result))
|
||||
{
|
||||
safe_delete_array(query);
|
||||
if (mysql_num_rows(result) != 0)
|
||||
{
|
||||
row = mysql_fetch_row(result);
|
||||
ret = atoi(row[0]);
|
||||
mysql_free_result(result);
|
||||
return ret;
|
||||
}
|
||||
else
|
||||
{
|
||||
mysql_free_result(result);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
safe_delete_array(query);
|
||||
auto results = QueryDatabase(query, MakeAnyLenString(&query, "SELECT version FROM instance_list where id=%u", instance_id));
|
||||
safe_delete_array(query);
|
||||
|
||||
if (!results.Success())
|
||||
return 0;
|
||||
}
|
||||
return 0;
|
||||
|
||||
if (results.RowCount() == 0)
|
||||
return 0;
|
||||
|
||||
auto row = results.begin();
|
||||
|
||||
return atoi(row[0]);
|
||||
}
|
||||
|
||||
uint32 Database::GetTimeRemainingInstance(uint16 instance_id, bool &is_perma)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user