mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-12 17:51:28 +00:00
GetCharInfo converted to QueryDatabase
This commit is contained in:
parent
ea0c8f86fe
commit
845ed720b3
@ -955,38 +955,28 @@ bool BaseGuildManager::GetCharInfo(const char *char_name, CharGuildInfo &into) {
|
|||||||
return(false);
|
return(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
|
||||||
char *query = 0;
|
|
||||||
MYSQL_RES *result;
|
|
||||||
MYSQL_ROW row;
|
|
||||||
|
|
||||||
//escape our strings.
|
//escape our strings.
|
||||||
uint32 nl = strlen(char_name);
|
uint32 nl = strlen(char_name);
|
||||||
char *esc = new char[nl*2+1];
|
char *esc = new char[nl*2+1];
|
||||||
m_db->DoEscapeString(esc, char_name, nl);
|
m_db->DoEscapeString(esc, char_name, nl);
|
||||||
|
|
||||||
//load up the rank info for each guild.
|
//load up the rank info for each guild.
|
||||||
if (!m_db->RunQuery(query, MakeAnyLenString(&query,
|
std::string query = StringFormat(GuildMemberBaseQuery " WHERE c.name='%s'", esc);
|
||||||
GuildMemberBaseQuery " WHERE c.name='%s'", esc
|
safe_delete_array(esc);
|
||||||
), errbuf, &result)) {
|
auto results = m_db->QueryDatabase(query);
|
||||||
_log(GUILDS__ERROR, "Error loading guild member '%s': %s", query, errbuf);
|
if (!results.Success()) {
|
||||||
safe_delete_array(query);
|
_log(GUILDS__ERROR, "Error loading guild member '%s': %s", query.c_str(), results.ErrorMessage().c_str());
|
||||||
safe_delete_array(esc);
|
return false;
|
||||||
return(false);
|
|
||||||
}
|
}
|
||||||
safe_delete_array(query);
|
|
||||||
safe_delete_array(esc);
|
|
||||||
|
|
||||||
bool ret = true;
|
if (results.RowCount() == 0)
|
||||||
if ((row = mysql_fetch_row(result))) {
|
return false;
|
||||||
ProcessGuildMember(row, into);
|
|
||||||
_log(GUILDS__DB, "Retreived guild member info for char %s from the database", char_name);
|
|
||||||
} else {
|
|
||||||
ret = true;
|
|
||||||
}
|
|
||||||
mysql_free_result(result);
|
|
||||||
|
|
||||||
return(ret);
|
auto row = results.begin();
|
||||||
|
ProcessGuildMember(row, into);
|
||||||
|
_log(GUILDS__DB, "Retreived guild member info for char %s from the database", char_name);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user