mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-15 12:31:31 +00:00
ListAllInstances converted to QueryDatabase
This commit is contained in:
parent
46c9fe46e9
commit
aab5ed2267
@ -1880,38 +1880,28 @@ void ZoneDatabase::UpdateKarma(uint32 acct_id, uint32 amount)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ZoneDatabase::ListAllInstances(Client* c, uint32 charid)
|
void ZoneDatabase::ListAllInstances(Client* client, uint32 charid)
|
||||||
{
|
{
|
||||||
if(!c)
|
if(!client)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
std::string query = StringFormat("SELECT instance_list.id, zone, version "
|
||||||
char* query = 0;
|
"FROM instance_list JOIN instance_list_player "
|
||||||
MYSQL_RES *result;
|
"ON instance_list.id = instance_list_player.id "
|
||||||
MYSQL_ROW row;
|
"WHERE instance_list_player.charid = %lu",
|
||||||
|
(unsigned long)charid);
|
||||||
|
auto results = QueryDatabase(query);
|
||||||
|
if (!results.Success())
|
||||||
|
return;
|
||||||
|
|
||||||
|
char name[64];
|
||||||
|
database.GetCharName(charid, name);
|
||||||
|
client->Message(0, "%s is part of the following instances:", name);
|
||||||
|
|
||||||
if (RunQuery(query,MakeAnyLenString(&query, "SELECT instance_list.id, zone, version FROM instance_list JOIN"
|
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||||
" instance_list_player ON instance_list.id = instance_list_player.id"
|
client->Message(0, "%s - id: %lu, version: %lu", database.GetZoneName(atoi(row[1])),
|
||||||
" WHERE instance_list_player.charid=%lu", (unsigned long)charid),errbuf,&result))
|
|
||||||
{
|
|
||||||
safe_delete_array(query);
|
|
||||||
|
|
||||||
char name[64];
|
|
||||||
database.GetCharName(charid, name);
|
|
||||||
c->Message(0, "%s is part of the following instances:", name);
|
|
||||||
while(row = mysql_fetch_row(result))
|
|
||||||
{
|
|
||||||
c->Message(0, "%s - id: %lu, version: %lu", database.GetZoneName(atoi(row[1])),
|
|
||||||
(unsigned long)atoi(row[0]), (unsigned long)atoi(row[2]));
|
(unsigned long)atoi(row[0]), (unsigned long)atoi(row[2]));
|
||||||
}
|
}
|
||||||
|
|
||||||
mysql_free_result(result);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
safe_delete_array(query);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ZoneDatabase::QGlobalPurge()
|
void ZoneDatabase::QGlobalPurge()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user