Class MySQLConnection

java.lang.Object
dev.jacrispys.JavaBot.utils.mysql.MySQLConnection

public class MySQLConnection extends Object
Framework for mysql connection queries and updates
  • Constructor Details

    • MySQLConnection

      public MySQLConnection()
  • Method Details

    • getInstance

      public static MySQLConnection getInstance()
    • obtainConnection

      public void obtainConnection(Connection connection)
    • 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 DB
      defaultChannel - default notification channel for guild
      Returns:
      boolean if registration was a success
    • executeCommand

      public void executeCommand(String command)
      Safe execution of any command
      Parameters:
      command - command to execute
    • executeUpdate

      public void executeUpdate(String command)
      Safe execution of update commands
      Parameters:
      command - command to update DB variables through
    • queryCommand

      public ResultSet queryCommand(String query) throws SQLException
      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

      public Long getMusicChannel(net.dv8tion.jda.api.entities.Guild guild) throws SQLException
      Obtains current music channel for a given guild
      Throws:
      SQLException