Enum Class SqlDialect

java.lang.Object
java.lang.Enum<SqlDialect>
onl.ycode.stormify.SqlDialect
All Implemented Interfaces:
Serializable, Comparable<SqlDialect>, Constable

public enum SqlDialect extends Enum<SqlDialect>
An enumeration of SQL dialects for different databases.

This enumeration is used to determine the current SQL dialect and provide helper functions to generate SQL queries. The dialect is determined by the database product name.

If the database product name is not recognized, the dialect is set to UNKNOWN.

  • Enum Constant Details

    • MARIA_DB_OLD

      public static final SqlDialect MARIA_DB_OLD
      The MariaDB dialect for versions older than 10.3.
    • MARIA_DB_NEW

      public static final SqlDialect MARIA_DB_NEW
      The MariaDB dialect for versions 10.3 and newer.
    • MYSQL_OLD

      public static final SqlDialect MYSQL_OLD
      The MySQL dialect for versions older than 8.
    • MYSQL_NEW

      public static final SqlDialect MYSQL_NEW
      The MySQL dialect for versions 8 and newer.
    • ORACLE_NEW

      public static final SqlDialect ORACLE_NEW
      The Oracle dialect for versions 12 and newer.
    • ORACLE_OLD

      public static final SqlDialect ORACLE_OLD
      The Oracle dialect for versions older than 12.
    • POSTGRESQL

      public static final SqlDialect POSTGRESQL
      The PostgreSQL dialect.
    • SQL_SERVER_NEW

      public static final SqlDialect SQL_SERVER_NEW
      The SQL Server dialect for versions 2012 and newer.
    • SQL_SERVER_OLD

      public static final SqlDialect SQL_SERVER_OLD
      The SQL Server dialect for versions older than 2012.
    • SQLITE

      public static final SqlDialect SQLITE
      The SQLite dialect.
    • UNKNOWN

      public static final SqlDialect UNKNOWN
      The dialect that is used when the database product name cannot be determined.
    • FAILSAFE

      public static final SqlDialect FAILSAFE
      A failsafe dialect, mostly in case of an error.
  • Field Details

    • sequenceDialect

      public final UnaryOperator<String> sequenceDialect
      A helper method to ask for sequences on different databases. As input is the name of the sequence and as output the query to get the next value from the sequence.
    • orderByIdDialect

      public final BiFunction<String,BigDecimal,String> orderByIdDialect
      A helper method to ask for order by id on different databases. This is used to create a query that, before any other sorting, fetches a specific entity first.

      The first parameter is the name of the id column, and the second is the value of the id.

      The result is a string that can be used in the order by part of a query.

    • queryFormatter

      public final SqlDialect.QueryFormatter queryFormatter
      A query formatter that generates SQL queries with different pagination methods.
      See Also:
  • Method Details

    • values

      public static SqlDialect[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static SqlDialect valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null