Class OracleDialect

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

public class OracleDialect extends Object implements Dialect
Defines the Oracle SQL dialect.
  • Constructor Details

    • OracleDialect

      public OracleDialect()
      Creates an Oracle Dialect implementation.
  • Method Details

    • getProductName

      public String getProductName()
      Description copied from interface: Dialect
      Gets the name of the RDBMS product.
      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()
      Row offset clause is supported from Oracle 12c onwards
      Specified by:
      formatRowOffsetClause in interface Dialect
      Returns:
      the _row offset clause_ formatted for a specific SQL dialect.
    • formatRowLimitClause

      public Optional<String> formatRowLimitClause()
      Row limit clause is supported from Oracle 12c onwards
      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.
    • formatToNumberFunction

      public String formatToNumberFunction(String operand, int precision, int scale)
      Description copied from interface: Dialect
      Returns the 'to_number' function formatted for a specific SQL dialect.
      Specified by:
      formatToNumberFunction in interface Dialect
      Parameters:
      operand - the string expression to be evaluated as a number
      precision - the precision that represents the number of significant digits
      scale - the scale that that represents the number of digits after the decimal point. Must be less than or equal to the precision.
      Returns:
      the 'to_number' function for a specific SQL dialect.
    • formatToCharFunction

      public String formatToCharFunction(String operand, String format)
      Description copied from interface: Dialect
      Returns the 'to_char' function formatted for a specific SQL dialect.
      Specified by:
      formatToCharFunction in interface Dialect
      Parameters:
      operand - the expression to be evaluated as a string
      format - the vendor-specific format mask
      Returns:
      the 'to_char' function for a specific SQL dialect.
    • formatSubstringFunction

      public String formatSubstringFunction(String operand, int startPos, int length)
      Description copied from interface: Dialect
      Returns the 'substring' function formatted for a specific SQL dialect.
      Specified by:
      formatSubstringFunction in interface Dialect
      Parameters:
      operand - the string expression to get substring from
      startPos - the start position (1-based) of the substring
      length - the length of the substring
      Returns:
      the 'substring' function 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.
    • formatRoundFunction

      public String formatRoundFunction(String operand)
      Description copied from interface: Dialect
      Returns the 'round' function formatted for a specific SQL dialect.
      Specified by:
      formatRoundFunction in interface Dialect
      Parameters:
      operand - the numeric expression to perform rounding on
      Returns:
      the 'round' 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.
    • formatCurrentDateFunction

      public String formatCurrentDateFunction()
      Description copied from interface: Dialect
      Returns the 'current_date' system function formatted for a specific SQL dialect.
      Specified by:
      formatCurrentDateFunction in interface Dialect
      Returns:
      the 'current_date' function for a specific SQL dialect.
    • getConcatOperator

      public Optional<String> getConcatOperator()
      Description copied from interface: Dialect
      Returns the string concatenation operator for a specific SQL Dialect.
      Specified by:
      getConcatOperator in interface Dialect
      Returns:
      the string concatenation operator 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
    • withLegacyRowLimiting

      public OracleDialect withLegacyRowLimiting()
      Enables emulating OFFSET and LIMIT constructs for older Oracle versions. Row offset and limit clauses are supported from Oracle 12c onwards. Invoke this method when using previous versions of Oracle, to simulate these clauses with subqueries.
      Returns:
      the modified dialect.