mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-12 17:51:28 +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)
|
void command_listpetition(Client *c, const Seperator *sep)
|
||||||
{
|
{
|
||||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
std::string query = "SELECT petid, charname, accountname FROM petitions ORDER BY petid";
|
||||||
char *query = 0;
|
auto results = database.QueryDatabase(query);
|
||||||
MYSQL_RES *result;
|
if (!results.Success())
|
||||||
MYSQL_ROW row;
|
return;
|
||||||
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());
|
LogFile->write(EQEMuLog::Normal,"Petition list requested by %s", c->GetName());
|
||||||
while ((row = mysql_fetch_row(result))) {
|
|
||||||
if(!header) {
|
if (results.RowCount() == 0)
|
||||||
header = true;
|
return;
|
||||||
|
|
||||||
c->Message(13," ID : Character Name , Account Name");
|
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]);
|
c->Message(15, " %s: %s , %s ",row[0],row[1],row[2]);
|
||||||
}
|
|
||||||
mysql_free_result(result);
|
|
||||||
}
|
|
||||||
safe_delete_array(query);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void command_equipitem(Client *c, const Seperator *sep)
|
void command_equipitem(Client *c, const Seperator *sep)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user