mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-12 09:31:30 +00:00
LoadAccountFlags converted to QueryDatabase
This commit is contained in:
parent
7f92e96ae7
commit
eb98563fa1
@ -7738,28 +7738,21 @@ void Client::SendFactionMessage(int32 tmpvalue, int32 faction_id, int32 totalval
|
|||||||
|
|
||||||
void Client::LoadAccountFlags()
|
void Client::LoadAccountFlags()
|
||||||
{
|
{
|
||||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
|
||||||
char *query = 0;
|
|
||||||
MYSQL_RES *result;
|
|
||||||
MYSQL_ROW row;
|
|
||||||
|
|
||||||
accountflags.clear();
|
accountflags.clear();
|
||||||
MakeAnyLenString(&query, "SELECT p_flag, p_value FROM account_flags WHERE p_accid = '%d'", account_id);
|
|
||||||
if(database.RunQuery(query, strlen(query), errbuf, &result))
|
std::string query = StringFormat("SELECT p_flag, p_value FROM account_flags WHERE p_accid = '%d'", account_id);
|
||||||
{
|
auto results = database.QueryDatabase(query);
|
||||||
while(row = mysql_fetch_row(result))
|
if (!results.Success()) {
|
||||||
{
|
std::cerr << "Error in LoadAccountFlags query '" << query << "' " << results.ErrorMessage() << std::endl;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||||
std::string fname(row[0]);
|
std::string fname(row[0]);
|
||||||
std::string fval(row[1]);
|
std::string fval(row[1]);
|
||||||
accountflags[fname] = fval;
|
accountflags[fname] = fval;
|
||||||
}
|
}
|
||||||
mysql_free_result(result);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
std::cerr << "Error in LoadAccountFlags query '" << query << "' " << errbuf << std::endl;
|
|
||||||
}
|
|
||||||
safe_delete_array(query);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Client::SetAccountFlag(std::string flag, std::string val)
|
void Client::SetAccountFlag(std::string flag, std::string val)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user