Class MySQLConnection
java.lang.Object
dev.jacrispys.JavaBot.utils.mysql.MySQLConnection
Framework for mysql connection queries and updates
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidexecuteCommand(String command) Safe execution of any commandvoidexecuteUpdate(String command) Safe execution of update commandsstatic MySQLConnectiongetMusicChannel(net.dv8tion.jda.api.entities.Guild guild) Obtains current music channel for a given guildvoidobtainConnection(Connection connection) queryCommand(String query) Safe execution of queriesbooleanregisterGuild(net.dv8tion.jda.api.entities.Guild guild, net.dv8tion.jda.api.entities.channel.middleman.GuildMessageChannel defaultChannel) voidsetMusicChannel(net.dv8tion.jda.api.entities.Guild guild, long channelId) Sets the channel for song announcements in a given guild
-
Constructor Details
-
MySQLConnection
public MySQLConnection()
-
-
Method Details
-
getInstance
-
obtainConnection
-
registerGuild
public boolean registerGuild(net.dv8tion.jda.api.entities.Guild guild, net.dv8tion.jda.api.entities.channel.middleman.GuildMessageChannel defaultChannel) - Parameters:
guild- guild to register into the DBdefaultChannel- default notification channel for guild- Returns:
- boolean if registration was a success
-
executeCommand
Safe execution of any command- Parameters:
command- command to execute
-
executeUpdate
Safe execution of update commands- Parameters:
command- command to update DB variables through
-
queryCommand
Safe execution of queries- Parameters:
query- DB query to execute- Returns:
- the ResultSet from the query
- Throws:
SQLException
-
setMusicChannel
public void setMusicChannel(net.dv8tion.jda.api.entities.Guild guild, long channelId) throws SQLException Sets the channel for song announcements in a given guild- Throws:
SQLException
-
getMusicChannel
Obtains current music channel for a given guild- Throws:
SQLException
-