Class Db2SqlDialect

java.lang.Object
org.apache.calcite.sql.SqlDialect
org.apache.calcite.sql.dialect.Db2SqlDialect

public class Db2SqlDialect extends SqlDialect
A SqlDialect implementation for the IBM DB2 database.
  • Field Details

  • Constructor Details

    • Db2SqlDialect

      public Db2SqlDialect(SqlDialect.Context context)
      Creates a Db2SqlDialect.
  • Method Details

    • supportsCharSet

      public boolean supportsCharSet()
      Description copied from class: SqlDialect
      Returns whether the dialect supports character set names as part of a data type, for instance VARCHAR(30) CHARACTER SET `ISO-8859-1`.
      Overrides:
      supportsCharSet in class SqlDialect
    • hasImplicitTableAlias

      public boolean hasImplicitTableAlias()
      Description copied from class: SqlDialect
      Returns whether a qualified table in the FROM clause has an implicit alias which consists of just the table name.

      For example, in SqlDialect.DatabaseProduct.ORACLE

      SELECT * FROM sales.emp

      is equivalent to

      SELECT * FROM sales.emp AS emp

      and therefore

      SELECT emp.empno FROM sales.emp

      is valid. But SqlDialect.DatabaseProduct.DB2 does not have an implicit alias, so the previous query it not valid; you need to write

      SELECT sales.emp.empno FROM sales.emp

      Returns true for all databases except DB2.

      Overrides:
      hasImplicitTableAlias in class SqlDialect
    • unparseSqlIntervalQualifier

      public void unparseSqlIntervalQualifier(SqlWriter writer, SqlIntervalQualifier qualifier, RelDataTypeSystem typeSystem)
      Description copied from class: SqlDialect
      Converts an interval qualifier to a SQL string. The default implementation returns strings such as INTERVAL '1 2:3:4' DAY(4) TO SECOND(4).
      Overrides:
      unparseSqlIntervalQualifier in class SqlDialect
    • unparseSqlIntervalLiteral

      public void unparseSqlIntervalLiteral(SqlWriter writer, SqlIntervalLiteral literal, int leftPrec, int rightPrec)
      Description copied from class: SqlDialect
      Converts an interval literal to a SQL string. The default implementation returns strings such as INTERVAL '1 2:3:4' DAY(4) TO SECOND(4).
      Overrides:
      unparseSqlIntervalLiteral in class SqlDialect