Module storm

Interface SqlDialect

All Known Implementing Classes:
DefaultSqlDialect

public interface SqlDialect
Represents a specific SQL dialect with methods to determine feature support and handle identifier escaping.
Since:
1.1
  • Method Details

    • name

      String name()
      Returns the name of the SQL dialect.
      Returns:
      the name of the SQL dialect.
      Since:
      1.2
    • supportsDeleteAlias

      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.

      Returns:
      true if delete aliases are supported, false otherwise.
    • supportsMultiValueTuples

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

      Pattern getValidIdentifierPattern()
      Returns the pattern for valid identifiers.
      Returns:
      the pattern for valid identifiers.
      Since:
      1.2
    • isKeyword

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

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

      default String getSafeIdentifier(String name)
      Returns a safe identifier for the given name, possibly escaping it if it is a keyword or contains invalid characters.
      Parameters:
      name - the name to check.
      Returns:
      a safe identifier for the given name.
      Since:
      1.2
    • getSingleLineCommentPattern

      Pattern getSingleLineCommentPattern()
      Returns the pattern for single line comments.
      Returns:
      the pattern for single line comments.
      Since:
      1.2
    • getMultiLineCommentPattern

      Pattern getMultiLineCommentPattern()
      Returns the pattern for multi line comments.
      Returns:
      the pattern for multi line comments.
      Since:
      1.2
    • getIdentifierPattern

      Pattern getIdentifierPattern()
      Returns the pattern for identifiers.
      Returns:
      the pattern for identifiers.
      Since:
      1.2
    • getQuoteLiteralPattern

      Pattern getQuoteLiteralPattern()
      Returns the pattern for string literals.
      Returns:
      the pattern for string literals.
      Since:
      1.2
    • multiValueIn

      String multiValueIn(@Nonnull List<Map<String,Object>> values, @Nonnull Consumer<Object> parameterConsumer) throws SqlTemplateException
      Returns a string for the given column name.
      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

      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.
      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

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

      String offset(int offset)
      Returns a string template for the given offset.
      Parameters:
      offset - the offset.
      Returns:
      a string template for the given offset.
      Since:
      1.2
    • limit

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

      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.
      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

      String forShareLockHint()
      Returns the lock hint for a shared reading lock.
      Returns:
      the lock hint for a shared reading lock.
      Since:
      1.2
    • forUpdateLockHint

      String forUpdateLockHint()
      Returns the lock hint for a write lock.
      Returns:
      the lock hint for a write lock.
      Since:
      1.2