From d6041b94f0bd012e679d9ccfa64ebc89099c5b87 Mon Sep 17 00:00:00 2001 From: Mathias Wagner Date: Sat, 4 Nov 2023 12:21:15 +0100 Subject: [PATCH] Added the sendSuccess, sendError, getResultSet & executeQuery functions to the util.h --- src/api/util.h | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/src/api/util.h b/src/api/util.h index 912efb8..7c47742 100644 --- a/src/api/util.h +++ b/src/api/util.h @@ -3,6 +3,7 @@ #include #include +#include class util { public: @@ -24,12 +25,43 @@ public: */ static dpp::embed getDefaultEmbed(EmbedType type = INFO); + /** + * @brief Sends a success message + * @param event The event + * @param message The message + */ + static void sendSuccess(const dpp::slashcommand_t& event, const std::string& message); + + /** + * @brief Sends an error message + * @param event The event + * @param message The message + */ + static void sendError(const dpp::slashcommand_t& event, const std::string& message); + /** * @brief Creates a connection to the database * @param config The database config * @return The connection */ static sql::Connection* createConnection(const json& config); + + /** + * @brief Gets a result set from a query + * @param con The connection + * @param query The query + * @param params The parameters + * @return The result set + */ + static sql::ResultSet* getResultSet(sql::Connection& con, const std::string& query, std::initializer_list params); + + /** + * @brief Executes a query + * @param con The connection + * @param query The query + * @param params The parameters + */ + static void executeQuery(sql::Connection& con, const std::string& query, std::initializer_list params); };