Interface PunishmentDatabase


public interface PunishmentDatabase
Access to the raw database. Use of this should be avoided at great cost. Executing SQL queries is not considered traditional API.

The majority of users should never touch this directly. Instead, PunishmentSelector provides predictable, error-free functions using stable API. PunishmentSelector may be used to retrieve punishments with all sorts of details from the database.

API Status
Use of the SQL backend directly is not considered traditional API. Although attempts will be made to limit the number of breaking changes, LibertyBans's major version will not necessarily change to match the SQL backend. Unlike other plugins, LibertyBans makes use of a wide swath of SQL queries and operations, so a rigid table structure is not feasible.

Rather, a separate version is maintained specifically for the SQL backend. This version is returned by getMajorRevision() and getMinorRevision(). Additionally, it is located in the table libertybans_revision, with the major and minor columns indicating the major version and minor version, respectively (both columns use the INT data type).

Whenever the tables and/or views definitions change incompatibly, this major version will be incremented. This minor version will be incremented as new tables and views are added or existing ones changed, but not in ways which break backwards compatibility.

Stored routines are not supported within any versioning context. Use of any SQL functions or procedures created by LibertyBans is strictly unsupported.
Author:
A248
  • Method Summary

    Modifier and Type
    Method
    Description
    Gets a connection from the LibertyBans connection pool.
    Gets the executor used by LibertyBans to execute queries.
    int
    Gets the major revision of the SQL backend definitions, see class javadoc
    int
    Gets the minor revision of the SQL backend definitions, see class javadoc
  • Method Details

    • getConnection

      Connection getConnection() throws SQLException
      Gets a connection from the LibertyBans connection pool.

      Use of this should be avoided at great cost. Executing SQL queries is not considered traditional API. See the class javadoc for more information.

      Furthermore, users of this method should not assume which vendor is used and thus avoid non standard SQL syntax.
      Returns:
      a connection from the plugin pool, which should be closed immediately after use
      Throws:
      SQLException - as relayed from JDBC
    • getMajorRevision

      int getMajorRevision()
      Gets the major revision of the SQL backend definitions, see class javadoc
      Returns:
      the major revision
    • getMinorRevision

      int getMinorRevision()
      Gets the minor revision of the SQL backend definitions, see class javadoc
      Returns:
      the minor revision
    • getExecutor

      Executor getExecutor()
      Gets the executor used by LibertyBans to execute queries. Typically, this executor has the same amount of threads as there are connections in the pool, making it a fine complement to executing queries.
      Returns:
      the executor