Examples of SQLFunction


Examples of org.hibernate.dialect.function.SQLFunction

      assert "{param list}".equalschild.getText() );
      child = child.getFirstChild();
    }

    final String functionName = ast.getText();
    final SQLFunction function = context.getSqlFunctionRegistry().findSQLFunction( functionName );
    if ( function == null ) {
      String text = functionName;
      if ( child != null ) {
        text += '(';
        while ( child != null ) {
          text += child.getText();
          child = child.getNextSibling();
          if ( child != null ) {
            text += ", ";
          }
        }
        text += ')';
      }
      return getASTFactory().create( OrderByTemplateTokenTypes.IDENT, text );
    }
    else {
      ArrayList expressions = new ArrayList();
      while ( child != null ) {
        expressions.add( child.getText() );
        child = child.getNextSibling();
      }
      final String text = function.render( null, expressions, context.getSessionFactory() );
      return getASTFactory().create( OrderByTemplateTokenTypes.IDENT, text );
    }
  }
View Full Code Here

Examples of org.hibernate.dialect.function.SQLFunction

  @Override
    protected void beginFunctionTemplate(AST node, AST nameNode) {
    // NOTE for AGGREGATE both nodes are the same; for METHOD the first is the METHOD, the second is the
    //     METHOD_NAME
    FunctionNode functionNode = ( FunctionNode ) node;
    SQLFunction sqlFunction = functionNode.getSQLFunction();
    if ( sqlFunction == null ) {
      // if SQLFunction is null we just write the function out as it appears in the hql statement
      super.beginFunctionTemplate( node, nameNode );
    }
    else {
View Full Code Here

Examples of org.hibernate.dialect.function.SQLFunction

  }

  @Override
    protected void endFunctionTemplate(AST node) {
    FunctionNode functionNode = ( FunctionNode ) node;
    SQLFunction sqlFunction = functionNode.getSQLFunction();
    if ( sqlFunction == null ) {
      super.endFunctionTemplate( node );
    }
    else {
      final Type functionType = functionNode.getFirstArgumentType();
      // this function has a registered SQLFunction -> redirect output and catch the arguments
      FunctionArguments functionArguments = ( FunctionArguments ) writer;
      writer = outputStack.removeFirst();
      out( sqlFunction.render( functionType, functionArguments.getArgs(), sessionFactory ) );
    }
  }
View Full Code Here

Examples of org.hibernate.dialect.function.SQLFunction

    }
    FromElement fe = getFromElement();
    if ( fe != null ) {
      return fe.getDataType();
    }
    SQLFunction sf = getWalker().getSessionFactoryHelper().findSQLFunction( getText() );
    if ( sf != null ) {
      return sf.getReturnType( null, getWalker().getSessionFactoryHelper().getFactory() );
    }
    return null;
  }
View Full Code Here

Examples of org.hibernate.dialect.function.SQLFunction

    // checking for "(" is currently redundant because it is checked before getting here;
    // doing the check anyhow, in case that earlier check goes away;
    if ( "(".equals( nextToken ) ) {
      return true;
    }
    SQLFunction function = functionRegistry.findSQLFunction(lcToken);
    if ( function == null ) {
      // lcToken does not refer to a function
      return false;
    }
    // if function.hasParenthesesIfNoArguments() is true, then assume
    // lcToken is not a function (since it is not followed by '(')
    return ! function.hasParenthesesIfNoArguments();
  }
View Full Code Here

Examples of org.hibernate.dialect.function.SQLFunction

    // checking for "(" is currently redundant because it is checked before getting here;
    // doing the check anyhow, in case that earlier check goes away;
    if ( "(".equals( nextToken ) ) {
      return true;
    }
    SQLFunction function = functionRegistry.findSQLFunction(lcToken);
    if ( function == null ) {
      // lcToken does not refer to a function
      return false;
    }
    // if function.hasArguments() and function.hasParenthesesIfNoArguments() is true,
    // then assume that lcToken is not a function, since it is not followed by "(";
    // can't seem to use function.hasParenthesesIfNoArguments() alone because
    // function definitions may return true if "()" is optional when there are no arguments.
    return function.hasArguments() && function.hasParenthesesIfNoArguments() ? false : true;
  }
View Full Code Here

Examples of org.hibernate.dialect.function.SQLFunction

    AST child = ast.getFirstChild();
    assert "{param list}".equalschild.getText() );
    child = child.getFirstChild();

    final String functionName = ast.getText();
    final SQLFunction function = context.getSqlFunctionRegistry().findSQLFunction( functionName );
    if ( function == null ) {
      String text = functionName;
      if ( child != null ) {
        text += '(';
        while ( child != null ) {
          text += child.getText();
          child = child.getNextSibling();
          if ( child != null ) {
            text += ", ";
          }
        }
        text += ')';
      }
      return getASTFactory().create( OrderByTemplateTokenTypes.IDENT, text );
    }
    else {
      ArrayList expressions = new ArrayList();
      while ( child != null ) {
        expressions.add( child.getText() );
        child = child.getNextSibling();
      }
      final String text = function.render( null, expressions, context.getSessionFactory() );
      return getASTFactory().create( OrderByTemplateTokenTypes.IDENT, text );
    }
  }
View Full Code Here

Examples of org.hibernate.dialect.function.SQLFunction

    AST child = ast.getFirstChild();
    assert "{param list}".equalschild.getText() );
    child = child.getFirstChild();

    final String functionName = ast.getText();
    final SQLFunction function = context.getSqlFunctionRegistry().findSQLFunction( functionName );
    if ( function == null ) {
      String text = functionName;
      if ( child != null ) {
        text += '(';
        while ( child != null ) {
          text += child.getText();
          child = child.getNextSibling();
          if ( child != null ) {
            text += ", ";
          }
        }
        text += ')';
      }
      return getASTFactory().create( OrderByTemplateTokenTypes.IDENT, text );
    }
    else {
      ArrayList expressions = new ArrayList();
      while ( child != null ) {
        expressions.add( child.getText() );
        child = child.getNextSibling();
      }
      final String text = function.render( expressions, context.getSessionFactory() );
      return getASTFactory().create( OrderByTemplateTokenTypes.IDENT, text );
    }
  }
View Full Code Here

Examples of org.hibernate.dialect.function.SQLFunction

  protected void beginFunctionTemplate(AST node, AST nameNode) {
    // NOTE for AGGREGATE both nodes are the same; for METHOD the first is the METHOD, the second is the
    //     METHOD_NAME
    FunctionNode functionNode = ( FunctionNode ) node;
    SQLFunction sqlFunction = functionNode.getSQLFunction();
    if ( sqlFunction == null ) {
      // if SQLFunction is null we just write the function out as it appears in the hql statement
      super.beginFunctionTemplate( node, nameNode );
    }
    else {
View Full Code Here

Examples of org.hibernate.dialect.function.SQLFunction

    }
  }

  protected void endFunctionTemplate(AST node) {
    FunctionNode functionNode = ( FunctionNode ) node;
    SQLFunction sqlFunction = functionNode.getSQLFunction();
    if ( sqlFunction == null ) {
      super.endFunctionTemplate( node );
    }
    else {
      final Type functionType = functionNode.getFirstArgumentType();
      // this function has a registered SQLFunction -> redirect output and catch the arguments
      FunctionArguments functionArguments = ( FunctionArguments ) writer;
      writer = outputStack.removeFirst();
      out( sqlFunction.render( functionType, functionArguments.getArgs(), sessionFactory ) );
    }
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.