Class AbstractDatabase<T extends org.bukkit.plugin.java.JavaPlugin>

java.lang.Object
at.hugob.plugin.library.database.AbstractDatabase<T>
Direct Known Subclasses:
MySQLDatabase, SQLiteDatabase

public abstract class AbstractDatabase<T extends org.bukkit.plugin.java.JavaPlugin> extends Object
the common code for databases
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected final T
    the plugin who initiated the database, mostly used for logging
    protected final String
    the prefix for the tabels in the database
  • Constructor Summary

    Constructors
    Constructor
    Description
    AbstractDatabase(T plugin, @NotNull DataSource dataSource, @NotNull String tablePrefix)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected abstract void
    A dummy method so I don't forget to create the SQL tables This needs to be executed on your own!
    protected Connection
    Gets a connection from the DataSource to execute SQL queries on

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • plugin

      protected final T extends org.bukkit.plugin.java.JavaPlugin plugin
      the plugin who initiated the database, mostly used for logging
    • tablePrefix

      protected final String tablePrefix
      the prefix for the tabels in the database
  • Constructor Details

    • AbstractDatabase

      public AbstractDatabase(@NotNull T plugin, @NotNull @NotNull DataSource dataSource, @NotNull @NotNull String tablePrefix)
      Parameters:
      plugin - The plugin that initiates the database, mostly used for logging
      dataSource - The SQL DataSource that is used to interact with the Database
      tablePrefix - The general Table prefix used for SQL Tables
  • Method Details

    • getConnection

      protected Connection getConnection() throws SQLException
      Gets a connection from the DataSource to execute SQL queries on
      Returns:
      the Database Connection
      Throws:
      SQLException - gets thrown if a database access error occurs
    • createTables

      protected abstract void createTables()
      A dummy method so I don't forget to create the SQL tables This needs to be executed on your own!