Java Code Examples for com.alibaba.druid.sql.ast.expr.SQLAggregateExpr#addArgument()

The following examples show how to use com.alibaba.druid.sql.ast.expr.SQLAggregateExpr#addArgument() . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
@Override
public SQLExpr toExpression() {
    SQLAggregateExpr aggregate = new SQLAggregateExpr(funcName());
    if (hasWithDistinct()) {
        aggregate.setOption(SQLAggregateOption.DISTINCT);
    }
    if (orders != null) {
        SQLOrderBy orderBy = new SQLOrderBy();
        for (Order order : orders) {
            SQLSelectOrderByItem orderItem = new SQLSelectOrderByItem(order.getItem().toExpression());
            orderItem.setType(order.getSortOrder());
            orderBy.addItem(orderItem);
        }
        aggregate.putAttribute(ItemFuncKeyWord.ORDER_BY, orderBy);
    }
    for (Item arg : args) {
        aggregate.addArgument(arg.toExpression());
    }
    if (seperator != null) {
        SQLCharExpr sep = new SQLCharExpr(seperator);
        aggregate.putAttribute(ItemFuncKeyWord.SEPARATOR, sep);
    }
    return aggregate;
}
 
Example 2
Source Project: dble   File: ItemSumSum.java    License: GNU General Public License v2.0 5 votes vote down vote up
@Override
public SQLExpr toExpression() {
    Item arg0 = getArg(0);
    SQLAggregateExpr aggregate = new SQLAggregateExpr(funcName());
    aggregate.addArgument(arg0.toExpression());
    if (hasWithDistinct()) {
        aggregate.setOption(SQLAggregateOption.DISTINCT);
    }
    return aggregate;
}
 
Example 3
Source Project: dble   File: ItemSumMin.java    License: GNU General Public License v2.0 5 votes vote down vote up
@Override
public SQLExpr toExpression() {
    Item arg0 = args.get(0);
    SQLAggregateExpr aggregate = new SQLAggregateExpr(funcName());
    aggregate.addArgument(arg0.toExpression());
    return aggregate;
}
 
Example 4
Source Project: dble   File: ItemSumAvg.java    License: GNU General Public License v2.0 5 votes vote down vote up
@Override
public SQLExpr toExpression() {
    Item arg0 = args.get(0);
    SQLAggregateExpr aggregate = new SQLAggregateExpr(funcName());
    aggregate.addArgument(arg0.toExpression());
    if (hasWithDistinct()) {
        aggregate.setOption(SQLAggregateOption.DISTINCT);
    }
    return aggregate;
}
 
Example 5
Source Project: dble   File: ItemSumMax.java    License: GNU General Public License v2.0 5 votes vote down vote up
@Override
public SQLExpr toExpression() {
    Item arg0 = args.get(0);
    SQLAggregateExpr aggregate = new SQLAggregateExpr(funcName());
    aggregate.addArgument(arg0.toExpression());
    return aggregate;
}
 
Example 6
Source Project: dble   File: ItemSumCount.java    License: GNU General Public License v2.0 5 votes vote down vote up
@Override
public SQLExpr toExpression() {
    SQLAggregateExpr aggregate = new SQLAggregateExpr(funcName());
    if (hasWithDistinct()) {
        for (Item arg : args)
            aggregate.addArgument(arg.toExpression());
        aggregate.setOption(SQLAggregateOption.DISTINCT);
    } else {
        Item arg0 = getArg(0);
        aggregate.addArgument(arg0.toExpression());
    }
    return aggregate;
}