mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-12 17:51:28 +00:00
DoesAccountContainAGuildLeader converted to QueryDatabase
This commit is contained in:
parent
f292cbc3e7
commit
b2ca66267e
@ -1261,25 +1261,17 @@ BaseGuildManager::GuildInfo::GuildInfo() {
|
|||||||
|
|
||||||
uint32 BaseGuildManager::DoesAccountContainAGuildLeader(uint32 AccountID)
|
uint32 BaseGuildManager::DoesAccountContainAGuildLeader(uint32 AccountID)
|
||||||
{
|
{
|
||||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
std::string query = StringFormat("SELECT guild_id FROM guild_members WHERE char_id IN "
|
||||||
char *query = 0;
|
"(SELECT id FROM character_ WHERE account_id = %i) AND rank = 2",
|
||||||
MYSQL_RES *result;
|
AccountID);
|
||||||
|
auto results = m_db->QueryDatabase(query);
|
||||||
if (!m_db->RunQuery(query,
|
if (!results.Success())
|
||||||
MakeAnyLenString(&query,
|
|
||||||
"select guild_id from guild_members where char_id in (select id from character_ where account_id = %i) and rank = 2",
|
|
||||||
AccountID), errbuf, &result))
|
|
||||||
{
|
{
|
||||||
_log(GUILDS__ERROR, "Error executing query '%s': %s", query, errbuf);
|
_log(GUILDS__ERROR, "Error executing query '%s': %s", query.c_str(), results.ErrorMessage().c_str());
|
||||||
safe_delete_array(query);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
safe_delete_array(query);
|
|
||||||
|
|
||||||
uint32 Rows = mysql_num_rows(result);
|
return results.RowCount();
|
||||||
mysql_free_result(result);
|
|
||||||
|
|
||||||
return Rows;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user