use of io.siddhi.query.api.execution.query.output.stream.DeleteStream 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);
}
}
use of io.siddhi.query.api.execution.query.output.stream.DeleteStream in project siddhi by wso2.
the class Query method deleteBy.
public void deleteBy(String outputTableId, Expression onDeletingExpression) {
this.outputStream = new DeleteStream(outputTableId, onDeletingExpression);
updateOutputEventType(outputRate, outputStream);
}
Aggregations