Examples of SQLFunction


Examples of org.apache.torque.util.functions.SQLFunction

        ListOrderedMapCI cMap = getAggregates();
        OrderedMapIterator iMap = cMap.orderedMapIterator();
        while (iMap.hasNext())
        {
            String key = (String) iMap.next();
            SQLFunction f = (SQLFunction) iMap.getValue();
            Column col =  f.getColumn();
            c.addAsColumn(key, new ColumnImpl(
                    null,
                    col.getTableName(),
                    col.getColumnName(),
                    f.getSqlExpression()));
            if (!haveFromTable)    // Last chance. Get it from the func.
            {
                {
                    // Kludgy Where table.col = table.col clause to force
                    // from table identification.
View Full Code Here

Examples of org.eigenbase.sql.SqlFunction

          String newFunctionName = functionName + literal;

          // Look up the new function name in the drill operator table
          List<SqlOperator> operatorList = table.getSqlOperator(newFunctionName);
          assert operatorList.size() > 0;
          SqlFunction newFunction = null;

          // Find the SqlFunction with the correct args
          for (SqlOperator op : operatorList) {
            if (op.getOperandTypeChecker().getOperandCountRange().isValidCount(nArgs - 1)) {
              newFunction = (SqlFunction) op;
View Full Code Here

Examples of org.hibernate.dialect.function.SQLFunction

   * @param functionName The name of the function to locate
   * @return The sql function.
   * @throws QueryException Indicates no matching sql functions could be found.
   */
  private SQLFunction requireSQLFunction(String functionName) {
    SQLFunction f = findSQLFunction( functionName );
    if ( f == null ) {
      throw new QueryException( "Unable to find SQL function: " + functionName );
    }
    return f;
  }
View Full Code Here

Examples of org.hibernate.dialect.function.SQLFunction

   * @param first        The first argument expression.
   * @return the function return type given the function name and the first argument expression node.
   */
  public Type findFunctionReturnType(String functionName, AST first) {
    // locate the registered function by the given name
    SQLFunction sqlFunction = requireSQLFunction( functionName );

    // determine the type of the first argument...
    Type argumentType = null;
    if ( first != null ) {
      if ( "cast".equals(functionName) ) {
        argumentType = TypeFactory.heuristicType( first.getNextSibling().getText() );
      }
      else if ( first instanceof SqlNode ) {
        argumentType = ( (SqlNode) first ).getDataType();
      }
    }

    return sqlFunction.getReturnType( argumentType, sfi );
  }
View Full Code Here

Examples of org.hibernate.dialect.function.SQLFunction

    }
  }

  protected void beginFunctionTemplate(AST m, AST i) {
    MethodNode methodNode = ( MethodNode ) m;
    SQLFunction template = methodNode.getSQLFunction();
    if ( template == null ) {
      // if template is null we just write the function out as it appears in the hql statement
      super.beginFunctionTemplate( m, i );
    }
    else {
View Full Code Here

Examples of org.hibernate.dialect.function.SQLFunction

    }
  }

  protected void endFunctionTemplate(AST m) {
    MethodNode methodNode = ( MethodNode ) m;
    SQLFunction template = methodNode.getSQLFunction();
    if ( template == null ) {
      super.endFunctionTemplate( m );
    }
    else {
      // this function has a template -> restore output, apply the template and write the result out
      FunctionArguments functionArguments = ( FunctionArguments ) writer;   // TODO: Downcast to avoid using an interface?  Yuck.
      writer = ( SqlWriter ) outputStack.removeFirst();
      out( template.render( functionArguments.getArgs(), sessionFactory ) );
    }
  }
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

  protected SQLFunction getFunction(CriteriaQuery criteriaQuery) {
    return getFunction( getFunctionName(), criteriaQuery );
  }

  protected SQLFunction getFunction(String functionName, CriteriaQuery criteriaQuery) {
    final SQLFunction function = criteriaQuery.getFactory()
        .getSqlFunctionRegistry()
        .findSQLFunction( functionName );
    if ( function == null ) {
      throw new HibernateException( "Unable to locate mapping for function named [" + functionName + "]" );
    }
View Full Code Here

Examples of org.hibernate.dialect.function.SQLFunction

    return getFunction( criteriaQuery ).render( null, ARGS, criteriaQuery.getFactory() ) + " as y" + position + '_';
  }

  protected SQLFunction getFunction(CriteriaQuery criteriaQuery) {
    final SQLFunctionRegistry sqlFunctionRegistry = criteriaQuery.getFactory().getSqlFunctionRegistry();
    final SQLFunction function = sqlFunctionRegistry.findSQLFunction( "count" );
    if ( function == null ) {
      throw new HibernateException( "Unable to locate count function mapping" );
    }
    return function;
  }
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
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.