Examples of AggregateFunction


Examples of org.eclipse.persistence.jpa.jpql.parser.AggregateFunction

    if (stateObject.isDecorated()) {
      toText(stateObject);
    }
    else {
      AggregateFunction expression = stateObject.getExpression();

      // Identifier
      appendIdentifier((expression != null) ? expression.getActualIdentifier() : stateObject.getIdentifier(), stateObject.getIdentifier());

      // '('
      if (shouldOutput(expression) || expression.hasLeftParenthesis()) {
        writer.append(formatIdentifier(LEFT_PARENTHESIS));
      }

      // 'DISTINCT'
      if (stateObject.hasDistinct()) {
        appendIdentifier((expression != null) ? expression.getActualDistinctIdentifier() : DISTINCT, DISTINCT);

        if (shouldOutput(expression) || expression.hasSpaceAfterDistinct()) {
          writer.append(SPACE);
        }
      }

      // Encapsulated expression
      if (stateObject.hasStateObject()) {
        stateObject.getStateObject().accept(this);
      }

      // ')'
      if (shouldOutput(expression) || expression.hasRightParenthesis()) {
        writer.append(formatIdentifier(RIGHT_PARENTHESIS));
      }
    }
  }
View Full Code Here

Examples of org.eclipse.persistence.jpa.jpql.parser.AggregateFunction

    if (stateObject.isDecorated()) {
      toText(stateObject);
    }
    else {
      AggregateFunction expression = stateObject.getExpression();

      // Identifier
      appendIdentifier((expression != null) ? expression.getActualIdentifier() : stateObject.getIdentifier(), stateObject.getIdentifier());

      // '('
      if (shouldOutput(expression) || expression.hasLeftParenthesis()) {
        writer.append(formatIdentifier(LEFT_PARENTHESIS));
      }

      // 'DISTINCT'
      if (stateObject.hasDistinct()) {
        appendIdentifier((expression != null) ? expression.getActualDistinctIdentifier() : DISTINCT, DISTINCT);

        if (shouldOutput(expression) || expression.hasSpaceAfterDistinct()) {
          writer.append(SPACE);
        }
      }

      // Encapsulated expression
      if (stateObject.hasStateObject()) {
        stateObject.getStateObject().accept(this);
      }

      // ')'
      if (shouldOutput(expression) || expression.hasRightParenthesis()) {
        writer.append(formatIdentifier(RIGHT_PARENTHESIS));
      }
    }
  }
View Full Code Here

Examples of org.eclipse.persistence.jpa.jpql.parser.AggregateFunction

    if (stateObject.isDecorated()) {
      toText(stateObject);
    }
    else {
      AggregateFunction expression = stateObject.getExpression();

      // Identifier
      appendIdentifier((expression != null) ? expression.getActualIdentifier() : stateObject.getIdentifier(), stateObject.getIdentifier());

      // '('
      if (shouldOutput(expression) || expression.hasLeftParenthesis()) {
        writer.append(formatIdentifier(LEFT_PARENTHESIS));
      }

      // 'DISTINCT'
      if (stateObject.hasDistinct()) {
        appendIdentifier((expression != null) ? expression.getActualDistinctIdentifier() : DISTINCT, DISTINCT);

        if (shouldOutput(expression) || expression.hasSpaceAfterDistinct()) {
          writer.append(SPACE);
        }
      }

      // Encapsulated expression
      if (stateObject.hasStateObject()) {
        stateObject.getStateObject().accept(this);
      }

      // ')'
      if (shouldOutput(expression) || expression.hasRightParenthesis()) {
        writer.append(formatIdentifier(RIGHT_PARENTHESIS));
      }
    }
  }
View Full Code Here

Examples of org.h2.api.AggregateFunction

            javaClass = Utils.loadUserClass(className);
        }
        Object obj;
        try {
            obj = javaClass.newInstance();
            AggregateFunction agg = (AggregateFunction) obj;
            return agg;
        } catch (Exception e) {
            throw DbException.convert(e);
        }
    }
View Full Code Here

Examples of org.h2.api.AggregateFunction

            e.setEvaluatable(tableFilter, b);
        }
    }

    private AggregateFunction getInstance() throws SQLException {
        AggregateFunction agg = userAggregate.getInstance();
        agg.init(userConnection);
        return agg;
    }
View Full Code Here

Examples of org.h2.api.AggregateFunction

        HashMap<Expression, Object> group = select.getCurrentGroup();
        if (group == null) {
            throw DbException.get(ErrorCode.INVALID_USE_OF_AGGREGATE_FUNCTION_1, getSQL());
        }
        try {
            AggregateFunction agg = (AggregateFunction) group.get(this);
            if (agg == null) {
                agg = getInstance();
            }
            Object obj = agg.getResult();
            if (obj == null) {
                return ValueNull.INSTANCE;
            }
            return DataType.convertToValue(session, obj, dataType);
        } catch (SQLException e) {
View Full Code Here

Examples of org.h2.api.AggregateFunction

            // already visited
            return;
        }
        lastGroupRowId = groupRowId;

        AggregateFunction agg = (AggregateFunction) group.get(this);
        try {
            if (agg == null) {
                agg = getInstance();
                group.put(this, agg);
            }
            Object[] argValues = new Object[args.length];
            Object arg = null;
            for (int i = 0, len = args.length; i < len; i++) {
                Value v = args[i].getValue(session);
                v = v.convertTo(argTypes[i]);
                arg = v.getObject();
                argValues[i] = arg;
            }
            if (args.length == 1) {
                agg.add(arg);
            } else {
                agg.add(argValues);
            }
        } catch (SQLException e) {
            throw DbException.convert(e);
        }
    }
View Full Code Here

Examples of org.h2.api.AggregateFunction

            e.setEvaluatable(tableFilter, b);
        }
    }

    private AggregateFunction getInstance() throws SQLException {
        AggregateFunction agg = userAggregate.getInstance();
        agg.init(userConnection);
        return agg;
    }
View Full Code Here

Examples of org.h2.api.AggregateFunction

        HashMap<Expression, Object> group = select.getCurrentGroup();
        if (group == null) {
            throw DbException.get(ErrorCode.INVALID_USE_OF_AGGREGATE_FUNCTION_1, getSQL());
        }
        try {
            AggregateFunction agg = (AggregateFunction) group.get(this);
            if (agg == null) {
                agg = getInstance();
            }
            Object obj = agg.getResult();
            if (obj == null) {
                return ValueNull.INSTANCE;
            }
            return DataType.convertToValue(session, obj, dataType);
        } catch (SQLException e) {
View Full Code Here

Examples of org.h2.api.AggregateFunction

            // already visited
            return;
        }
        lastGroupRowId = groupRowId;

        AggregateFunction agg = (AggregateFunction) group.get(this);
        try {
            if (agg == null) {
                agg = getInstance();
                group.put(this, agg);
            }
            Object[] argValues = new Object[args.length];
            Object arg = null;
            for (int i = 0; i < args.length; i++) {
                Value v = args[i].getValue(session);
                v = v.convertTo(argTypes[i]);
                arg = v.getObject();
                argValues[i] = arg;
            }
            if (args.length == 1) {
                agg.add(arg);
            } else {
                agg.add(argValues);
            }
        } catch (SQLException e) {
            throw DbException.convert(e);
        }
    }
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.