Class GaussDBTruncRoundFunction

java.lang.Object
org.hibernate.query.sqm.function.AbstractSqmFunctionDescriptor
org.hibernate.community.dialect.function.GaussDBTruncRoundFunction
All Implemented Interfaces:
org.hibernate.query.sqm.function.FunctionRenderer, org.hibernate.query.sqm.function.SqmFunctionDescriptor

public class GaussDBTruncRoundFunction extends org.hibernate.query.sqm.function.AbstractSqmFunctionDescriptor implements org.hibernate.query.sqm.function.FunctionRenderer
GaussDB only supports the two-argument trunc and round functions with the following signatures:
  • trunc(numeric, integer)
  • round(numeric, integer)

This custom function falls back to using floor as a workaround only when necessary, e.g. when there are 2 arguments to the function and either:

  • The first argument is not of type numeric
  • or
  • The dialect doesn't support the two-argument trunc function
  • Constructor Summary

    Constructors
    Constructor
    Description
    GaussDBTruncRoundFunction(String name, boolean supportsTwoArguments)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected <T> org.hibernate.query.sqm.function.SelfRenderingSqmFunction<T>
    generateSqmFunctionExpression(List<? extends org.hibernate.query.sqm.tree.SqmTypedNode<?>> arguments, org.hibernate.metamodel.model.domain.ReturnableType<T> impliedResultType, org.hibernate.query.spi.QueryEngine queryEngine)
     
     
    void
    render(org.hibernate.sql.ast.spi.SqlAppender sqlAppender, List<? extends org.hibernate.sql.ast.tree.SqlAstNode> arguments, org.hibernate.metamodel.model.domain.ReturnableType<?> returnType, org.hibernate.sql.ast.SqlAstTranslator<?> walker)
     

    Methods inherited from class org.hibernate.query.sqm.function.AbstractSqmFunctionDescriptor

    generateAggregateSqmExpression, generateOrderedSetAggregateSqmExpression, generateSqmAggregateFunctionExpression, generateSqmExpression, generateSqmOrderedSetAggregateFunctionExpression, generateSqmWindowFunctionExpression, generateWindowSqmExpression, getArgumentsValidator, getArgumentTypeResolver, getName, getReturnSignature, getReturnTypeResolver, getSignature

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface org.hibernate.query.sqm.function.FunctionRenderer

    render, render, render, render

    Methods inherited from interface org.hibernate.query.sqm.function.SqmFunctionDescriptor

    alwaysIncludesParentheses, generateSqmExpression, generateSqmExpression, getFunctionKind, isPredicate
  • Constructor Details

    • GaussDBTruncRoundFunction

      public GaussDBTruncRoundFunction(String name, boolean supportsTwoArguments)
  • Method Details

    • render

      public void render(org.hibernate.sql.ast.spi.SqlAppender sqlAppender, List<? extends org.hibernate.sql.ast.tree.SqlAstNode> arguments, org.hibernate.metamodel.model.domain.ReturnableType<?> returnType, org.hibernate.sql.ast.SqlAstTranslator<?> walker)
      Specified by:
      render in interface org.hibernate.query.sqm.function.FunctionRenderer
    • getArgumentListSignature

      public String getArgumentListSignature()
      Overrides:
      getArgumentListSignature in class org.hibernate.query.sqm.function.AbstractSqmFunctionDescriptor
    • generateSqmFunctionExpression

      protected <T> org.hibernate.query.sqm.function.SelfRenderingSqmFunction<T> generateSqmFunctionExpression(List<? extends org.hibernate.query.sqm.tree.SqmTypedNode<?>> arguments, org.hibernate.metamodel.model.domain.ReturnableType<T> impliedResultType, org.hibernate.query.spi.QueryEngine queryEngine)
      Specified by:
      generateSqmFunctionExpression in class org.hibernate.query.sqm.function.AbstractSqmFunctionDescriptor