Search in sources :

Example 6 with BLangSelectClause

use of org.wso2.ballerinalang.compiler.tree.clauses.BLangSelectClause 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("* ");
    }
}
Also used : BLangSelectExpression(org.wso2.ballerinalang.compiler.tree.clauses.BLangSelectExpression)

Example 7 with BLangSelectClause

use of org.wso2.ballerinalang.compiler.tree.clauses.BLangSelectClause in project ballerina by ballerina-lang.

the class SqlQueryBuilder method createSQLGroupByClause.

private void createSQLGroupByClause(BLangSelectClause select) {
    BLangGroupBy groupBy = (BLangGroupBy) select.getGroupBy();
    groupBy.accept(this);
}
Also used : BLangGroupBy(org.wso2.ballerinalang.compiler.tree.clauses.BLangGroupBy)

Example 8 with BLangSelectClause

use of org.wso2.ballerinalang.compiler.tree.clauses.BLangSelectClause in project ballerina by ballerina-lang.

the class SemanticAnalyzer method visit.

public void visit(BLangStreamingQueryStatement streamingQueryStatement) {
    StreamingInput streamingInput = streamingQueryStatement.getStreamingInput();
    if (streamingInput != null) {
        ((BLangStreamingInput) streamingInput).accept(this);
        JoinStreamingInput joinStreamingInput = streamingQueryStatement.getJoiningInput();
        if (joinStreamingInput != null) {
            ((BLangJoinStreamingInput) joinStreamingInput).accept(this);
        }
    }
    SelectClauseNode selectClauseNode = streamingQueryStatement.getSelectClause();
    if (selectClauseNode != null) {
        ((BLangSelectClause) selectClauseNode).accept(this);
    }
    OrderByNode orderByNode = streamingQueryStatement.getOrderbyClause();
    if (orderByNode != null) {
        ((BLangOrderBy) orderByNode).accept(this);
    }
    StreamActionNode streamActionNode = streamingQueryStatement.getStreamingAction();
    if (streamActionNode != null) {
        ((BLangStreamAction) streamActionNode).accept(this);
    }
    BLangPatternClause patternClause = (BLangPatternClause) streamingQueryStatement.getPatternClause();
    if (patternClause != null) {
        patternClause.accept(this);
    }
}
Also used : JoinStreamingInput(org.ballerinalang.model.tree.clauses.JoinStreamingInput) BLangPatternStreamingInput(org.wso2.ballerinalang.compiler.tree.clauses.BLangPatternStreamingInput) BLangStreamingInput(org.wso2.ballerinalang.compiler.tree.clauses.BLangStreamingInput) BLangJoinStreamingInput(org.wso2.ballerinalang.compiler.tree.clauses.BLangJoinStreamingInput) StreamingInput(org.ballerinalang.model.tree.clauses.StreamingInput) BLangSelectClause(org.wso2.ballerinalang.compiler.tree.clauses.BLangSelectClause) BLangJoinStreamingInput(org.wso2.ballerinalang.compiler.tree.clauses.BLangJoinStreamingInput) StreamActionNode(org.ballerinalang.model.tree.clauses.StreamActionNode) JoinStreamingInput(org.ballerinalang.model.tree.clauses.JoinStreamingInput) BLangJoinStreamingInput(org.wso2.ballerinalang.compiler.tree.clauses.BLangJoinStreamingInput) OrderByNode(org.ballerinalang.model.tree.clauses.OrderByNode) BLangStreamAction(org.wso2.ballerinalang.compiler.tree.clauses.BLangStreamAction) SelectClauseNode(org.ballerinalang.model.tree.clauses.SelectClauseNode) BLangPatternClause(org.wso2.ballerinalang.compiler.tree.clauses.BLangPatternClause) BLangOrderBy(org.wso2.ballerinalang.compiler.tree.clauses.BLangOrderBy) BLangStreamingInput(org.wso2.ballerinalang.compiler.tree.clauses.BLangStreamingInput)

Example 9 with BLangSelectClause

use of org.wso2.ballerinalang.compiler.tree.clauses.BLangSelectClause 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);
    }
}
Also used : BLangGroupBy(org.wso2.ballerinalang.compiler.tree.clauses.BLangGroupBy) BLangHaving(org.wso2.ballerinalang.compiler.tree.clauses.BLangHaving)

Example 10 with BLangSelectClause

use of org.wso2.ballerinalang.compiler.tree.clauses.BLangSelectClause in project ballerina by ballerina-lang.

the class SiddhiQueryBuilder method createSiddhiGroupByClause.

private void createSiddhiGroupByClause(BLangSelectClause select) {
    BLangGroupBy groupBy = (BLangGroupBy) select.getGroupBy();
    groupBy.accept(this);
}
Also used : BLangGroupBy(org.wso2.ballerinalang.compiler.tree.clauses.BLangGroupBy)

Aggregations

BLangGroupBy (org.wso2.ballerinalang.compiler.tree.clauses.BLangGroupBy)4 BLangHaving (org.wso2.ballerinalang.compiler.tree.clauses.BLangHaving)4 BLangJoinStreamingInput (org.wso2.ballerinalang.compiler.tree.clauses.BLangJoinStreamingInput)3 BLangOrderBy (org.wso2.ballerinalang.compiler.tree.clauses.BLangOrderBy)3 BLangSelectClause (org.wso2.ballerinalang.compiler.tree.clauses.BLangSelectClause)3 BLangSelectExpression (org.wso2.ballerinalang.compiler.tree.clauses.BLangSelectExpression)3 BLangStreamingInput (org.wso2.ballerinalang.compiler.tree.clauses.BLangStreamingInput)3 JoinStreamingInput (org.ballerinalang.model.tree.clauses.JoinStreamingInput)2 OrderByNode (org.ballerinalang.model.tree.clauses.OrderByNode)2 SelectClauseNode (org.ballerinalang.model.tree.clauses.SelectClauseNode)2 StreamingInput (org.ballerinalang.model.tree.clauses.StreamingInput)2 BLangPatternClause (org.wso2.ballerinalang.compiler.tree.clauses.BLangPatternClause)2 BLangPatternStreamingInput (org.wso2.ballerinalang.compiler.tree.clauses.BLangPatternStreamingInput)2 BLangStreamAction (org.wso2.ballerinalang.compiler.tree.clauses.BLangStreamAction)2 GroupByNode (org.ballerinalang.model.tree.clauses.GroupByNode)1 HavingNode (org.ballerinalang.model.tree.clauses.HavingNode)1 OutputRateLimitNode (org.ballerinalang.model.tree.clauses.OutputRateLimitNode)1 PatternClause (org.ballerinalang.model.tree.clauses.PatternClause)1 SelectExpressionNode (org.ballerinalang.model.tree.clauses.SelectExpressionNode)1 StreamActionNode (org.ballerinalang.model.tree.clauses.StreamActionNode)1