use of org.wso2.ballerinalang.compiler.tree.expressions.BLangTableQueryExpression in project ballerina by ballerina-lang.
the class Desugar method getJoinTableVarRef.
private BLangSimpleVarRef getJoinTableVarRef(BLangTableQueryExpression tableQueryExpression) {
JoinStreamingInput joinStreamingInput = tableQueryExpression.getTableQuery().getJoinStreamingInput();
BLangSimpleVarRef joinTable = null;
if (joinStreamingInput != null) {
joinTable = (BLangSimpleVarRef) joinStreamingInput.getStreamingInput().getStreamReference();
joinTable = rewrite(joinTable, env);
}
return joinTable;
}
use of org.wso2.ballerinalang.compiler.tree.expressions.BLangTableQueryExpression in project ballerina by ballerina-lang.
the class Desugar method getReturnType.
private BLangStructLiteral getReturnType(BLangTableQueryExpression tableQueryExpression) {
// create a literal to represent the sql query.
BTableType tableType = (BTableType) tableQueryExpression.type;
BStructType structType = (BStructType) tableType.constraint;
return new BLangStructLiteral(new ArrayList<>(), structType);
}
use of org.wso2.ballerinalang.compiler.tree.expressions.BLangTableQueryExpression in project ballerina by ballerina-lang.
the class SqlQueryBuilder method visit.
@Override
public void visit(BLangTableQueryExpression tableQueryExpression) {
orderByClause = null;
whereClause = null;
joinStreamingInputClause = null;
streamingInputClause = null;
selectExprClause = null;
selectExpr = null;
groupByClause = null;
havingClause = null;
selectExprParams = new ArrayList<>();
havingExprParams = new ArrayList<>();
joinOnExprParams = new ArrayList<>();
exprParams = new ArrayList<>();
whereExprParams = new ArrayList<>();
exprStack = new Stack<>();
BLangTableQuery tableQuery = ((BLangTableQuery) tableQueryExpression.getTableQuery());
tableQuery.accept(this);
tableQueryExpression.setSqlQuery(tableQuery.getSqlQuery());
tableQueryExpression.addParams(tableQuery.getParams());
}
use of org.wso2.ballerinalang.compiler.tree.expressions.BLangTableQueryExpression in project ballerina by ballerina-lang.
the class TypeChecker method visit.
@Override
public void visit(BLangTableQueryExpression tableQueryExpression) {
BType actualType = symTable.errType;
int expTypeTag = expTypes.get(0).tag;
if (expTypeTag == TypeTags.TABLE) {
actualType = expTypes.get(0);
} else if (expTypeTag != TypeTags.ERROR) {
dlog.error(tableQueryExpression.pos, DiagnosticCode.INCOMPATIBLE_TYPES_CONVERSION, expTypes.get(0));
}
BLangTableQuery tableQuery = (BLangTableQuery) tableQueryExpression.getTableQuery();
tableQuery.accept(this);
resultTypes = types.checkTypes(tableQueryExpression, Lists.of(actualType), expTypes);
}
use of org.wso2.ballerinalang.compiler.tree.expressions.BLangTableQueryExpression in project ballerina by ballerina-lang.
the class Desugar method getSQLPreparedStatement.
private BLangLiteral getSQLPreparedStatement(BLangTableQueryExpression tableQueryExpression) {
// create a literal to represent the sql query.
BLangLiteral sqlQueryLiteral = (BLangLiteral) TreeBuilder.createLiteralExpression();
sqlQueryLiteral.typeTag = TypeTags.STRING;
// assign the sql query from table expression to the literal.
sqlQueryLiteral.value = tableQueryExpression.getSqlQuery();
sqlQueryLiteral.type = symTable.getTypeFromTag(sqlQueryLiteral.typeTag);
return sqlQueryLiteral;
}
Aggregations