mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-12 01:11:29 +00:00
command_listpetition converted to QueryDatabase
This commit is contained in:
parent
5f5fba1117
commit
accedf7184
@ -3373,23 +3373,20 @@ void command_motd(Client *c, const Seperator *sep)
|
||||
|
||||
void command_listpetition(Client *c, const Seperator *sep)
|
||||
{
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
char *query = 0;
|
||||
MYSQL_RES *result;
|
||||
MYSQL_ROW row;
|
||||
bool header = false;
|
||||
if (database.RunQuery(query, MakeAnyLenString(&query, "SELECT petid, charname, accountname from petitions order by petid"), errbuf, &result)) {
|
||||
LogFile->write(EQEMuLog::Normal,"Petition list requested by %s", c->GetName());
|
||||
while ((row = mysql_fetch_row(result))) {
|
||||
if(!header) {
|
||||
header = true;
|
||||
c->Message(13," ID : Character Name , Account Name");
|
||||
}
|
||||
c->Message(15, " %s: %s , %s ",row[0],row[1],row[2]);
|
||||
}
|
||||
mysql_free_result(result);
|
||||
}
|
||||
safe_delete_array(query);
|
||||
std::string query = "SELECT petid, charname, accountname FROM petitions ORDER BY petid";
|
||||
auto results = database.QueryDatabase(query);
|
||||
if (!results.Success())
|
||||
return;
|
||||
|
||||
LogFile->write(EQEMuLog::Normal,"Petition list requested by %s", c->GetName());
|
||||
|
||||
if (results.RowCount() == 0)
|
||||
return;
|
||||
|
||||
c->Message(13," ID : Character Name , Account Name");
|
||||
|
||||
for (auto row = results.begin(); row != results.end(); ++row)
|
||||
c->Message(15, " %s: %s , %s ",row[0],row[1],row[2]);
|
||||
}
|
||||
|
||||
void command_equipitem(Client *c, const Seperator *sep)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user