mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-13 18:51:29 +00:00
command_viewpetition converted to QueryDatabase
This commit is contained in:
parent
4d768474e8
commit
114d0ae11b
@ -1510,33 +1510,29 @@ void command_movechar(Client *c, const Seperator *sep)
|
|||||||
|
|
||||||
void command_viewpetition(Client *c, const Seperator *sep)
|
void command_viewpetition(Client *c, const Seperator *sep)
|
||||||
{
|
{
|
||||||
if (sep->arg[1][0] == 0)
|
if (sep->arg[1][0] == 0) {
|
||||||
c->Message(0, "Usage: #viewpetition (petition number) Type #listpetition for a list");
|
c->Message(0, "Usage: #viewpetition (petition number) Type #listpetition for a list");
|
||||||
else
|
return;
|
||||||
{
|
}
|
||||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
|
||||||
char *query = 0;
|
|
||||||
int queryfound = 0;
|
|
||||||
MYSQL_RES *result;
|
|
||||||
MYSQL_ROW row;
|
|
||||||
c->Message(13," ID : Character Name , Petition Text");
|
c->Message(13," ID : Character Name , Petition Text");
|
||||||
if (database.RunQuery(query, MakeAnyLenString(&query, "SELECT petid, charname, petitiontext from petitions order by petid"), errbuf, &result))
|
|
||||||
{
|
std::string query = "SELECT petid, charname, petitiontext FROM petitions ORDER BY petid";
|
||||||
while ((row = mysql_fetch_row(result)))
|
auto results = database.QueryDatabase(query);
|
||||||
{
|
if (!results.Success())
|
||||||
if (strcasecmp(row[0],sep->argplus[1])== 0)
|
return;
|
||||||
{
|
|
||||||
queryfound=1;
|
LogFile->write(EQEMuLog::Normal,"View petition request from %s, petition number: %i", c->GetName(), atoi(sep->argplus[1]) );
|
||||||
c->Message(15, " %s: %s , %s ",row[0],row[1],row[2]);
|
|
||||||
}
|
if (results.RowCount() == 0) {
|
||||||
}
|
|
||||||
LogFile->write(EQEMuLog::Normal,"View petition request from %s, petition number:", c->GetName(), atoi(sep->argplus[1]) );
|
|
||||||
if (queryfound==0)
|
|
||||||
c->Message(13,"There was an error in your request: ID not found! Please check the Id and try again.");
|
c->Message(13,"There was an error in your request: ID not found! Please check the Id and try again.");
|
||||||
mysql_free_result(result);
|
return;
|
||||||
}
|
|
||||||
safe_delete_array(query);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (auto row = results.begin(); row != results.end(); ++row)
|
||||||
|
if (strcasecmp(row[0], sep->argplus[1]) == 0)
|
||||||
|
c->Message(15, " %s: %s , %s ", row[0], row[1], row[2]);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void command_petitioninfo(Client *c, const Seperator *sep)
|
void command_petitioninfo(Client *c, const Seperator *sep)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user