use of com.developmentontheedge.sql.model.AstOrderedSetAggregate in project be5 by DevelopmentOnTheEdge.
the class OracleTransformer method transformStringAgg.
@Override
protected void transformStringAgg(AstFunNode node) {
node.setFunction(LISTAGG);
if (node.isDistinct())
throw new IllegalStateException("DISTINCT clause is unsupported for " + node.getFunction().getName());
AstOrderBy orderBy;
if (node.child(node.jjtGetNumChildren() - 1) instanceof AstOrderBy) {
orderBy = (AstOrderBy) node.child(node.jjtGetNumChildren() - 1);
node.removeChild(node.jjtGetNumChildren() - 1);
} else {
orderBy = new AstOrderBy(new AstOrderingElement(node.child(0)));
}
node.replaceWith(new AstOrderedSetAggregate((AstFunNode) node.clone(), new AstWithinGroup(orderBy)));
}
use of com.developmentontheedge.sql.model.AstOrderedSetAggregate in project be5 by DevelopmentOnTheEdge.
the class DB2Transformer method transformStringAgg.
@Override
protected void transformStringAgg(AstFunNode node) {
node.setFunction(LISTAGG);
if (node.isDistinct())
throw new IllegalStateException("DISTINCT clause is unsupported for " + node.getFunction().getName());
if (node.child(node.jjtGetNumChildren() - 1) instanceof AstOrderBy) {
AstOrderBy orderBy = (AstOrderBy) node.child(node.jjtGetNumChildren() - 1);
node.removeChild(node.jjtGetNumChildren() - 1);
node.replaceWith(new AstOrderedSetAggregate((AstFunNode) node.clone(), new AstWithinGroup(orderBy)));
}
}
Aggregations