Interface DatabaseConnector

All Known Implementing Classes:
MySQLConnector, SQLiteConnector

public interface DatabaseConnector
  • Nested Class Summary

    Nested Classes 
    Modifier and Type Interface Description
    static interface  DatabaseConnector.ConnectionCallback
    Wraps a connection in a callback which will automagically handle catching sql errors
  • Method Summary

    Modifier and Type Method Description
    void closeConnection()
    Closes all open connections to the database
    void connect​(DatabaseConnector.ConnectionCallback callback)
    Executes a callback with a Connection passed and automatically closes it when finished
    boolean isInitialized()
    Checks if the connection to the database has been created
  • Method Details

    • isInitialized

      boolean isInitialized()
      Checks if the connection to the database has been created
      Returns:
      true if the connection is created, otherwise false
    • closeConnection

      void closeConnection()
      Closes all open connections to the database
    • connect

      void connect​(DatabaseConnector.ConnectionCallback callback)
      Executes a callback with a Connection passed and automatically closes it when finished
      Parameters:
      callback - The callback to execute once the connection is retrieved