Package org.hibernate.dialect

Class MariaDBDialect

    • Constructor Detail

      • MariaDBDialect

        public MariaDBDialect()
    • Method Detail

      • initializeFunctionRegistry

        public void initializeFunctionRegistry​(FunctionContributions functionContributions)
        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 withjava.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])
        • repeat(string, times)
        • 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)
        • bitand(arg1, arg1)
        • bitor(arg1, arg1)
        • bitxor(arg1, arg1)
        • format(datetime as pattern)
        • collate(string as collation)
        • str(arg) - synonym ofcast(a as String)
        • ifnull(arg0, arg1) - synonym ofcoalesce(a, b)
        Finally, the following functions are defined as abbreviations forextract(), and desugared by the parser:
        • second(arg) - synonym ofextract(second from a)
        • minute(arg) - synonym ofextract(minute from a)
        • hour(arg) - synonym ofextract(hour from a)
        • day(arg) - synonym ofextract(day from a)
        • month(arg) - synonym ofextract(month from a)
        • year(arg) - synonym ofextract(year from a)
        Note that according to this definition, thesecond() 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.
        Overrides:
        initializeFunctionRegistry in class MySQLDialect
      • resolveSqlTypeDescriptor

        public JdbcType resolveSqlTypeDescriptor​(String columnTypeName,                                         int jdbcTypeCode,                                         int precision,                                         int scale,JdbcTypeRegistry jdbcTypeRegistry)
        Description copied from class: Dialect
        Assigns an appropriateJdbcType to a column of a JDBC result set based on the column type name, JDBC type code, precision, and scale.
        Overrides:
        resolveSqlTypeDescriptor in class MySQLDialect
        Parameters:
        columnTypeName - the column type name
        jdbcTypeCode - thetype code
        precision - the precision or 0
        scale - the scale or 0
        Returns:
        an appropriate instance ofJdbcType
      • contributeTypes

        public void contributeTypes​(TypeContributions typeContributions,ServiceRegistry serviceRegistry)
        Description copied from class: Dialect
        A callback which allows theDialect to contribute types.
        Overrides:
        contributeTypes in class MySQLDialect
        Parameters:
        typeContributions - Callback to contribute the types
        serviceRegistry - The service registry
      • supportsWindowFunctions

        public boolean supportsWindowFunctions()
        Description copied from class: Dialect
        Does this dialect support window functions likerow_number() over (..)?
        Overrides:
        supportsWindowFunctions in class MySQLDialect
        Returns:
        true if the underlying database supports window functions,false otherwise. The default isfalse.
      • supportsLateral

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

        public boolean supportsRecursiveCTE()
        Description copied from class: Dialect
        Does this dialect/database support recursive CTEs?
        Overrides:
        supportsRecursiveCTE in class MySQLDialect
        Returns:
        true if recursive CTEs are supported
      • supportsColumnCheck

        public boolean supportsColumnCheck()
        Description copied from class: Dialect
        Does this dialect support column-level check constraints?
        Overrides:
        supportsColumnCheck in class MySQLDialect
        Returns:
        True if column-levelcheck constraints are supported; false otherwise.
      • doesRoundTemporalOnOverflow

        public boolean doesRoundTemporalOnOverflow()
        Description copied from class: Dialect
        Does this dialect round a temporal when converting from a precision higher to a lower one?
        Overrides:
        doesRoundTemporalOnOverflow in class Dialect
        Returns:
        true if rounding is applied, false if truncation is applied
      • supportsIfExistsBeforeConstraintName

        public boolean supportsIfExistsBeforeConstraintName()
        Description copied from class: Dialect
        For dropping a constraint with analter table statement, can the phraseif exists be applied before the constraint name?
        Overrides:
        supportsIfExistsBeforeConstraintName in class Dialect
        Returns:
        true ifif exists can be applied before the constraint name
      • supportsIfExistsAfterAlterTable

        public boolean supportsIfExistsAfterAlterTable()
        Description copied from class: Dialect
        For analter table, can the phraseif exists be applied?
        Overrides:
        supportsIfExistsAfterAlterTable in class Dialect
        Returns:
        true ifif exists can be applied afteralter table
      • getQuerySequencesString

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

        public boolean supportsSkipLocked()
        Description copied from class: Dialect
        Does this dialect supportSKIP_LOCKED timeout.
        Overrides:
        supportsSkipLocked in class MySQLDialect
        Returns:
        true if SKIP_LOCKED is supported
      • supportsNoWait

        public boolean supportsNoWait()
        Description copied from class: Dialect
        Does this dialect supportNO_WAIT timeout.
        Overrides:
        supportsNoWait in class MySQLDialect
        Returns:
        true ifNO_WAIT is supported
      • supportsWait

        public boolean supportsWait()
        Description copied from class: Dialect
        Does this dialect supportWAIT timeout.
        Overrides:
        supportsWait in class MySQLDialect
        Returns:
        true ifWAIT is supported
      • supportsInsertReturning

        public boolean supportsInsertReturning()
        Description copied from class: Dialect
        Does this dialect fully support returning arbitrary generated column values after execution of aninsert statement, using native SQL syntax?

        Support for identity columns is insufficient here, we require something like:

        1. insert ... returning ...
        2. select from final table (insert ... )
        Overrides:
        supportsInsertReturning in class Dialect
        Returns:
        true for 10.5 and above because Maria supportsinsert ... returning even though MySQL does not
        See Also:
        InsertReturningDelegate
      • getDual

        public String getDual()
        Description copied from class: Dialect
        Returns a table expression that has one row.
        Overrides:
        getDual in class MySQLDialect
        Returns:
        the SQL equivalent to Oracle'sdual.