use of io.siddhi.query.api.execution.query.output.stream.UpdateSet in project siddhi by wso2.
the class SiddhiQLBaseVisitorImpl method visitSet_clause.
/**
* {@inheritDoc}
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*
* @param ctx
*/
@Override
public UpdateSet visitSet_clause(@NotNull SiddhiQLParser.Set_clauseContext ctx) {
UpdateSet updateSet = new UpdateSet();
for (SiddhiQLParser.Set_assignmentContext setAssignmentContext : ctx.set_assignment()) {
updateSet.set(((Variable) visit(setAssignmentContext.attribute_reference())), (Expression) visit(setAssignmentContext.expression()));
}
populateQueryContext(updateSet, ctx);
return updateSet;
}
use of io.siddhi.query.api.execution.query.output.stream.UpdateSet in project siddhi by wso2.
the class SiddhiQLBaseVisitorImpl method visitStore_query_output.
/**
* {@inheritDoc}
* <p>
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override
public OutputStream visitStore_query_output(@NotNull SiddhiQLParser.Store_query_outputContext ctx) {
if (ctx.DELETE() != null) {
Source source = (Source) visit(ctx.target());
if (source.isInnerStream || source.isFaultStream) {
throw newSiddhiParserException(ctx, "DELETE can be only used with Tables!");
}
Expression expression = null;
if (ctx.expression() != null) {
expression = (Expression) visit(ctx.expression());
}
OutputStream outputStream = new DeleteStream(source.streamId, expression);
populateQueryContext(outputStream, ctx);
return outputStream;
} else if (ctx.UPDATE() != null) {
Source source = (Source) visit(ctx.target());
if (source.isInnerStream || source.isFaultStream) {
throw newSiddhiParserException(ctx, "DELETE can be only used with Tables!");
}
if (ctx.set_clause() != null) {
OutputStream outputStream = new UpdateStream(source.streamId, (UpdateSet) visit(ctx.set_clause()), (Expression) visit(ctx.expression()));
populateQueryContext(outputStream, ctx);
return outputStream;
} else {
OutputStream outputStream = new UpdateStream(source.streamId, (Expression) visit(ctx.expression()));
populateQueryContext(outputStream, ctx);
return outputStream;
}
} else {
throw newSiddhiParserException(ctx);
}
}
Aggregations