Process converted to QueryDatabase

This commit is contained in:
Arthur Ice 2014-08-18 18:54:40 -07:00
parent 87efd22394
commit e2d85337d0

View File

@ -446,31 +446,34 @@ bool ZoneServer::Process() {
zoneserver_list.SendEmoteMessage(scm->from, 0, 0, 0, "You told %s, '%s is not online at this time'", scm->to, scm->to); zoneserver_list.SendEmoteMessage(scm->from, 0, 0, 0, "You told %s, '%s is not online at this time'", scm->to, scm->to);
} }
else if (cle->Online() == CLE_Status_Zoning) { else if (cle->Online() == CLE_Status_Zoning) {
if (!scm->noreply) { if (!scm->noreply)
char errbuf[MYSQL_ERRMSG_SIZE]; {
char *query = 0;
MYSQL_RES *result;
//MYSQL_ROW row; Trumpcard - commenting. Currently unused.
time_t rawtime; time_t rawtime;
struct tm * timeinfo; struct tm * timeinfo;
time ( &rawtime ); time ( &rawtime );
timeinfo = localtime ( &rawtime ); timeinfo = localtime ( &rawtime );
char *telldate=asctime(timeinfo); char *telldate=asctime(timeinfo);
if (database.RunQuery(query, MakeAnyLenString(&query, "SELECT name from character_ where name='%s'",scm->deliverto), errbuf, &result)) {
safe_delete(query); std::string query = StringFormat("SELECT name FROM character_ WHERE name = '%s'",scm->deliverto);
if (result!=0) { auto results = database.QueryDatabase(query);
if (database.RunQuery(query, MakeAnyLenString(&query, "INSERT INTO tellque (Date,Receiver,Sender,Message) values('%s','%s','%s','%s')",telldate,scm->deliverto,scm->from,scm->message), errbuf, &result)) if (!results.Success())
zoneserver_list.SendEmoteMessage(scm->from, 0, 0, 0, "Your message has been added to the %s's que.", scm->to); break;
else
zoneserver_list.SendEmoteMessage(scm->from, 0, 0, 0, "You told %s, '%s is not online at this time'", scm->to, scm->to); if (results.RowCount() == 0) {
safe_delete(query); zoneserver_list.SendEmoteMessage(scm->from, 0, 0, 0, "You told %s, '%s is not online at this time'", scm->to, scm->to);
} break;
else }
zoneserver_list.SendEmoteMessage(scm->from, 0, 0, 0, "You told %s, '%s is not online at this time'", scm->to, scm->to);
mysql_free_result(result); query = StringFormat("INSERT INTO tellque "
} "(Date, Receiver, Sender, Message) "
else "VALUES('%s', '%s', '%s', '%s')",
safe_delete(query); telldate, scm->deliverto, scm->from, scm->message);
results = database.QueryDatabase(query);
if (results.Success())
zoneserver_list.SendEmoteMessage(scm->from, 0, 0, 0, "Your message has been added to the %s's que.", scm->to);
else
zoneserver_list.SendEmoteMessage(scm->from, 0, 0, 0, "You told %s, '%s is not online at this time'", scm->to, scm->to);
} }
// zoneserver_list.SendEmoteMessage(scm->from, 0, 0, 0, "You told %s, '%s is not online at this time'", scm->to, scm->to); // zoneserver_list.SendEmoteMessage(scm->from, 0, 0, 0, "You told %s, '%s is not online at this time'", scm->to, scm->to);
} }