Module storm
Package st.orm.spi

Class DefaultSqlDialect

java.lang.Object
st.orm.spi.DefaultSqlDialect
All Implemented Interfaces:
SqlDialect

public class DefaultSqlDialect extends Object implements SqlDialect
  • Field Details

    • ANSI_KEYWORDS

      protected static final Set<String> ANSI_KEYWORDS
  • Constructor Details

    • DefaultSqlDialect

      public DefaultSqlDialect()
  • Method Details

    • name

      public String name()
      Returns the name of the SQL dialect.
      Specified by:
      name in interface SqlDialect
      Returns:
      the name of the SQL dialect.
      Since:
      1.2
    • supportsDeleteAlias

      public boolean supportsDeleteAlias()
      Indicates whether the SQL dialect supports delete aliases.

      Delete aliases allow delete statements to use table aliases in joins, making it easier to filter rows based on related data.

      Specified by:
      supportsDeleteAlias in interface SqlDialect
      Returns:
      true if delete aliases are supported, false otherwise.
    • supportsMultiValueTuples

      public boolean supportsMultiValueTuples()
      Indicates whether the SQL dialect supports multi-value tuples in the IN clause.
      Specified by:
      supportsMultiValueTuples in interface SqlDialect
      Returns:
      true if multi-value tuples are supported, false otherwise.
      Since:
      1.2
    • getValidIdentifierPattern

      public Pattern getValidIdentifierPattern()
      Returns the pattern for valid identifiers.
      Specified by:
      getValidIdentifierPattern in interface SqlDialect
      Returns:
      the pattern for valid identifiers.
      Since:
      1.2
    • isKeyword

      public boolean isKeyword(@Nonnull String name)
      Indicates whether the given name is a keyword in this SQL dialect.
      Specified by:
      isKeyword in interface SqlDialect
      Parameters:
      name - the name to check.
      Returns:
      true if the name is a keyword, false otherwise.
      Since:
      1.2
    • escape

      public String escape(@Nonnull String name)
      Escapes the given database identifier (e.g., table or column name) according to this SQL dialect.
      Specified by:
      escape in interface SqlDialect
      Parameters:
      name - the identifier to escape (must not be null)
      Returns:
      the escaped identifier
    • getSingleLineCommentPattern

      public Pattern getSingleLineCommentPattern()
      Returns the pattern for single line comments.
      Specified by:
      getSingleLineCommentPattern in interface SqlDialect
      Returns:
      the pattern for single line comments.
      Since:
      1.2
    • getMultiLineCommentPattern

      public Pattern getMultiLineCommentPattern()
      Returns the pattern for multi line comments.
      Specified by:
      getMultiLineCommentPattern in interface SqlDialect
      Returns:
      the pattern for multi line comments.
      Since:
      1.2
    • getIdentifierPattern

      public Pattern getIdentifierPattern()
      Returns the pattern for identifiers.
      Specified by:
      getIdentifierPattern in interface SqlDialect
      Returns:
      the pattern for identifiers.
      Since:
      1.2
    • getQuoteLiteralPattern

      public Pattern getQuoteLiteralPattern()
      Returns the pattern for string literals.
      Specified by:
      getQuoteLiteralPattern in interface SqlDialect
      Returns:
      the pattern for string literals.
      Since:
      1.2
    • multiValueIn

      public String multiValueIn(@Nonnull List<Map<String,Object>> values, @Nonnull Consumer<Object> parameterConsumer) throws SqlTemplateException
      Returns a string for the given column name.
      Specified by:
      multiValueIn in interface SqlDialect
      Parameters:
      values - the (multi) values to use in the IN clause.
      parameterConsumer - the consumer for the parameters.
      Returns:
      the string that represents the multi value IN clause.
      Throws:
      SqlTemplateException - if the values are incompatible.
      Since:
      1.2
    • applyLimitAfterSelect

      public boolean applyLimitAfterSelect()
      Returns true if the limit should be applied after the SELECT clause, false to apply the limit at the end of the query.
      Specified by:
      applyLimitAfterSelect in interface SqlDialect
      Returns:
      true if the limit should be applied after the SELECT clause, false to apply the limit at the end of the query.
      Since:
      1.2
    • limit

      public String limit(int limit)
      Returns a string template for the given limit.
      Specified by:
      limit in interface SqlDialect
      Parameters:
      limit - the maximum number of records to return.
      Returns:
      a string template for the given limit.
      Since:
      1.2
    • offset

      public String offset(int offset)
      Returns a string template for the given offset.
      Specified by:
      offset in interface SqlDialect
      Parameters:
      offset - the offset.
      Returns:
      a string template for the given offset.
      Since:
      1.2
    • limit

      public String limit(int limit, int offset)
      Returns a string template for the given limit and offset.
      Specified by:
      limit in interface SqlDialect
      Parameters:
      limit - the maximum number of records to return.
      offset - the offset.
      Returns:
      a string template for the given limit and offset.
      Since:
      1.2
    • applyLockHintAfterFrom

      public boolean applyLockHintAfterFrom()
      Returns true if the lock hint should be applied after the FROM clause, false to apply the lock hint at the end of the query.
      Specified by:
      applyLockHintAfterFrom in interface SqlDialect
      Returns:
      true if the lock hint should be applied after the FROM clause, false to apply the lock hint at the end of the query.
      Since:
      1.2
    • forShareLockHint

      public String forShareLockHint()
      Returns the lock hint for a shared reading lock.
      Specified by:
      forShareLockHint in interface SqlDialect
      Returns:
      the lock hint for a shared reading lock.
      Since:
      1.2
    • forUpdateLockHint

      public String forUpdateLockHint()
      Returns the lock hint for a write lock.
      Specified by:
      forUpdateLockHint in interface SqlDialect
      Returns:
      the lock hint for a write lock.
      Since:
      1.2