Class DB2zDialect

  • All Implemented Interfaces:

    public class DB2zDialect
    extends DB2Dialect
    A SQL dialect for DB2 for z/OS version 12.1 and above, previously known as :
    • "Db2 UDB for z/OS", and
    • "Db2 UDB for z/OS and OS/390".
    • Method Detail

      • initializeFunctionRegistry

        public void initializeFunctionRegistry​(QueryEngine queryEngine)
        Description copied from class: Dialect
        Initialize the given registry with any dialect-specific functions.

        Support for certain SQL functions is required, and if the database does not support a required function, then the dialect must define a way to emulate it.

        These required functions include the functions defined by the JPA query language specification:

        • avg(arg) - aggregate function
        • count([distinct ]arg) - aggregate function
        • max(arg) - aggregate function
        • min(arg) - aggregate function
        • sum(arg) - aggregate function
        • coalesce(arg0, arg1, ...)
        • nullif(arg0, arg1)
        • lower(arg)
        • upper(arg)
        • length(arg)
        • concat(arg0, arg1, ...)
        • locate(pattern, string[, start])
        • substring(string, start[, length])
        • trim([[spec ][character ]from] string)
        • abs(arg)
        • mod(arg0, arg1)
        • sqrt(arg)
        • current date
        • current time
        • current timestamp
        Along with an additional set of functions defined by ANSI SQL:
        • any(arg) - aggregate function
        • every(arg) - aggregate function
        • var_samp(arg) - aggregate function
        • var_pop(arg) - aggregate function
        • stddev_samp(arg) - aggregate function
        • stddev_pop(arg) - aggregate function
        • cast(arg as Type)
        • extract(field from arg)
        • ln(arg)
        • exp(arg)
        • power(arg0, arg1)
        • floor(arg)
        • ceiling(arg)
        • position(pattern in string)
        • substring(string from start[ for length])
        • overlay(string placing replacement from start[ for length])
        And the following functions for working with java.time types:
        • local date
        • local time
        • local datetime
        • offset datetime
        • instant
        And a number of additional "standard" functions:
        • left(string, length)
        • right(string, length)
        • replace(string, pattern, replacement)
        • pad(string with length spec[ character])
        • pi
        • log10(arg)
        • log(base, arg)
        • sign(arg)
        • sin(arg)
        • cos(arg)
        • tan(arg)
        • asin(arg)
        • acos(arg)
        • atan(arg)
        • atan2(arg0, arg1)
        • round(arg0[, arg1])
        • truncate(arg0[, arg1])
        • sinh(arg)
        • tanh(arg)
        • cosh(arg)
        • least(arg0, arg1, ...)
        • greatest(arg0, arg1, ...)
        • degrees(arg)
        • radians(arg)
        • format(datetime as pattern)
        • collate(string as collation)
        • str(arg) - synonym of cast(a as String)
        • ifnull(arg0, arg1) - synonym of coalesce(a, b)
        Finally, the following functions are defined as abbreviations for extract(), and desugared by the parser:
        • second(arg) - synonym of extract(second from a)
        • minute(arg) - synonym of extract(minute from a)
        • hour(arg) - synonym of extract(hour from a)
        • day(arg) - synonym of extract(day from a)
        • month(arg) - synonym of extract(month from a)
        • year(arg) - synonym of extract(year from a)
        Note that according to this definition, the second() function returns a floating point value, contrary to the integer type returned by the native function with this name on many databases. Thus, we don't just naively map these HQL functions to the native SQL functions with the same names.
        initializeFunctionRegistry in class DB2Dialect
      • supportsDistinctFromPredicate

        public boolean supportsDistinctFromPredicate()
        Description copied from class: Dialect
        Does this dialect support some kind of distinct from predicate?

        This is, does it support syntax like ... where FIRST_NAME IS DISTINCT FROM LAST_NAME?

        supportsDistinctFromPredicate in class DB2Dialect
        True if this SQL dialect is known to support some kind of distinct from predicate; false otherwise
      • getQuerySequencesString

        public String getQuerySequencesString()
        Description copied from class: Dialect
        Get the select command used retrieve the names of all sequences.
        getQuerySequencesString in class DB2Dialect
        The select command; or null if sequences are not supported.
      • supportsSkipLocked

        public boolean supportsSkipLocked()
        Description copied from class: Dialect
        Does this dialect support SKIP_LOCKED timeout.
        supportsSkipLocked in class DB2Dialect
        true if SKIP_LOCKED is supported
      • supportsLateral

        public boolean supportsLateral()
        Description copied from class: Dialect
        Does this dialect support the SQL lateral keyword or a proprietary alternative?
        supportsLateral in class DB2Dialect
        true if the underlying database supports lateral, false otherwise. The default is false.
      • supportsRecursiveCTE

        public boolean supportsRecursiveCTE()
        Description copied from class: Dialect
        Does this dialect/database support recursive CTEs (Common Table Expressions)?
        supportsRecursiveCTE in class DB2Dialect
        true if recursive CTEs are supported
      • timestampaddPattern

        public String timestampaddPattern​(TemporalUnit unit,
                                          jakarta.persistence.TemporalType temporalType,
                                          IntervalType intervalType)
        Description copied from class: Dialect
        Obtain a pattern for the SQL equivalent to a timestampadd() function call. The resulting pattern must contain ?1, ?2, and ?3 placeholders for the arguments.
        timestampaddPattern in class DB2Dialect
        unit - The unit to add to the temporal
        temporalType - The type of the temporal
        intervalType - The type of interval to add or null if it's not a native interval