use of org.wso2.ballerinalang.compiler.tree.clauses.BLangSelectExpression in project ballerina by ballerina-lang.
the class SqlQueryBuilder method createSQLSelectExpressionClause.
private void createSQLSelectExpressionClause(BLangSelectClause select) {
List<? extends SelectExpressionNode> selectExprList = select.getSelectExpressions();
selectExprClause = new StringBuilder();
selectExprClause.append("select ");
if (selectExprList != null && !selectExprList.isEmpty()) {
Iterator<? extends SelectExpressionNode> iterator = selectExprList.iterator();
BLangSelectExpression selectExpression = (BLangSelectExpression) iterator.next();
selectExpression.accept(this);
selectExprClause.append(selectExpr);
while (iterator.hasNext()) {
selectExpression = (BLangSelectExpression) iterator.next();
selectExprClause.append(", ");
selectExpression.accept(this);
selectExprClause.append(selectExpr);
}
} else if (select.isSelectAll()) {
selectExprClause.append("* ");
}
}
use of org.wso2.ballerinalang.compiler.tree.clauses.BLangSelectExpression in project ballerina by ballerina-lang.
the class TypeChecker method visit.
@Override
public void visit(BLangSelectClause selectClause) {
List<? extends SelectExpressionNode> selectExprList = selectClause.getSelectExpressions();
selectExprList.forEach(selectExpr -> ((BLangSelectExpression) selectExpr).accept(this));
BLangGroupBy groupBy = (BLangGroupBy) selectClause.getGroupBy();
if (groupBy != null) {
groupBy.accept(this);
}
BLangHaving having = (BLangHaving) selectClause.getHaving();
if (having != null) {
having.accept(this);
}
}
use of org.wso2.ballerinalang.compiler.tree.clauses.BLangSelectExpression in project ballerina by ballerina-lang.
the class SqlQueryBuilder method visit.
@Override
public void visit(BLangSelectExpression selectExpression) {
BLangExpression expr = (BLangExpression) selectExpression.getExpression();
selectExpr = new StringBuilder();
addParametrizedSQL(expr, selectExpr, selectExprParams);
String identifier = selectExpression.getIdentifier();
if (identifier != null) {
selectExpr.append(" as ").append(identifier);
}
}
Aggregations