mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-15 08:21:28 +00:00
GetAccountFromID converted to QueryDatabase
This commit is contained in:
parent
e20e5e59b8
commit
397f7050ef
@ -1380,25 +1380,27 @@ uint32 Database::GetAccountIDFromLSID(uint32 iLSID, char* oAccountName, int16* o
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Database::GetAccountFromID(uint32 id, char* oAccountName, int16* oStatus) {
|
void Database::GetAccountFromID(uint32 id, char* oAccountName, int16* oStatus) {
|
||||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
char *query = nullptr;
|
||||||
char *query = 0;
|
|
||||||
MYSQL_RES *result;
|
|
||||||
MYSQL_ROW row;
|
|
||||||
|
|
||||||
if (RunQuery(query, MakeAnyLenString(&query, "SELECT name, status FROM account WHERE id=%i", id), errbuf, &result))
|
auto results = QueryDatabase(query, MakeAnyLenString(&query, "SELECT name, status FROM account WHERE id=%i", id));
|
||||||
|
|
||||||
|
if (!results.Success())
|
||||||
{
|
{
|
||||||
if (mysql_num_rows(result) == 1) {
|
std::cerr << "Error in GetAccountFromID query '" << query << "' " << results.ErrorMessage() << std::endl;
|
||||||
row = mysql_fetch_row(result);
|
safe_delete_array(query);
|
||||||
if (oAccountName)
|
return;
|
||||||
strcpy(oAccountName, row[0]);
|
|
||||||
if (oStatus)
|
|
||||||
*oStatus = atoi(row[1]);
|
|
||||||
}
|
|
||||||
mysql_free_result(result);
|
|
||||||
}
|
}
|
||||||
else
|
|
||||||
std::cerr << "Error in GetAccountFromID query '" << query << "' " << errbuf << std::endl;
|
|
||||||
safe_delete_array(query);
|
safe_delete_array(query);
|
||||||
|
|
||||||
|
if (results.RowCount() != 1)
|
||||||
|
return;
|
||||||
|
|
||||||
|
auto row = results.begin();
|
||||||
|
|
||||||
|
if (oAccountName)
|
||||||
|
strcpy(oAccountName, row[0]);
|
||||||
|
if (oStatus)
|
||||||
|
*oStatus = atoi(row[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Database::ClearMerchantTemp(){
|
void Database::ClearMerchantTemp(){
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user