mirror of
https://github.com/EQEmu/Server.git
synced 2026-04-10 20:22:41 +00:00
SetAccountStatus converted to QueryDatabase
This commit is contained in:
parent
2e7f7ad477
commit
e3de570f29
@ -372,18 +372,19 @@ bool Database::SetLocalPassword(uint32 accid, const char* password) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool Database::SetAccountStatus(const char* name, int16 status) {
|
bool Database::SetAccountStatus(const char* name, int16 status) {
|
||||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
char *query = nullptr;
|
||||||
char *query = 0;
|
|
||||||
uint32 affected_rows = 0;
|
|
||||||
|
|
||||||
std::cout << "Account being GM Flagged:" << name << ", Level: " << (int16) status << std::endl;
|
std::cout << "Account being GM Flagged:" << name << ", Level: " << (int16) status << std::endl;
|
||||||
if (!RunQuery(query, MakeAnyLenString(&query, "UPDATE account SET status=%i WHERE name='%s';", status, name), errbuf, 0, &affected_rows)) {
|
|
||||||
safe_delete_array(query);
|
auto results = QueryDatabase(query, MakeAnyLenString(&query, "UPDATE account SET status=%i WHERE name='%s';", status, name));
|
||||||
return false;
|
|
||||||
}
|
|
||||||
safe_delete_array(query);
|
safe_delete_array(query);
|
||||||
|
|
||||||
if (affected_rows == 0) {
|
if (!results.Success())
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (results.RowsAffected() == 0)
|
||||||
|
{
|
||||||
std::cout << "Account: " << name << " does not exist, therefore it cannot be flagged\n";
|
std::cout << "Account: " << name << " does not exist, therefore it cannot be flagged\n";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user