diff options
Diffstat (limited to 'src/bot.cpp')
-rw-r--r-- | src/bot.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/bot.cpp b/src/bot.cpp index 2bc6a6b..b1d530c 100644 --- a/src/bot.cpp +++ b/src/bot.cpp @@ -67,9 +67,20 @@ bool Bot::run_database_migrations() { w.commit(); this->core->log(dpp::ll_info, "Done."); + this->core->log(dpp::ll_info, "Preparing statements..."); + create_queries(); + this->core->log(dpp::ll_info, "Done"); + return true; } +void Bot::create_queries() { + this->core->log(dpp::ll_trace, "Preparing state query"); + this->conn.prepare("state", "SELECT value FROM bot_state WHERE setting=$1"); + this->core->log(dpp::ll_trace, "Preparing update state query"); + this->conn.prepare("update_state", "INSERT INTO bot_state (setting,value) VALUES ($1, $2) ON CONFLICT (setting) DO UPDATE SET value=EXCLUDED.value;"); +} + bool Bot::isDevMode() { return dev; } |