Class H2Dialect

java.lang.Object
io.github.torand.fastersql.dialect.H2Dialect
All Implemented Interfaces:
Dialect

public class H2Dialect extends Object implements Dialect
Defines the H2 SQL dialect.
  • Constructor Details

    • H2Dialect

      public H2Dialect()
      Creates an H2 Dialect implementation.
  • Method Details

    • getProductName

      public String getProductName()
      Description copied from interface: Dialect
      Gets the name of the RDBMS product associated with this SQL dialect.
      Specified by:
      getProductName in interface Dialect
      Returns:
      the name of the RDBMS product.
    • offsetBeforeLimit

      public boolean offsetBeforeLimit()
      Description copied from interface: Dialect
      Indicates whether offset clause must be specified before limit clause; if supported.
      Specified by:
      offsetBeforeLimit in interface Dialect
      Returns:
      whether offset clause must be specified before limit clause; if supported.
    • formatRowOffsetClause

      public Optional<String> formatRowOffsetClause()
      Description copied from interface: Dialect
      Returns the row offset clause formatted for a specific SQL dialect.
      Specified by:
      formatRowOffsetClause in interface Dialect
      Returns:
      the row offset clause formatted for a specific SQL dialect.
    • formatRowLimitClause

      public Optional<String> formatRowLimitClause()
      Description copied from interface: Dialect
      Returns the row limit clause formatted for a specific SQL dialect.
      Specified by:
      formatRowLimitClause in interface Dialect
      Returns:
      the row limit clause formatted for a specific SQL dialect.
    • formatRowNumLiteral

      public Optional<String> formatRowNumLiteral()
      Description copied from interface: Dialect
      Returns the row number literal formatted for a specific SQL dialect.
      Specified by:
      formatRowNumLiteral in interface Dialect
      Returns:
      the row number literal formatted for a specific SQL dialect.
    • formatConcatFunction

      public String formatConcatFunction(List<String> operands)
      Description copied from interface: Dialect
      Returns the 'concat' function formatted for a specific SQL dialect.
      Specified by:
      formatConcatFunction in interface Dialect
      Parameters:
      operands - the string expressions to concatenate
      Returns:
      the 'concat' function for a specific SQL dialect.
    • formatLengthFunction

      public String formatLengthFunction(String operand)
      Description copied from interface: Dialect
      Returns the 'length' function formatted for a specific SQL dialect.
      Specified by:
      formatLengthFunction in interface Dialect
      Parameters:
      operand - the string expression to get length of
      Returns:
      the 'length' function for a specific SQL dialect.
    • formatCeilFunction

      public String formatCeilFunction(String operand)
      Description copied from interface: Dialect
      Returns the 'ceil' function formatted for a specific SQL dialect.
      Specified by:
      formatCeilFunction in interface Dialect
      Parameters:
      operand - the numeric expression to get ceiling of
      Returns:
      the 'ceil' function for a specific SQL dialect.
    • formatModuloFunction

      public String formatModuloFunction(String divisor, String dividend)
      Description copied from interface: Dialect
      Returns the 'mod' function formatted for a specific SQL dialect.
      Specified by:
      formatModuloFunction in interface Dialect
      Parameters:
      divisor - the numeric expression for divisor operand
      dividend - the numeric expression for dividend operand
      Returns:
      the 'mod' function for a specific SQL dialect.
    • getDataType

      public Optional<String> getDataType(DataType dataType)
      Description copied from interface: Dialect
      Returns the data type for a specific SQL dialect.
      Specified by:
      getDataType in interface Dialect
      Parameters:
      dataType - the ISO data type
      Returns:
      the data type for a specific SQL dialect.
    • supports

      public boolean supports(Capability capability)
      Description copied from interface: Dialect
      Indicates whether a capability is supported by a specific SQL dialect.
      Specified by:
      supports in interface Dialect
      Parameters:
      capability - the capability to check support for
      Returns:
      true if specified capability is supported; else false
    • withCustomizations

      public H2Dialect withCustomizations(Connection connection)
      Adds some user defined functions emulating common SQL constructs not supported by default.
      Parameters:
      connection - a live H2 connection.
      Returns:
      the modified dialect.