SaveStance converted to QueryDatabase

This commit is contained in:
Arthur Ice 2014-09-03 16:11:13 -07:00
parent 14c642a3f7
commit 7d8e128b5f

View File

@ -2802,25 +2802,15 @@ void Bot::LoadStance() {
} }
void Bot::SaveStance() { void Bot::SaveStance() {
if(_baseBotStance != _botStance) { if(_baseBotStance == _botStance)
std::string errorMessage; return;
char* Query = 0;
char TempErrorMessageBuffer[MYSQL_ERRMSG_SIZE];
if(!database.RunQuery(Query, MakeAnyLenString(&Query, "REPLACE INTO botstances (BotID, StanceId) VALUES(%u, %u);", GetBotID(), GetBotStance()), TempErrorMessageBuffer)) { std::string query = StringFormat("REPLACE INTO botstances (BotID, StanceId) "
errorMessage = std::string(TempErrorMessageBuffer); "VALUES(%u, %u);", GetBotID(), GetBotStance());
safe_delete(Query); auto results = database.QueryDatabase(query);
Query = 0; if(!results.Success())
} LogFile->write(EQEMuLog::Error, "Error in Bot::SaveStance()");
else {
safe_delete(Query);
Query = 0;
}
if(!errorMessage.empty()) {
LogFile->write(EQEMuLog::Error, "Error in Bot::SaveStance()");
}
}
} }
void Bot::LoadTimers() { void Bot::LoadTimers() {