Search in sources :

Example 1 with TrimSpec

use of org.hibernate.query.sqm.TrimSpec in project hibernate-orm by hibernate.

the class TrimFunction method render.

@Override
public void render(SqlAppender sqlAppender, List<? extends SqlAstNode> sqlAstArguments, SqlAstTranslator<?> walker) {
    final TrimSpec specification = ((TrimSpecification) sqlAstArguments.get(0)).getSpecification();
    final Object trimCharacter = ((Literal) sqlAstArguments.get(1)).getLiteralValue();
    final Expression sourceExpr = (Expression) sqlAstArguments.get(2);
    String trim = dialect.trimPattern(specification, (char) trimCharacter);
    new PatternRenderer(trim).render(sqlAppender, Collections.singletonList(sourceExpr), walker);
}
Also used : TrimSpec(org.hibernate.query.sqm.TrimSpec) Expression(org.hibernate.sql.ast.tree.expression.Expression) Literal(org.hibernate.sql.ast.tree.expression.Literal) TrimSpecification(org.hibernate.sql.ast.tree.expression.TrimSpecification) PatternRenderer(org.hibernate.query.sqm.produce.function.internal.PatternRenderer)

Aggregations

TrimSpec (org.hibernate.query.sqm.TrimSpec)1 PatternRenderer (org.hibernate.query.sqm.produce.function.internal.PatternRenderer)1 Expression (org.hibernate.sql.ast.tree.expression.Expression)1 Literal (org.hibernate.sql.ast.tree.expression.Literal)1 TrimSpecification (org.hibernate.sql.ast.tree.expression.TrimSpecification)1