From ddd98be38384535bc20b4da52d0a81a007be1cc3 Mon Sep 17 00:00:00 2001 From: Aeadoin <109764533+Aeadoin@users.noreply.github.com> Date: Sat, 18 Feb 2023 16:13:36 -0500 Subject: [PATCH] [Bot] Change SaveTimers to Replace instead of Insert. (#2951) * [Bot] Change SaveTimers to Replace instead of Insert. * [Bot] Change SaveTimers to Replace instead of Insert. * fix formatting --- zone/bot_database.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/zone/bot_database.cpp b/zone/bot_database.cpp index 89f8b89d6..b241238f0 100644 --- a/zone/bot_database.cpp +++ b/zone/bot_database.cpp @@ -962,7 +962,10 @@ bool BotDatabase::SaveTimers(Bot* bot_inst) if (bot_timers[timer_index] <= Timer::GetCurrentTime()) continue; - query = StringFormat("INSERT INTO `bot_timers` (`bot_id`, `timer_id`, `timer_value`) VALUES ('%u', '%u', '%u')", bot_inst->GetBotID(), (timer_index + 1), bot_timers[timer_index]); + query = fmt::format( + "REPLACE INTO `bot_timers` (`bot_id`, `timer_id`, `timer_value`) VALUES ('{}', '{}', '{}')", + bot_inst->GetBotID(), (timer_index + 1), bot_timers[timer_index] + ); auto results = database.QueryDatabase(query); if (!results.Success()) { DeleteTimers(bot_inst->GetBotID());