mirror of
https://github.com/EQEmu/Server.git
synced 2026-02-25 09:22:25 +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) {
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
char *query = 0;
|
||||
uint32 affected_rows = 0;
|
||||
char *query = nullptr;
|
||||
|
||||
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);
|
||||
return false;
|
||||
}
|
||||
|
||||
auto results = QueryDatabase(query, MakeAnyLenString(&query, "UPDATE account SET status=%i WHERE name='%s';", status, name));
|
||||
|
||||
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";
|
||||
return false;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user