Class DefaultType<T extends JdbcConfig<?>>

java.lang.Object
de.chojo.sqlutil.databases.DefaultType<T>
Type Parameters:
T - database type defined by the SqlType
All Implemented Interfaces:
SqlType<T>
Direct Known Subclasses:
MariaDb, MySql, Postgres, SqLite

public abstract class DefaultType<T extends JdbcConfig<?>> extends Object implements SqlType<T>
Represents a default database
  • Constructor Details

    • DefaultType

      public DefaultType()
  • Method Details

    • getVersion

      public String getVersion(String table)
      Description copied from interface: SqlType
      Gets a query to read the version from the version table
      Specified by:
      getVersion in interface SqlType<T extends JdbcConfig<?>>
      Parameters:
      table - table name
      Returns:
      query to read the version table
    • insertVersion

      public String insertVersion(String table)
      Description copied from interface: SqlType
      Creates a query to insert a version into the version table.

      Versions are always inserted and not updated.

      Specified by:
      insertVersion in interface SqlType<T extends JdbcConfig<?>>
      Parameters:
      table - table name
      Returns:
      query to insert the version.
    • deleteVersion

      public String deleteVersion(String table)
      Description copied from interface: SqlType
      Creates a query to delete all entries from the version table.
      Specified by:
      deleteVersion in interface SqlType<T extends JdbcConfig<?>>
      Parameters:
      table - table name
      Returns:
      query to clear version table
    • createVersionTableQuery

      public String createVersionTableQuery(String table)
      Description copied from interface: SqlType
      Creates a query to create a version table on the database.

      The query needs to handle errors when the table exists.

      Specified by:
      createVersionTableQuery in interface SqlType<T extends JdbcConfig<?>>
      Parameters:
      table - table name
      Returns:
      query to create a version table