Added the sendSuccess, sendError, getResultSet & executeQuery functions to the util.h
This commit is contained in:
@ -3,6 +3,7 @@
|
||||
|
||||
#include <dpp/dpp.h>
|
||||
#include <mariadb/conncpp.hpp>
|
||||
#include <regex>
|
||||
|
||||
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<std::string> 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<std::string> params);
|
||||
};
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user