From 348fd7ffce9212560adf33cc24de849e131faf56 Mon Sep 17 00:00:00 2001 From: wumpz Date: Sat, 6 Jun 2015 00:29:30 +0200 Subject: [PATCH] completed ExpressionVisitorAdapter --- .../expression/ExpressionVisitorAdapter.java | 41 +++++++++++++++++-- 1 file changed, 38 insertions(+), 3 deletions(-) diff --git a/src/main/java/net/sf/jsqlparser/expression/ExpressionVisitorAdapter.java b/src/main/java/net/sf/jsqlparser/expression/ExpressionVisitorAdapter.java index f6e659a20..5146474fb 100644 --- a/src/main/java/net/sf/jsqlparser/expression/ExpressionVisitorAdapter.java +++ b/src/main/java/net/sf/jsqlparser/expression/ExpressionVisitorAdapter.java @@ -27,10 +27,33 @@ import net.sf.jsqlparser.expression.operators.relational.*; import net.sf.jsqlparser.schema.Column; import net.sf.jsqlparser.statement.select.OrderByElement; +import net.sf.jsqlparser.statement.select.PivotVisitor; +import net.sf.jsqlparser.statement.select.SelectVisitor; import net.sf.jsqlparser.statement.select.SubSelect; +import net.sf.jsqlparser.statement.select.WithItem; public class ExpressionVisitorAdapter implements ExpressionVisitor, ItemsListVisitor { + private SelectVisitor selectVisitor; + + public SelectVisitor getSelectVisitor() { + return selectVisitor; + } + + public void setSelectVisitor(SelectVisitor selectVisitor) { + this.selectVisitor = selectVisitor; + } + + private PivotVisitor pivotVisitor; + + public PivotVisitor getPivotVisitor() { + return pivotVisitor; + } + + public void setPivotVisitor(PivotVisitor pivotVisitor) { + this.pivotVisitor = pivotVisitor; + } + @Override public void visit(NullValue value) { @@ -38,7 +61,12 @@ public void visit(NullValue value) { @Override public void visit(Function function) { - + if (function.getParameters() != null) { + function.getParameters().accept(this); + } + if (function.getKeep() != null) { + function.getKeep().accept(this); + } } @Override @@ -182,7 +210,15 @@ public void visit(Column column) { @Override public void visit(SubSelect subSelect) { - + if (selectVisitor != null) { + for (WithItem item : subSelect.getWithItemsList()) { + item.accept(selectVisitor); + } + } + subSelect.getSelectBody().accept(selectVisitor); + if (pivotVisitor != null && subSelect.getPivot() != null) { + subSelect.getPivot().accept(pivotVisitor); + } } @Override @@ -274,7 +310,6 @@ public void visit(ExtractExpression expr) { @Override public void visit(IntervalExpression expr) { - } @Override