mirror of
https://github.com/EQEmu/Server.git
synced 2026-03-22 05:32:26 +00:00
KeyRingLoad converted to QueryDatabase
This commit is contained in:
parent
16d47a2c47
commit
2a4a5b1beb
@ -3998,25 +3998,17 @@ void Client::SendWindow(uint32 PopupID, uint32 NegativeID, uint32 Buttons, const
|
|||||||
|
|
||||||
void Client::KeyRingLoad()
|
void Client::KeyRingLoad()
|
||||||
{
|
{
|
||||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
std::string query = StringFormat("SELECT item_id FROM keyring "
|
||||||
char *query = 0;
|
"WHERE char_id = '%i' ORDER BY item_id", character_id);
|
||||||
MYSQL_RES *result;
|
auto results = database.QueryDatabase(query);
|
||||||
MYSQL_ROW row;
|
if (!results.Success()) {
|
||||||
query = new char[256];
|
std::cerr << "Error in Client::KeyRingLoad query '" << query << "' " << results.ErrorMessage() << std::endl;
|
||||||
|
|
||||||
sprintf(query, "SELECT item_id FROM keyring WHERE char_id='%i' ORDER BY item_id",character_id);
|
|
||||||
if (database.RunQuery(query, strlen(query), errbuf, &result))
|
|
||||||
{
|
|
||||||
safe_delete_array(query);
|
|
||||||
while(0 != (row = mysql_fetch_row(result))){
|
|
||||||
keyring.push_back(atoi(row[0]));
|
|
||||||
}
|
|
||||||
mysql_free_result(result);
|
|
||||||
}else {
|
|
||||||
std::cerr << "Error in Client::KeyRingLoad query '" << query << "' " << errbuf << std::endl;
|
|
||||||
safe_delete_array(query);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (auto row = results.begin(); row != results.end(); ++row)
|
||||||
|
keyring.push_back(atoi(row[0]));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Client::KeyRingAdd(uint32 item_id)
|
void Client::KeyRingAdd(uint32 item_id)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user