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 TypeMethodDescriptionvoid
executeCommand
(String command) Safe execution of any commandvoid
executeUpdate
(String command) Safe execution of update commandsstatic MySQLConnection
getMusicChannel
(net.dv8tion.jda.api.entities.Guild guild) Obtains current music channel for a given guildvoid
obtainConnection
(Connection connection) queryCommand
(String query) Safe execution of queriesboolean
registerGuild
(net.dv8tion.jda.api.entities.Guild guild, net.dv8tion.jda.api.entities.channel.middleman.GuildMessageChannel defaultChannel) void
setMusicChannel
(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
-