mirror of
https://github.com/EQEmu/Server.git
synced 2026-04-14 20:12:26 +00:00
AddSpeech converted to QueryDatabase
This commit is contained in:
parent
9041891557
commit
a0fc9844fd
@ -98,25 +98,28 @@ Database::~Database()
|
||||
}
|
||||
|
||||
void Database::AddSpeech(const char* from, const char* to, const char* message, uint16 minstatus, uint32 guilddbid, uint8 type) {
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
char* query = 0;
|
||||
|
||||
char *S1 = new char[strlen(from) * 2 + 1];
|
||||
char *S2 = new char[strlen(to) * 2 + 1];
|
||||
char *S3 = new char[strlen(message) * 2 + 1];
|
||||
DoEscapeString(S1, from, strlen(from));
|
||||
DoEscapeString(S2, to, strlen(to));
|
||||
DoEscapeString(S3, message, strlen(message));
|
||||
char *escapedFrom = new char[strlen(from) * 2 + 1];
|
||||
char *escapedTo = new char[strlen(to) * 2 + 1];
|
||||
char *escapedMessage = new char[strlen(message) * 2 + 1];
|
||||
DoEscapeString(escapedFrom, from, strlen(from));
|
||||
DoEscapeString(escapedTo, to, strlen(to));
|
||||
DoEscapeString(escapedMessage, message, strlen(message));
|
||||
|
||||
if(!RunQuery(query, MakeAnyLenString(&query, "INSERT INTO `qs_player_speech` SET `from`='%s', `to`='%s', `message`='%s', `minstatus`='%i', `guilddbid`='%i', `type`='%i'", S1, S2, S3, minstatus, guilddbid, type), errbuf, 0, 0)) {
|
||||
_log(QUERYSERV__ERROR, "Failed Speech Entry Insert: %s", errbuf);
|
||||
_log(QUERYSERV__ERROR, "%s", query);
|
||||
std::string query = StringFormat("INSERT INTO `qs_player_speech` "
|
||||
"SET `from` = '%s', `to` = '%s', `message`='%s', "
|
||||
"`minstatus`='%i', `guilddbid`='%i', `type`='%i'",
|
||||
escapedFrom, escapedTo, escapedMessage, minstatus, guilddbid, type);
|
||||
safe_delete_array(escapedFrom);
|
||||
safe_delete_array(escapedTo);
|
||||
safe_delete_array(escapedMessage);
|
||||
auto results = QueryDatabase(query);
|
||||
if(!results.Success()) {
|
||||
_log(QUERYSERV__ERROR, "Failed Speech Entry Insert: %s", results.ErrorMessage().c_str());
|
||||
_log(QUERYSERV__ERROR, "%s", query.c_str());
|
||||
}
|
||||
|
||||
safe_delete_array(query);
|
||||
safe_delete_array(S1);
|
||||
safe_delete_array(S2);
|
||||
safe_delete_array(S3);
|
||||
|
||||
}
|
||||
|
||||
void Database::LogPlayerTrade(QSPlayerLogTrade_Struct* QS, uint32 DetailCount) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user