.
+ * Dual licensed under GNU LGPL 2.1 or Apache License 2.0
* #L%
*/
package net.sf.jsqlparser.expression;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
import java.util.List;
+import java.util.Optional;
import net.sf.jsqlparser.parser.ASTNodeAccessImpl;
import net.sf.jsqlparser.statement.select.PlainSelect;
/**
* CASE/WHEN expression.
+ *
+ * Syntax:
*
- * Syntax:
+ *
+ *
* CASE
* WHEN condition THEN expression
* [WHEN condition THEN expression]...
* [ELSE expression]
* END
- *
+ *
+ *
*
- *
- * or
- *
+ *
+ * or
+ *
*
- *
+ *
+ *
* CASE expression
* WHEN condition THEN expression
* [WHEN condition THEN expression]...
* [ELSE expression]
* END
- *
- *
- * See also: https://aurora.vcu.edu/db2help/db2s0/frame3.htm#casexp
- * http://sybooks.sybase.com/onlinebooks/group-as/asg1251e /commands/
- *
- * @ebt-link;pt=5954?target=%25N%15_52628_START_RESTART_N%25
- *
- *
- * @author Havard Rast Blok
+ *
+ *
*/
public class CaseExpression extends ASTNodeAccessImpl implements Expression {
+ private boolean usingBrackets = false;
private Expression switchExpression;
private List whenClauses;
private Expression elseExpression;
+ public CaseExpression() {}
+
+ public CaseExpression(WhenClause... whenClauses) {
+ this.whenClauses = Arrays.asList(whenClauses);
+ }
+
+ public CaseExpression(Expression elseExpression, WhenClause... whenClauses) {
+ this.elseExpression = elseExpression;
+ this.whenClauses = Arrays.asList(whenClauses);
+ }
+
+
@Override
- public void accept(ExpressionVisitor expressionVisitor) {
- expressionVisitor.visit(this);
+ public T accept(ExpressionVisitor expressionVisitor, S context) {
+ return expressionVisitor.visit(this, context);
}
- /**
- * @return Returns the switchExpression.
- */
public Expression getSwitchExpression() {
return switchExpression;
}
- /**
- * @param switchExpression The switchExpression to set.
- */
public void setSwitchExpression(Expression switchExpression) {
this.switchExpression = switchExpression;
}
@@ -112,8 +110,73 @@ public void setWhenClauses(List whenClauses) {
@Override
public String toString() {
- return "CASE " + ((switchExpression != null) ? switchExpression + " " : "")
+ return (usingBrackets ? "(" : "") + "CASE "
+ + ((switchExpression != null) ? switchExpression + " " : "")
+ PlainSelect.getStringList(whenClauses, false, false) + " "
- + ((elseExpression != null) ? "ELSE " + elseExpression + " " : "") + "END";
+ + ((elseExpression != null) ? "ELSE " + elseExpression + " " : "") + "END"
+ + (usingBrackets ? ")" : "");
+ }
+
+ public CaseExpression withSwitchExpression(Expression switchExpression) {
+ this.setSwitchExpression(switchExpression);
+ return this;
+ }
+
+ public CaseExpression withWhenClauses(WhenClause... whenClauses) {
+ return this.withWhenClauses(Arrays.asList(whenClauses));
+ }
+
+ public CaseExpression withWhenClauses(List whenClauses) {
+ this.setWhenClauses(whenClauses);
+ return this;
+ }
+
+ public CaseExpression withElseExpression(Expression elseExpression) {
+ this.setElseExpression(elseExpression);
+ return this;
+ }
+
+ public CaseExpression addWhenClauses(WhenClause... whenClauses) {
+ List collection =
+ Optional.ofNullable(getWhenClauses()).orElseGet(ArrayList::new);
+ Collections.addAll(collection, whenClauses);
+ return this.withWhenClauses(collection);
+ }
+
+ public CaseExpression addWhenClauses(Collection extends WhenClause> whenClauses) {
+ List collection =
+ Optional.ofNullable(getWhenClauses()).orElseGet(ArrayList::new);
+ collection.addAll(whenClauses);
+ return this.withWhenClauses(collection);
+ }
+
+ public E getSwitchExpression(Class type) {
+ return type.cast(getSwitchExpression());
+ }
+
+ public E getElseExpression(Class type) {
+ return type.cast(getElseExpression());
+ }
+
+ /**
+ * @return the usingBrackets
+ */
+ public boolean isUsingBrackets() {
+ return usingBrackets;
+ }
+
+ /**
+ * @param usingBrackets the usingBrackets to set
+ */
+ public void setUsingBrackets(boolean usingBrackets) {
+ this.usingBrackets = usingBrackets;
+ }
+
+ /**
+ * @param usingBrackets the usingBrackets to set
+ */
+ public CaseExpression withUsingBrackets(boolean usingBrackets) {
+ this.usingBrackets = usingBrackets;
+ return this;
}
}
diff --git a/src/main/java/net/sf/jsqlparser/expression/CastExpression.java b/src/main/java/net/sf/jsqlparser/expression/CastExpression.java
index 89cb4c91b..f06682068 100644
--- a/src/main/java/net/sf/jsqlparser/expression/CastExpression.java
+++ b/src/main/java/net/sf/jsqlparser/expression/CastExpression.java
@@ -1,45 +1,151 @@
-/*
+/*-
* #%L
* JSQLParser library
* %%
- * Copyright (C) 2004 - 2013 JSQLParser
+ * Copyright (C) 2004 - 2019 JSQLParser
* %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation, either version 2.1 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Lesser Public License for more details.
- *
- * You should have received a copy of the GNU General Lesser Public
- * License along with this program. If not, see
- * .
+ * Dual licensed under GNU LGPL 2.1 or Apache License 2.0
* #L%
*/
package net.sf.jsqlparser.expression;
import net.sf.jsqlparser.parser.ASTNodeAccessImpl;
import net.sf.jsqlparser.statement.create.table.ColDataType;
+import net.sf.jsqlparser.statement.create.table.ColumnDefinition;
+import net.sf.jsqlparser.statement.select.Select;
+
+import java.util.ArrayList;
+import java.util.Set;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
-/**
- *
- * @author tw
- */
public class CastExpression extends ASTNodeAccessImpl implements Expression {
+ private final static Pattern PATTERN =
+ Pattern.compile("(^[a-z0-9_]*){1}", Pattern.CASE_INSENSITIVE);
+ public String keyword;
private Expression leftExpression;
- private ColDataType type;
- private boolean useCastKeyword = true;
+ private ColDataType colDataType = null;
+ private ArrayList columnDefinitions = new ArrayList<>();
+
+ private boolean isImplicitCast = false;
+
+ // BigQuery specific FORMAT clause:
+ // https://cloud.google.com/bigquery/docs/reference/standard-sql/conversion_functions#cast_as_date
+ private String format = null;
+
+ public CastExpression(String keyword, Expression leftExpression, String dataType) {
+ this.keyword = keyword;
+ this.leftExpression = leftExpression;
+ this.colDataType = new ColDataType(dataType);
+ }
+
+ // Implicit Cast
+ public CastExpression(String dataType, String value) {
+ this.keyword = null;
+ this.isImplicitCast = true;
+ this.colDataType = new ColDataType(dataType);
+ this.leftExpression = new StringValue(value);
+ }
+
+ public CastExpression(ColDataType colDataType, String value) {
+ this.keyword = null;
+ this.isImplicitCast = true;
+ this.colDataType = colDataType;
+ this.leftExpression = new StringValue(value);
+ }
+
+ public CastExpression(ColDataType colDataType, Long value) {
+ this.keyword = null;
+ this.isImplicitCast = true;
+ this.colDataType = colDataType;
+ this.leftExpression = new LongValue(value);
+ }
+
+ public CastExpression(ColDataType colDataType, Double value) {
+ this.keyword = null;
+ this.isImplicitCast = true;
+ this.colDataType = colDataType;
+ this.leftExpression = new DoubleValue(value);
+ }
+
+ public CastExpression(Expression leftExpression, String dataType) {
+ this.keyword = null;
+ this.leftExpression = leftExpression;
+ this.colDataType = new ColDataType(dataType);
+ }
+
+
+ public CastExpression(String keyword) {
+ this.keyword = keyword;
+ }
+
+ public CastExpression() {
+ this("CAST");
+ }
+
+ public static boolean isOf(ColDataType colDataType, DataType... types) {
+ return Set.of(types).contains(DataType.from(colDataType.getDataType()));
+ }
+
+ public static boolean isTime(ColDataType colDataType) {
+ return isOf(colDataType, DataType.TIME, DataType.TIME_WITH_TIME_ZONE,
+ DataType.TIME_WITHOUT_TIME_ZONE);
+ }
+
+ public static boolean isTimeStamp(ColDataType colDataType) {
+ return isOf(colDataType, DataType.TIMESTAMP_NS, DataType.TIMESTAMP,
+ DataType.TIMESTAMP_WITHOUT_TIME_ZONE,
+ DataType.DATETIME, DataType.TIMESTAMP_MS, DataType.TIMESTAMP_S,
+ DataType.TIMESTAMPTZ, DataType.TIMESTAMP_WITH_TIME_ZONE);
+ }
+
+ public static boolean isDate(ColDataType colDataType) {
+ return isOf(colDataType, DataType.DATE);
+ }
+
+ public static boolean isBLOB(ColDataType colDataType) {
+ return isOf(colDataType, DataType.BLOB, DataType.BYTEA, DataType.BINARY, DataType.VARBINARY,
+ DataType.BYTES, DataType.VARBYTE);
+ }
+
+ public static boolean isFloat(ColDataType colDataType) {
+ return isOf(colDataType, DataType.REAL, DataType.FLOAT4, DataType.FLOAT, DataType.DOUBLE,
+ DataType.DOUBLE_PRECISION, DataType.FLOAT8);
+ }
- public ColDataType getType() {
- return type;
+ public static boolean isInteger(ColDataType colDataType) {
+ return isOf(colDataType, DataType.TINYINT, DataType.INT1, DataType.SMALLINT, DataType.INT2,
+ DataType.SHORT, DataType.INTEGER, DataType.INT4, DataType.INT, DataType.SIGNED,
+ DataType.BIGINT, DataType.INT8, DataType.LONG, DataType.HUGEINT, DataType.UTINYINT,
+ DataType.USMALLINT, DataType.UINTEGER, DataType.UBIGINT, DataType.UHUGEINT);
}
- public void setType(ColDataType type) {
- this.type = type;
+ public static boolean isDecimal(ColDataType colDataType) {
+ return isOf(colDataType, DataType.DECIMAL, DataType.NUMBER, DataType.NUMERIC);
+ }
+
+ public static boolean isText(ColDataType colDataType) {
+ return isOf(colDataType, DataType.VARCHAR, DataType.NVARCHAR, DataType.CHAR, DataType.NCHAR,
+ DataType.BPCHAR, DataType.STRING, DataType.TEXT, DataType.CLOB);
+ }
+
+ public ColDataType getColDataType() {
+ return colDataType;
+ }
+
+ public void setColDataType(ColDataType colDataType) {
+ this.colDataType = colDataType;
+ }
+
+ public ArrayList getColumnDefinitions() {
+ return columnDefinitions;
+ }
+
+ public void addColumnDefinition(ColumnDefinition columnDefinition) {
+ this.columnDefinitions.add(columnDefinition);
}
public Expression getLeftExpression() {
@@ -50,25 +156,140 @@ public void setLeftExpression(Expression expression) {
leftExpression = expression;
}
+ public boolean isImplicitCast() {
+ return isImplicitCast;
+ }
+
+ public CastExpression setImplicitCast(boolean implicitCast) {
+ isImplicitCast = implicitCast;
+ return this;
+ }
+
@Override
- public void accept(ExpressionVisitor expressionVisitor) {
- expressionVisitor.visit(this);
+ public T accept(ExpressionVisitor expressionVisitor, S context) {
+ return expressionVisitor.visit(this, context);
}
+ @Deprecated
public boolean isUseCastKeyword() {
- return useCastKeyword;
+ return keyword != null && !keyword.isEmpty();
}
+ @Deprecated
public void setUseCastKeyword(boolean useCastKeyword) {
- this.useCastKeyword = useCastKeyword;
+ if (useCastKeyword) {
+ if (keyword == null || keyword.isEmpty()) {
+ keyword = "CAST";
+ }
+ } else {
+ keyword = null;
+ }
+ }
+
+ public String getFormat() {
+ return format;
+ }
+
+ public CastExpression setFormat(String format) {
+ this.format = format;
+ return this;
}
@Override
public String toString() {
- if (useCastKeyword) {
- return "CAST(" + leftExpression + " AS " + type.toString() + ")";
+ String formatStr = format != null && !format.isEmpty()
+ ? " FORMAT " + format
+ : "";
+ if (isImplicitCast) {
+ return colDataType + " " + leftExpression;
+ } else if (keyword != null && !keyword.isEmpty()) {
+ return columnDefinitions.size() > 1
+ ? keyword + "(" + leftExpression + " AS ROW("
+ + Select.getStringList(columnDefinitions) + ")" + formatStr + ")"
+ : keyword + "(" + leftExpression + " AS " + colDataType.toString() + formatStr
+ + ")";
} else {
- return leftExpression + "::" + type.toString();
+ return leftExpression + "::" + colDataType.toString();
+ }
+ }
+
+ public CastExpression withType(ColDataType type) {
+ this.setColDataType(type);
+ return this;
+ }
+
+ public CastExpression withUseCastKeyword(boolean useCastKeyword) {
+ this.setUseCastKeyword(useCastKeyword);
+ return this;
+ }
+
+ public CastExpression withLeftExpression(Expression leftExpression) {
+ this.setLeftExpression(leftExpression);
+ return this;
+ }
+
+ public E getLeftExpression(Class type) {
+ return type.cast(getLeftExpression());
+ }
+
+ public boolean isOf(CastExpression anotherCast) {
+ return this.colDataType.equals(anotherCast.colDataType);
+ }
+
+ public boolean isOf(DataType... types) {
+ return Set.of(types).contains(DataType.from(colDataType.getDataType()));
+ }
+
+ public boolean isTime() {
+ return isTime(this.colDataType);
+ }
+
+ public boolean isTimeStamp() {
+ return isTimeStamp(this.colDataType);
+ }
+
+ public boolean isDate() {
+ return isDate(this.colDataType);
+ }
+
+ public boolean isBLOB() {
+ return isBLOB(this.colDataType);
+ }
+
+ public boolean isFloat() {
+ return isFloat(this.colDataType);
+ }
+
+ public boolean isInteger() {
+ return isInteger(this.colDataType);
+ }
+
+ public boolean isDecimal() {
+ return isDecimal(this.colDataType);
+ }
+
+ public boolean isText() {
+ return isText(this.colDataType);
+ }
+
+ public enum DataType {
+ ARRAY, BIT, BITSTRING, BLOB, BYTEA, BINARY, VARBINARY, BYTES, BOOLEAN, BOOL, ENUM, INTERVAL, LIST, MAP, STRUCT, TINYINT, INT1, SMALLINT, INT2, SHORT, INTEGER, INT4, INT, SIGNED, BIGINT, INT8, LONG, HUGEINT, UTINYINT, USMALLINT, UINTEGER, UBIGINT, UHUGEINT, DECIMAL, NUMBER, NUMERIC, REAL, FLOAT4, FLOAT, DOUBLE, DOUBLE_PRECISION, FLOAT8, FLOAT64, UUID, VARCHAR, NVARCHAR, CHAR, NCHAR, BPCHAR, STRING, TEXT, CLOB, DATE, TIME, TIME_WITHOUT_TIME_ZONE, TIMETZ, TIME_WITH_TIME_ZONE, TIMESTAMP_NS, TIMESTAMP, TIMESTAMP_WITHOUT_TIME_ZONE, DATETIME, TIMESTAMP_MS, TIMESTAMP_S, TIMESTAMPTZ, TIMESTAMP_WITH_TIME_ZONE, UNKNOWN, VARBYTE, JSON;
+
+ public static DataType from(String typeStr) {
+ Matcher matcher = PATTERN.matcher(typeStr.trim().replaceAll("\\s+", "_").toUpperCase());
+ if (matcher.find()) {
+ try {
+ return Enum.valueOf(DataType.class, matcher.group(0));
+ } catch (Exception ex) {
+ Logger.getLogger(CastExpression.class.getName()).log(Level.FINE,
+ "Type " + typeStr + " unknown", ex);
+ return DataType.UNKNOWN;
+ }
+ } else {
+ Logger.getLogger(CastExpression.class.getName()).log(Level.FINE,
+ "Type " + typeStr + " unknown");
+ return DataType.UNKNOWN;
+ }
}
}
}
diff --git a/src/main/java/net/sf/jsqlparser/expression/CollateExpression.java b/src/main/java/net/sf/jsqlparser/expression/CollateExpression.java
new file mode 100644
index 000000000..8a419b241
--- /dev/null
+++ b/src/main/java/net/sf/jsqlparser/expression/CollateExpression.java
@@ -0,0 +1,67 @@
+/*-
+ * #%L
+ * JSQLParser library
+ * %%
+ * Copyright (C) 2004 - 2019 JSQLParser
+ * %%
+ * Dual licensed under GNU LGPL 2.1 or Apache License 2.0
+ * #L%
+ */
+package net.sf.jsqlparser.expression;
+
+import net.sf.jsqlparser.parser.ASTNodeAccessImpl;
+
+public class CollateExpression extends ASTNodeAccessImpl implements Expression {
+
+ private Expression leftExpression;
+ private String collate;
+
+ public CollateExpression() {
+ // empty constructor
+ }
+
+ public CollateExpression(Expression leftExpression, String collate) {
+ this.leftExpression = leftExpression;
+ this.collate = collate;
+ }
+
+ @Override
+ public T accept(ExpressionVisitor expressionVisitor, S context) {
+ return expressionVisitor.visit(this, context);
+ }
+
+ public Expression getLeftExpression() {
+ return leftExpression;
+ }
+
+ public void setLeftExpression(Expression leftExpression) {
+ this.leftExpression = leftExpression;
+ }
+
+ public String getCollate() {
+ return collate;
+ }
+
+ public void setCollate(String collate) {
+ this.collate = collate;
+ }
+
+ @Override
+ public String toString() {
+ return leftExpression.toString() + " COLLATE " + collate;
+ }
+
+ public CollateExpression withLeftExpression(Expression leftExpression) {
+ this.setLeftExpression(leftExpression);
+ return this;
+ }
+
+ public CollateExpression withCollate(String collate) {
+ this.setCollate(collate);
+ return this;
+ }
+
+ public E getLeftExpression(Class type) {
+ return type.cast(getLeftExpression());
+ }
+}
diff --git a/src/main/java/net/sf/jsqlparser/expression/ConnectByPriorOperator.java b/src/main/java/net/sf/jsqlparser/expression/ConnectByPriorOperator.java
new file mode 100644
index 000000000..45c2fde6a
--- /dev/null
+++ b/src/main/java/net/sf/jsqlparser/expression/ConnectByPriorOperator.java
@@ -0,0 +1,74 @@
+/*-
+ * #%L
+ * JSQLParser library
+ * %%
+ * Copyright (C) 2004 - 2021 JSQLParser
+ * %%
+ * Dual licensed under GNU LGPL 2.1 or Apache License 2.0
+ * #L%
+ */
+/*
+ * Copyright (C) 2021 JSQLParser.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms of the
+ * GNU Lesser General Public License as published by the Free Software Foundation; either version
+ * 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
+ * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this library;
+ * if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ */
+
+package net.sf.jsqlparser.expression;
+
+import net.sf.jsqlparser.parser.ASTNodeAccessImpl;
+import net.sf.jsqlparser.schema.Column;
+
+import java.util.Objects;
+
+/**
+ *
+ * @author are
+ */
+public class ConnectByPriorOperator extends ASTNodeAccessImpl implements Expression {
+ private final Expression expression;
+
+ @Deprecated
+ public ConnectByPriorOperator(Column column) {
+ this.expression = Objects.requireNonNull(column,
+ "The COLUMN of the ConnectByPrior Operator must not be null");
+ }
+
+ public ConnectByPriorOperator(Expression column) {
+ this.expression = Objects.requireNonNull(column,
+ "The COLUMN of the ConnectByPrior Operator must not be null");
+ }
+
+ @Deprecated
+ public Expression getColumn() {
+ return getExpression();
+ }
+
+ public Expression getExpression() {
+ return expression;
+ }
+
+ @Override
+ public T accept(ExpressionVisitor expressionVisitor, S context) {
+ return expressionVisitor.visit(this, context);
+ }
+
+ public StringBuilder appendTo(StringBuilder builder) {
+ builder.append("PRIOR ").append(expression);
+ return builder;
+ }
+
+ @Override
+ public String toString() {
+ return appendTo(new StringBuilder()).toString();
+ }
+}
diff --git a/src/main/java/net/sf/jsqlparser/expression/ConnectByRootOperator.java b/src/main/java/net/sf/jsqlparser/expression/ConnectByRootOperator.java
new file mode 100644
index 000000000..776dc031e
--- /dev/null
+++ b/src/main/java/net/sf/jsqlparser/expression/ConnectByRootOperator.java
@@ -0,0 +1,74 @@
+/*-
+ * #%L
+ * JSQLParser library
+ * %%
+ * Copyright (C) 2004 - 2021 JSQLParser
+ * %%
+ * Dual licensed under GNU LGPL 2.1 or Apache License 2.0
+ * #L%
+ */
+/*
+ * Copyright (C) 2021 JSQLParser.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms of the
+ * GNU Lesser General Public License as published by the Free Software Foundation; either version
+ * 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
+ * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this library;
+ * if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ */
+
+package net.sf.jsqlparser.expression;
+
+import java.util.Objects;
+
+import net.sf.jsqlparser.parser.ASTNodeAccessImpl;
+import net.sf.jsqlparser.schema.Column;
+
+/**
+ * @author are
+ */
+public class ConnectByRootOperator extends ASTNodeAccessImpl implements Expression {
+ private final Expression expression;
+
+ @Deprecated
+ public ConnectByRootOperator(Column column) {
+ this.expression = Objects.requireNonNull(column,
+ "The COLUMN of the ConnectByRoot Operator must not be null");
+ }
+
+ public ConnectByRootOperator(Expression column) {
+ this.expression = Objects.requireNonNull(column,
+ "The EXPRESSION of the ConnectByRoot Operator must not be null");
+ }
+
+ @Deprecated
+ public Expression getColumn() {
+ return expression;
+ }
+
+ public Expression getExpression() {
+ return expression;
+ }
+
+ @Override
+ public T accept(ExpressionVisitor expressionVisitor, S context) {
+ return expressionVisitor.visit(this, context);
+ }
+
+ public StringBuilder appendTo(StringBuilder builder) {
+ builder.append("CONNECT_BY_ROOT ").append(expression);
+ return builder;
+ }
+
+ @Override
+ public String toString() {
+ return appendTo(new StringBuilder()).toString();
+ }
+
+}
diff --git a/src/main/java/net/sf/jsqlparser/expression/DateTimeLiteralExpression.java b/src/main/java/net/sf/jsqlparser/expression/DateTimeLiteralExpression.java
index 769d38bac..ccb15db4b 100644
--- a/src/main/java/net/sf/jsqlparser/expression/DateTimeLiteralExpression.java
+++ b/src/main/java/net/sf/jsqlparser/expression/DateTimeLiteralExpression.java
@@ -1,50 +1,16 @@
-/*
+/*-
* #%L
* JSQLParser library
* %%
- * Copyright (C) 2004 - 2016 JSQLParser
+ * Copyright (C) 2004 - 2019 JSQLParser
* %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation, either version 2.1 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Lesser Public License for more details.
- *
- * You should have received a copy of the GNU General Lesser Public
- * License along with this program. If not, see
- * .
+ * Dual licensed under GNU LGPL 2.1 or Apache License 2.0
* #L%
*/
- /*
- * Copyright (C) 2016 JSQLParser.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301 USA
- */
package net.sf.jsqlparser.expression;
import net.sf.jsqlparser.parser.ASTNodeAccessImpl;
-/**
- *
- * @author toben
- */
public class DateTimeLiteralExpression extends ASTNodeAccessImpl implements Expression {
private String value;
@@ -67,16 +33,30 @@ public void setType(DateTime type) {
}
@Override
- public void accept(ExpressionVisitor expressionVisitor) {
- expressionVisitor.visit(this);
+ public T accept(ExpressionVisitor expressionVisitor, S context) {
+ return expressionVisitor.visit(this, context);
}
@Override
public String toString() {
- return type.name() + " " + value;
+ return type != null ? type.name() + " " + value : value;
+ }
+
+ public DateTimeLiteralExpression withValue(String value) {
+ this.setValue(value);
+ return this;
}
- public static enum DateTime {
- DATE, TIME, TIMESTAMP;
+ public DateTimeLiteralExpression withType(DateTime type) {
+ this.setType(type);
+ return this;
+ }
+
+ public enum DateTime {
+ DATE, DATETIME, TIME, TIMESTAMP, TIMESTAMPTZ;
+
+ public static DateTime from(String dateTimeStr) {
+ return Enum.valueOf(DateTime.class, dateTimeStr.toUpperCase());
+ }
}
}
diff --git a/src/main/java/net/sf/jsqlparser/expression/DateUnitExpression.java b/src/main/java/net/sf/jsqlparser/expression/DateUnitExpression.java
new file mode 100644
index 000000000..298cff0cc
--- /dev/null
+++ b/src/main/java/net/sf/jsqlparser/expression/DateUnitExpression.java
@@ -0,0 +1,50 @@
+/*-
+ * #%L
+ * JSQLParser library
+ * %%
+ * Copyright (C) 2004 - 2019 JSQLParser
+ * %%
+ * Dual licensed under GNU LGPL 2.1 or Apache License 2.0
+ * #L%
+ */
+package net.sf.jsqlparser.expression;
+
+import net.sf.jsqlparser.parser.ASTNodeAccessImpl;
+
+import java.util.Objects;
+
+public class DateUnitExpression extends ASTNodeAccessImpl implements Expression {
+
+ private final DateUnit type;
+
+ public DateUnitExpression(DateUnit type) {
+ this.type = Objects.requireNonNull(type);
+ }
+
+ public DateUnitExpression(String DateUnitStr) {
+ this.type = Objects.requireNonNull(DateUnit.from(DateUnitStr));
+ }
+
+ public DateUnit getType() {
+ return type;
+ }
+
+
+ @Override
+ public T accept(ExpressionVisitor expressionVisitor, S context) {
+ return expressionVisitor.visit(this, context);
+ }
+
+ @Override
+ public String toString() {
+ return type.toString();
+ }
+
+ public enum DateUnit {
+ CENTURY, DECADE, YEAR, QUARTER, MONTH, WEEK, DAY, HOUR, MINUTE, SECOND, MILLISECOND, MICROSECOND, NANOSECOND;
+
+ public static DateUnit from(String UnitStr) {
+ return Enum.valueOf(DateUnit.class, UnitStr.toUpperCase());
+ }
+ }
+}
diff --git a/src/main/java/net/sf/jsqlparser/expression/DateValue.java b/src/main/java/net/sf/jsqlparser/expression/DateValue.java
index 72be75da1..d03a73c66 100644
--- a/src/main/java/net/sf/jsqlparser/expression/DateValue.java
+++ b/src/main/java/net/sf/jsqlparser/expression/DateValue.java
@@ -1,22 +1,10 @@
-/*
+/*-
* #%L
* JSQLParser library
* %%
- * Copyright (C) 2004 - 2013 JSQLParser
+ * Copyright (C) 2004 - 2019 JSQLParser
* %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation, either version 2.1 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Lesser Public License for more details.
- *
- * You should have received a copy of the GNU General Lesser Public
- * License along with this program. If not, see
- * .
+ * Dual licensed under GNU LGPL 2.1 or Apache License 2.0
* #L%
*/
package net.sf.jsqlparser.expression;
@@ -32,13 +20,26 @@ public class DateValue extends ASTNodeAccessImpl implements Expression {
private Date value;
+ public DateValue() {
+ // empty constructor
+ }
+
+ public DateValue(Date value) {
+ this.value = value;
+ }
+
+ /**
+ * A Date in the form {d 'yyyy-mm-dd'}
+ *
+ * @param value The text presentation of the Date to be parsed.
+ */
public DateValue(String value) {
- this.value = Date.valueOf(value.substring(1, value.length() - 1));
+ this(Date.valueOf(value.substring(1, value.length() - 1)));
}
@Override
- public void accept(ExpressionVisitor expressionVisitor) {
- expressionVisitor.visit(this);
+ public T accept(ExpressionVisitor expressionVisitor, S context) {
+ return expressionVisitor.visit(this, context);
}
public Date getValue() {
@@ -53,4 +54,9 @@ public void setValue(Date d) {
public String toString() {
return "{d '" + value.toString() + "'}";
}
+
+ public DateValue withValue(Date value) {
+ this.setValue(value);
+ return this;
+ }
}
diff --git a/src/main/java/net/sf/jsqlparser/expression/DoubleValue.java b/src/main/java/net/sf/jsqlparser/expression/DoubleValue.java
index 1d128e637..8d25aa61a 100644
--- a/src/main/java/net/sf/jsqlparser/expression/DoubleValue.java
+++ b/src/main/java/net/sf/jsqlparser/expression/DoubleValue.java
@@ -1,22 +1,10 @@
-/*
+/*-
* #%L
* JSQLParser library
* %%
- * Copyright (C) 2004 - 2013 JSQLParser
+ * Copyright (C) 2004 - 2019 JSQLParser
* %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation, either version 2.1 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Lesser Public License for more details.
- *
- * You should have received a copy of the GNU General Lesser Public
- * License along with this program. If not, see
- * .
+ * Dual licensed under GNU LGPL 2.1 or Apache License 2.0
* #L%
*/
package net.sf.jsqlparser.expression;
@@ -28,10 +16,17 @@
*/
public class DoubleValue extends ASTNodeAccessImpl implements Expression {
- private double value;
+ private Double value;
private String stringValue;
+ public DoubleValue() {
+ // empty constructor
+ }
+
public DoubleValue(final String value) {
+ if (value == null || value.length() == 0) {
+ throw new IllegalArgumentException("value can neither be null nor empty.");
+ }
String val = value;
if (val.charAt(0) == '+') {
val = val.substring(1);
@@ -40,21 +35,32 @@ public DoubleValue(final String value) {
this.stringValue = val;
}
+ public DoubleValue(final double value) {
+ this.value = value;
+ this.stringValue = String.valueOf(value);
+ }
+
@Override
- public void accept(ExpressionVisitor expressionVisitor) {
- expressionVisitor.visit(this);
+ public T accept(ExpressionVisitor expressionVisitor, S context) {
+ return expressionVisitor.visit(this, context);
}
public double getValue() {
return value;
}
- public void setValue(double d) {
+ public void setValue(Double d) {
value = d;
+ stringValue = String.valueOf(value);
}
@Override
public String toString() {
return stringValue;
}
+
+ public DoubleValue withValue(Double value) {
+ this.setValue(value);
+ return this;
+ }
}
diff --git a/src/main/java/net/sf/jsqlparser/expression/Expression.java b/src/main/java/net/sf/jsqlparser/expression/Expression.java
index 45ba5d533..1f733d564 100644
--- a/src/main/java/net/sf/jsqlparser/expression/Expression.java
+++ b/src/main/java/net/sf/jsqlparser/expression/Expression.java
@@ -1,29 +1,23 @@
-/*
+/*-
* #%L
* JSQLParser library
* %%
- * Copyright (C) 2004 - 2013 JSQLParser
+ * Copyright (C) 2004 - 2019 JSQLParser
* %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation, either version 2.1 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Lesser Public License for more details.
- *
- * You should have received a copy of the GNU General Lesser Public
- * License along with this program. If not, see
- * .
+ * Dual licensed under GNU LGPL 2.1 or Apache License 2.0
* #L%
*/
package net.sf.jsqlparser.expression;
+import net.sf.jsqlparser.Model;
import net.sf.jsqlparser.parser.ASTNodeAccess;
-public interface Expression extends ASTNodeAccess {
+public interface Expression extends ASTNodeAccess, Model {
+
+ T accept(ExpressionVisitor expressionVisitor, S context);
+
+ default void accept(ExpressionVisitor expressionVisitor) {
+ this.accept(expressionVisitor, null);
+ }
- void accept(ExpressionVisitor expressionVisitor);
}
diff --git a/src/main/java/net/sf/jsqlparser/expression/ExpressionVisitor.java b/src/main/java/net/sf/jsqlparser/expression/ExpressionVisitor.java
index b1e4e7463..998c60ef5 100644
--- a/src/main/java/net/sf/jsqlparser/expression/ExpressionVisitor.java
+++ b/src/main/java/net/sf/jsqlparser/expression/ExpressionVisitor.java
@@ -1,26 +1,15 @@
-/*
+/*-
* #%L
* JSQLParser library
* %%
- * Copyright (C) 2004 - 2013 JSQLParser
+ * Copyright (C) 2004 - 2019 JSQLParser
* %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation, either version 2.1 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Lesser Public License for more details.
- *
- * You should have received a copy of the GNU General Lesser Public
- * License along with this program. If not, see
- * .
+ * Dual licensed under GNU LGPL 2.1 or Apache License 2.0
* #L%
*/
package net.sf.jsqlparser.expression;
+import java.util.List;
import net.sf.jsqlparser.expression.operators.arithmetic.Addition;
import net.sf.jsqlparser.expression.operators.arithmetic.BitwiseAnd;
import net.sf.jsqlparser.expression.operators.arithmetic.BitwiseLeftShift;
@@ -29,155 +18,786 @@
import net.sf.jsqlparser.expression.operators.arithmetic.BitwiseXor;
import net.sf.jsqlparser.expression.operators.arithmetic.Concat;
import net.sf.jsqlparser.expression.operators.arithmetic.Division;
+import net.sf.jsqlparser.expression.operators.arithmetic.IntegerDivision;
import net.sf.jsqlparser.expression.operators.arithmetic.Modulo;
import net.sf.jsqlparser.expression.operators.arithmetic.Multiplication;
import net.sf.jsqlparser.expression.operators.arithmetic.Subtraction;
import net.sf.jsqlparser.expression.operators.conditional.AndExpression;
import net.sf.jsqlparser.expression.operators.conditional.OrExpression;
+import net.sf.jsqlparser.expression.operators.conditional.XorExpression;
import net.sf.jsqlparser.expression.operators.relational.Between;
+import net.sf.jsqlparser.expression.operators.relational.ContainedBy;
+import net.sf.jsqlparser.expression.operators.relational.Contains;
+import net.sf.jsqlparser.expression.operators.relational.CosineSimilarity;
+import net.sf.jsqlparser.expression.operators.relational.DoubleAnd;
import net.sf.jsqlparser.expression.operators.relational.EqualsTo;
+import net.sf.jsqlparser.expression.operators.relational.ExcludesExpression;
import net.sf.jsqlparser.expression.operators.relational.ExistsExpression;
+import net.sf.jsqlparser.expression.operators.relational.ExpressionList;
+import net.sf.jsqlparser.expression.operators.relational.FullTextSearch;
+import net.sf.jsqlparser.expression.operators.relational.GeometryDistance;
import net.sf.jsqlparser.expression.operators.relational.GreaterThan;
import net.sf.jsqlparser.expression.operators.relational.GreaterThanEquals;
import net.sf.jsqlparser.expression.operators.relational.InExpression;
+import net.sf.jsqlparser.expression.operators.relational.IncludesExpression;
+import net.sf.jsqlparser.expression.operators.relational.IsBooleanExpression;
+import net.sf.jsqlparser.expression.operators.relational.IsDistinctExpression;
import net.sf.jsqlparser.expression.operators.relational.IsNullExpression;
+import net.sf.jsqlparser.expression.operators.relational.IsUnknownExpression;
+import net.sf.jsqlparser.expression.operators.relational.JsonOperator;
import net.sf.jsqlparser.expression.operators.relational.LikeExpression;
import net.sf.jsqlparser.expression.operators.relational.Matches;
+import net.sf.jsqlparser.expression.operators.relational.MemberOfExpression;
import net.sf.jsqlparser.expression.operators.relational.MinorThan;
import net.sf.jsqlparser.expression.operators.relational.MinorThanEquals;
import net.sf.jsqlparser.expression.operators.relational.NotEqualsTo;
+import net.sf.jsqlparser.expression.operators.relational.Plus;
+import net.sf.jsqlparser.expression.operators.relational.PriorTo;
import net.sf.jsqlparser.expression.operators.relational.RegExpMatchOperator;
-import net.sf.jsqlparser.expression.operators.relational.RegExpMySQLOperator;
-import net.sf.jsqlparser.expression.operators.relational.JsonOperator;
+import net.sf.jsqlparser.expression.operators.relational.SimilarToExpression;
+import net.sf.jsqlparser.expression.operators.relational.TSQLLeftJoin;
+import net.sf.jsqlparser.expression.operators.relational.TSQLRightJoin;
import net.sf.jsqlparser.schema.Column;
-import net.sf.jsqlparser.statement.select.SubSelect;
+import net.sf.jsqlparser.statement.piped.FromQuery;
+import net.sf.jsqlparser.statement.select.AllColumns;
+import net.sf.jsqlparser.statement.select.AllTableColumns;
+import net.sf.jsqlparser.statement.select.FunctionAllColumns;
+import net.sf.jsqlparser.statement.select.GroupByElement;
+import net.sf.jsqlparser.statement.select.Limit;
+import net.sf.jsqlparser.statement.select.OrderByElement;
+import net.sf.jsqlparser.statement.select.ParenthesedSelect;
+import net.sf.jsqlparser.statement.select.Select;
+import net.sf.jsqlparser.statement.update.UpdateSet;
+
+public interface ExpressionVisitor {
+
+ default T visitExpressions(ExpressionList extends Expression> expressions, S context) {
+ if (expressions != null) {
+ expressions.forEach(expression -> expression.accept(this, context));
+ }
+ return null;
+ };
+
+ default T visitExpression(Expression expression, S context) {
+ if (expression != null) {
+ expression.accept(this, context);
+ }
+ return null;
+ }
+
+ default T visitOrderBy(List orderByElements, S context) {
+ if (orderByElements != null) {
+ for (OrderByElement orderByElement : orderByElements) {
+ orderByElement.getExpression().accept(this, context);
+ }
+ }
+ return null;
+ }
+
+ default T visitLimit(Limit limit, S context) {
+ if (limit != null && !limit.isLimitNull() && !limit.isLimitAll()) {
+ if (limit.getOffset() != null) {
+ limit.getOffset().accept(this, context);
+ }
+ if (limit.getRowCount() != null) {
+ limit.getRowCount().accept(this, context);
+ }
+ if (limit.getByExpressions() != null) {
+ limit.getByExpressions().accept(this, context);
+ }
+ }
+ return null;
+ }
+
+ default T visitPreferringClause(PreferringClause preferringClause, S context) {
+ if (preferringClause != null) {
+ if (preferringClause.getPreferring() != null) {
+ preferringClause.getPreferring().accept(this, context);
+ }
+ if (preferringClause.getPartitionBy() != null) {
+ for (Expression expression : preferringClause.getPartitionBy()) {
+ expression.accept(this, context);
+ }
+ }
+ }
+ return null;
+ }
+
+ default T visitUpdateSets(List updateSets, S context) {
+ if (updateSets != null) {
+ for (UpdateSet updateSet : updateSets) {
+ for (Column column : updateSet.getColumns()) {
+ column.accept(this, context);
+ }
+ for (Expression value : updateSet.getValues()) {
+ value.accept(this, context);
+ }
+ }
+ }
+ return null;
+ }
+
+ default T visit(GroupByElement groupBy, S context) {
+ if (groupBy != null) {
+ for (Expression expression : groupBy.getGroupByExpressionList()) {
+ expression.accept(this, context);
+ }
+ if (!groupBy.getGroupingSets().isEmpty()) {
+ for (ExpressionList> expressionList : groupBy.getGroupingSets()) {
+ expressionList.accept(this, context);
+ }
+ }
+ }
+ return null;
+ }
+
+ T visit(BitwiseRightShift bitwiseRightShift, S context);
+
+ default void visit(BitwiseRightShift bitwiseRightShift) {
+ this.visit(bitwiseRightShift, null);
+ }
+
+ T visit(BitwiseLeftShift bitwiseLeftShift, S context);
+
+ default void visit(BitwiseLeftShift bitwiseLeftShift) {
+ this.visit(bitwiseLeftShift, null);
+ }
+
+ T visit(NullValue nullValue, S context);
+
+ default void visit(NullValue nullValue) {
+ this.visit(nullValue, null);
+ }
+
+ T visit(Function function, S context);
+
+ default void visit(Function function) {
+ this.visit(function, null);
+ }
+
+ T visit(SignedExpression signedExpression, S context);
+
+ default void visit(SignedExpression signedExpression) {
+ this.visit(signedExpression, null);
+ }
+
+ T visit(JdbcParameter jdbcParameter, S context);
+
+ default void visit(JdbcParameter jdbcParameter) {
+ this.visit(jdbcParameter, null);
+ }
+
+ T visit(JdbcNamedParameter jdbcNamedParameter, S context);
+
+ default void visit(JdbcNamedParameter jdbcNamedParameter) {
+ this.visit(jdbcNamedParameter, null);
+ }
+
+ T visit(DoubleValue doubleValue, S context);
+
+ default void visit(DoubleValue doubleValue) {
+ this.visit(doubleValue, null);
+ }
+
+ T visit(LongValue longValue, S context);
+
+ default void visit(LongValue longValue) {
+ this.visit(longValue, null);
+ }
+
+ T visit(HexValue hexValue, S context);
+
+ default void visit(HexValue hexValue) {
+ this.visit(hexValue, null);
+ }
+
+ T visit(DateValue dateValue, S context);
+
+ default void visit(DateValue dateValue) {
+ this.visit(dateValue, null);
+ }
+
+ T visit(TimeValue timeValue, S context);
+
+ default void visit(TimeValue timeValue) {
+ this.visit(timeValue, null);
+ }
+
+ T visit(TimestampValue timestampValue, S context);
+
+ default void visit(TimestampValue timestampValue) {
+ this.visit(timestampValue, null);
+ }
+
+ T visit(StringValue stringValue, S context);
+
+ default void visit(StringValue stringValue) {
+ this.visit(stringValue, null);
+ }
+
+ T visit(BooleanValue booleanValue, S context);
+
+ default void visit(BooleanValue booleanValue) {
+ this.visit(booleanValue, null);
+ }
+
+ T visit(Addition addition, S context);
+
+ default void visit(Addition addition) {
+ this.visit(addition, null);
+ }
+
+ T visit(Division division, S context);
+
+ default void visit(Division division) {
+ this.visit(division, null);
+ }
+
+ T visit(IntegerDivision integerDivision, S context);
+
+ default void visit(IntegerDivision integerDivision) {
+ this.visit(integerDivision, null);
+ }
+
+ T visit(Multiplication multiplication, S context);
+
+ default void visit(Multiplication multiplication) {
+ this.visit(multiplication, null);
+ }
+
+ T visit(Subtraction subtraction, S context);
+
+ default void visit(Subtraction subtraction) {
+ this.visit(subtraction, null);
+ }
+
+ T visit(AndExpression andExpression, S context);
+
+ default void visit(AndExpression andExpression) {
+ this.visit(andExpression, null);
+ }
+
+ T visit(OrExpression orExpression, S context);
+
+ default void visit(OrExpression orExpression) {
+ this.visit(orExpression, null);
+ }
+
+ T visit(XorExpression xorExpression, S context);
+
+ default void visit(XorExpression xorExpression) {
+ this.visit(xorExpression, null);
+ }
+
+ T visit(Between between, S context);
+
+ default void visit(Between between) {
+ this.visit(between, null);
+ }
+
+ T visit(OverlapsCondition overlapsCondition, S context);
+
+ default void visit(OverlapsCondition overlapsCondition) {
+ this.visit(overlapsCondition, null);
+ }
+
+ T visit(EqualsTo equalsTo, S context);
+
+ default void visit(EqualsTo equalsTo) {
+ this.visit(equalsTo, null);
+ }
+
+ T visit(GreaterThan greaterThan, S context);
+
+ default void visit(GreaterThan greaterThan) {
+ this.visit(greaterThan, null);
+ }
+
+ T visit(GreaterThanEquals greaterThanEquals, S context);
+
+ default void visit(GreaterThanEquals greaterThanEquals) {
+ this.visit(greaterThanEquals, null);
+ }
+
+ T visit(InExpression inExpression, S context);
+
+ default void visit(InExpression inExpression) {
+ this.visit(inExpression, null);
+ }
+
+ T visit(IncludesExpression includesExpression, S context);
+
+ default void visit(IncludesExpression includesExpression) {
+ this.visit(includesExpression, null);
+ }
+
+ T visit(ExcludesExpression excludesExpression, S context);
+
+ default void visit(ExcludesExpression excludesExpression) {
+ this.visit(excludesExpression, null);
+ }
+
+ T visit(FullTextSearch fullTextSearch, S context);
+
+ default void visit(FullTextSearch fullTextSearch) {
+ this.visit(fullTextSearch, null);
+ }
+
+ T visit(IsNullExpression isNullExpression, S context);
+
+ default void visit(IsNullExpression isNullExpression) {
+ this.visit(isNullExpression, null);
+ }
+
+ T visit(IsBooleanExpression isBooleanExpression, S context);
+
+ default void visit(IsBooleanExpression isBooleanExpression) {
+ this.visit(isBooleanExpression, null);
+ }
+
+ T visit(IsUnknownExpression isUnknownExpression, S context);
+
+ default void visit(IsUnknownExpression isUnknownExpression) {
+ this.visit(isUnknownExpression, null);
+ }
+
+ T visit(LikeExpression likeExpression, S context);
+
+ default void visit(LikeExpression likeExpression) {
+ this.visit(likeExpression, null);
+ }
+
+ T visit(MinorThan minorThan, S context);
+
+ default void visit(MinorThan minorThan) {
+ this.visit(minorThan, null);
+ }
+
+ T visit(MinorThanEquals minorThanEquals, S context);
+
+ default void visit(MinorThanEquals minorThanEquals) {
+ this.visit(minorThanEquals, null);
+ }
+
+ T visit(NotEqualsTo notEqualsTo, S context);
+
+ default void visit(NotEqualsTo notEqualsTo) {
+ this.visit(notEqualsTo, null);
+ }
+
+ T visit(DoubleAnd doubleAnd, S context);
+
+ default void visit(DoubleAnd doubleAnd) {
+ this.visit(doubleAnd, null);
+ }
+
+ T visit(Contains contains, S context);
+
+ default void visit(Contains contains) {
+ this.visit(contains, null);
+ }
+
+ T visit(ContainedBy containedBy, S context);
+
+ default void visit(ContainedBy containedBy) {
+ this.visit(containedBy, null);
+ }
+
+ T visit(ParenthesedSelect select, S context);
+
+ T visit(Column column, S context);
+
+ default void visit(Column column) {
+ this.visit(column, null);
+ }
+
+ T visit(CaseExpression caseExpression, S context);
+
+ default void visit(CaseExpression caseExpression) {
+ this.visit(caseExpression, null);
+ }
+
+ T visit(WhenClause whenClause, S context);
+
+ default void visit(WhenClause whenClause) {
+ this.visit(whenClause, null);
+ }
+
+ T visit(ExistsExpression existsExpression, S context);
+
+ default void visit(ExistsExpression existsExpression) {
+ this.visit(existsExpression, null);
+ }
+
+ T visit(MemberOfExpression memberOfExpression, S context);
+
+ default void visit(MemberOfExpression memberOfExpression) {
+ this.visit(memberOfExpression, null);
+ }
+
+ T visit(AnyComparisonExpression anyComparisonExpression, S context);
+
+ default void visit(AnyComparisonExpression anyComparisonExpression) {
+ this.visit(anyComparisonExpression, null);
+ }
+
+ T visit(Concat concat, S context);
+
+ default void visit(Concat concat) {
+ this.visit(concat, null);
+ }
+
+ T visit(Matches matches, S context);
+
+ default void visit(Matches matches) {
+ this.visit(matches, null);
+ }
+
+ T visit(BitwiseAnd bitwiseAnd, S context);
+
+ default void visit(BitwiseAnd bitwiseAnd) {
+ this.visit(bitwiseAnd, null);
+ }
+
+ T visit(BitwiseOr bitwiseOr, S context);
+
+ default void visit(BitwiseOr bitwiseOr) {
+ this.visit(bitwiseOr, null);
+ }
+
+ T visit(BitwiseXor bitwiseXor, S context);
+
+ default void visit(BitwiseXor bitwiseXor) {
+ this.visit(bitwiseXor, null);
+ }
+
+ T visit(CastExpression castExpression, S context);
+
+ default void visit(CastExpression castExpression) {
+ this.visit(castExpression, null);
+ }
+
+ T visit(Modulo modulo, S context);
+
+ default void visit(Modulo modulo) {
+ this.visit(modulo, null);
+ }
+
+ T visit(AnalyticExpression analyticExpression, S context);
+
+ default void visit(AnalyticExpression analyticExpression) {
+ this.visit(analyticExpression, null);
+ }
+
+ T visit(ExtractExpression extractExpression, S context);
+
+ default void visit(ExtractExpression extractExpression) {
+ this.visit(extractExpression, null);
+ }
+
+ T visit(IntervalExpression intervalExpression, S context);
+
+ default void visit(IntervalExpression intervalExpression) {
+ this.visit(intervalExpression, null);
+ }
+
+ T visit(OracleHierarchicalExpression hierarchicalExpression, S context);
+
+ default void visit(OracleHierarchicalExpression hierarchicalExpression) {
+ this.visit(hierarchicalExpression, null);
+ }
+
+ T visit(RegExpMatchOperator regExpMatchOperator, S context);
+
+ default void visit(RegExpMatchOperator regExpMatchOperator) {
+ this.visit(regExpMatchOperator, null);
+ }
+
+ T visit(JsonExpression jsonExpression, S context);
+
+ default void visit(JsonExpression jsonExpression) {
+ this.visit(jsonExpression, null);
+ }
+
+ T visit(JsonOperator jsonOperator, S context);
+
+ default void visit(JsonOperator jsonOperator) {
+ this.visit(jsonOperator, null);
+ }
+
+ T visit(UserVariable userVariable, S context);
+
+ default void visit(UserVariable userVariable) {
+ this.visit(userVariable, null);
+ }
+
+ T visit(NumericBind numericBind, S context);
+
+ default void visit(NumericBind numericBind) {
+ this.visit(numericBind, null);
+ }
+
+ T visit(KeepExpression keepExpression, S context);
+
+ default void visit(KeepExpression keepExpression) {
+ this.visit(keepExpression, null);
+ }
+
+ T visit(MySQLGroupConcat groupConcat, S context);
+
+ default void visit(MySQLGroupConcat groupConcat) {
+ this.visit(groupConcat, null);
+ }
+
+ T visit(ExpressionList extends Expression> expressionList, S context);
+
+ default void visit(ExpressionList extends Expression> expressionList) {
+ this.visit(expressionList, null);
+ }
+
+ T visit(RowConstructor extends Expression> rowConstructor, S context);
+
+ default void visit(RowConstructor extends Expression> rowConstructor) {
+ this.visit(rowConstructor, null);
+ }
+
+ T visit(RowGetExpression rowGetExpression, S context);
+
+ default void visit(RowGetExpression rowGetExpression) {
+ this.visit(rowGetExpression, null);
+ }
+
+ T visit(OracleHint hint, S context);
+
+ default void visit(OracleHint hint) {
+ this.visit(hint, null);
+ }
+
+ T visit(TimeKeyExpression timeKeyExpression, S context);
+
+ default void visit(TimeKeyExpression timeKeyExpression) {
+ this.visit(timeKeyExpression, null);
+ }
+
+ T visit(DateTimeLiteralExpression dateTimeLiteralExpression, S context);
+
+ default void visit(DateTimeLiteralExpression dateTimeLiteralExpression) {
+ this.visit(dateTimeLiteralExpression, null);
+ }
+
+ T visit(NotExpression notExpression, S context);
+
+ default void visit(NotExpression notExpression) {
+ this.visit(notExpression, null);
+ }
+
+ T visit(NextValExpression nextValExpression, S context);
+
+ default void visit(NextValExpression nextValExpression) {
+ this.visit(nextValExpression, null);
+ }
+
+ T visit(CollateExpression collateExpression, S context);
+
+ default void visit(CollateExpression collateExpression) {
+ this.visit(collateExpression, null);
+ }
+
+ T visit(SimilarToExpression similarToExpression, S context);
+
+ default void visit(SimilarToExpression similarToExpression) {
+ this.visit(similarToExpression, null);
+ }
+
+ T visit(ArrayExpression arrayExpression, S context);
-public interface ExpressionVisitor {
+ default void visit(ArrayExpression arrayExpression) {
+ this.visit(arrayExpression, null);
+ }
- public void visit(BitwiseRightShift aThis);
+ T visit(ArrayConstructor arrayConstructor, S context);
- public void visit(BitwiseLeftShift aThis);
+ default void visit(ArrayConstructor arrayConstructor) {
+ this.visit(arrayConstructor, null);
+ }
- void visit(NullValue nullValue);
+ T visit(VariableAssignment variableAssignment, S context);
- void visit(Function function);
+ default void visit(VariableAssignment variableAssignment) {
+ this.visit(variableAssignment, null);
+ }
- void visit(SignedExpression signedExpression);
+ T visit(XMLSerializeExpr xmlSerializeExpr, S context);
- void visit(JdbcParameter jdbcParameter);
+ default void visit(XMLSerializeExpr xmlSerializeExpr) {
+ this.visit(xmlSerializeExpr, null);
+ }
- void visit(JdbcNamedParameter jdbcNamedParameter);
+ T visit(TimezoneExpression timezoneExpression, S context);
- void visit(DoubleValue doubleValue);
+ default void visit(TimezoneExpression timezoneExpression) {
+ this.visit(timezoneExpression, null);
+ }
- void visit(LongValue longValue);
+ T visit(JsonAggregateFunction jsonAggregateFunction, S context);
- void visit(HexValue hexValue);
+ default void visit(JsonAggregateFunction jsonAggregateFunction) {
+ this.visit(jsonAggregateFunction, null);
+ }
- void visit(DateValue dateValue);
+ T visit(JsonFunction jsonFunction, S context);
- void visit(TimeValue timeValue);
+ default void visit(JsonFunction jsonFunction) {
+ this.visit(jsonFunction, null);
+ }
- void visit(TimestampValue timestampValue);
+ default T visit(JsonTableFunction jsonTableFunction, S context) {
+ return visit((Function) jsonTableFunction, context);
+ }
- void visit(Parenthesis parenthesis);
+ default void visit(JsonTableFunction jsonTableFunction) {
+ this.visit(jsonTableFunction, null);
+ }
- void visit(StringValue stringValue);
+ T visit(ConnectByRootOperator connectByRootOperator, S context);
- void visit(Addition addition);
+ default void visit(ConnectByRootOperator connectByRootOperator) {
+ this.visit(connectByRootOperator, null);
+ }
- void visit(Division division);
+ T visit(ConnectByPriorOperator connectByPriorOperator, S context);
- void visit(Multiplication multiplication);
+ default void visit(ConnectByPriorOperator connectByPriorOperator) {
+ this.visit(connectByPriorOperator, null);
+ }
- void visit(Subtraction subtraction);
+ T visit(OracleNamedFunctionParameter oracleNamedFunctionParameter, S context);
- void visit(AndExpression andExpression);
+ default void visit(OracleNamedFunctionParameter oracleNamedFunctionParameter) {
+ this.visit(oracleNamedFunctionParameter, null);
+ }
- void visit(OrExpression orExpression);
+ T visit(AllColumns allColumns, S context);
- void visit(Between between);
+ T visit(FunctionAllColumns functionColumns, S context);
- void visit(EqualsTo equalsTo);
+ default void visit(AllColumns allColumns) {
+ this.visit(allColumns, null);
+ }
- void visit(GreaterThan greaterThan);
+ T visit(AllTableColumns allTableColumns, S context);
- void visit(GreaterThanEquals greaterThanEquals);
+ default void visit(AllTableColumns allTableColumns) {
+ this.visit(allTableColumns, null);
+ }
- void visit(InExpression inExpression);
+ T visit(AllValue allValue, S context);
- void visit(IsNullExpression isNullExpression);
+ default void visit(AllValue allValue) {
+ this.visit(allValue, null);
+ }
- void visit(LikeExpression likeExpression);
+ T visit(IsDistinctExpression isDistinctExpression, S context);
- void visit(MinorThan minorThan);
+ default void visit(IsDistinctExpression isDistinctExpression) {
+ this.visit(isDistinctExpression, null);
+ }
- void visit(MinorThanEquals minorThanEquals);
+ T visit(GeometryDistance geometryDistance, S context);
- void visit(NotEqualsTo notEqualsTo);
+ default void visit(GeometryDistance geometryDistance) {
+ this.visit(geometryDistance, null);
+ }
- void visit(Column tableColumn);
+ T visit(Select select, S context);
- void visit(SubSelect subSelect);
+ T visit(TranscodingFunction transcodingFunction, S context);
- void visit(CaseExpression caseExpression);
+ default void visit(TranscodingFunction transcodingFunction) {
+ this.visit(transcodingFunction, null);
+ }
- void visit(WhenClause whenClause);
+ T visit(TrimFunction trimFunction, S context);
- void visit(ExistsExpression existsExpression);
+ default void visit(TrimFunction trimFunction) {
+ this.visit(trimFunction, null);
+ }
- void visit(AllComparisonExpression allComparisonExpression);
+ T visit(RangeExpression rangeExpression, S context);
- void visit(AnyComparisonExpression anyComparisonExpression);
+ default void visit(RangeExpression rangeExpression) {
+ this.visit(rangeExpression, null);
+ }
- void visit(Concat concat);
+ T visit(TSQLLeftJoin tsqlLeftJoin, S context);
- void visit(Matches matches);
+ default void visit(TSQLLeftJoin tsqlLeftJoin) {
+ this.visit(tsqlLeftJoin, null);
+ }
- void visit(BitwiseAnd bitwiseAnd);
+ T visit(TSQLRightJoin tsqlRightJoin, S context);
- void visit(BitwiseOr bitwiseOr);
+ default void visit(TSQLRightJoin tsqlRightJoin) {
+ this.visit(tsqlRightJoin, null);
+ }
- void visit(BitwiseXor bitwiseXor);
+ T visit(StructType structType, S context);
- void visit(CastExpression cast);
+ default void visit(StructType structType) {
+ this.visit(structType, null);
+ }
- void visit(Modulo modulo);
+ T visit(LambdaExpression lambdaExpression, S context);
- void visit(AnalyticExpression aexpr);
+ default void visit(LambdaExpression lambdaExpression) {
+ this.visit(lambdaExpression, null);
+ }
- void visit(ExtractExpression eexpr);
+ T visit(HighExpression highExpression, S context);
- void visit(IntervalExpression iexpr);
+ default void visit(HighExpression highExpression) {
+ this.visit(highExpression, null);
+ }
- void visit(OracleHierarchicalExpression oexpr);
+ T visit(LowExpression lowExpression, S context);
- void visit(RegExpMatchOperator rexpr);
+ default void visit(LowExpression lowExpression) {
+ this.visit(lowExpression, null);
+ }
- void visit(JsonExpression jsonExpr);
+ T visit(Plus plus, S context);
- void visit(JsonOperator jsonExpr);
+ default void visit(Plus plus) {
+ this.visit(plus, null);
+ }
- void visit(RegExpMySQLOperator regExpMySQLOperator);
+ T visit(PriorTo priorTo, S context);
- void visit(UserVariable var);
+ default void visit(PriorTo priorTo) {
+ this.visit(priorTo, null);
+ }
- void visit(NumericBind bind);
+ T visit(Inverse inverse, S context);
- void visit(KeepExpression aexpr);
+ default void visit(Inverse inverse) {
+ this.visit(inverse, null);
+ }
- void visit(MySQLGroupConcat groupConcat);
-
- void visit(ValueListExpression valueList);
+ T visit(CosineSimilarity cosineSimilarity, S context);
- void visit(RowConstructor rowConstructor);
+ T visit(FromQuery fromQuery, S context);
- void visit(OracleHint hint);
+ T visit(DateUnitExpression dateUnitExpression, S context);
- void visit(TimeKeyExpression timeKeyExpression);
+ T visit(KeyExpression keyExpression, S context);
- void visit(DateTimeLiteralExpression literal);
+ default void visit(KeyExpression keyExpression) {
+ this.visit(keyExpression, null);
+ }
- public void visit(NotExpression aThis);
+ T visit(PostgresNamedFunctionParameter postgresNamedFunctionParameter, S context);
+ default void visit(PostgresNamedFunctionParameter postgresNamedFunctionParameter) {
+ this.visit(postgresNamedFunctionParameter, null);
+ }
}
diff --git a/src/main/java/net/sf/jsqlparser/expression/ExpressionVisitorAdapter.java b/src/main/java/net/sf/jsqlparser/expression/ExpressionVisitorAdapter.java
index 995c22810..c546a4c2c 100644
--- a/src/main/java/net/sf/jsqlparser/expression/ExpressionVisitorAdapter.java
+++ b/src/main/java/net/sf/jsqlparser/expression/ExpressionVisitorAdapter.java
@@ -1,503 +1,888 @@
-/*
+/*-
* #%L
* JSQLParser library
* %%
- * Copyright (C) 2004 - 2015 JSQLParser
+ * Copyright (C) 2004 - 2019 JSQLParser
* %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation, either version 2.1 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Lesser Public License for more details.
- *
- * You should have received a copy of the GNU General Lesser Public
- * License along with this program. If not, see
- * .
+ * Dual licensed under GNU LGPL 2.1 or Apache License 2.0
* #L%
*/
package net.sf.jsqlparser.expression;
-import net.sf.jsqlparser.expression.operators.arithmetic.*;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Optional;
+import net.sf.jsqlparser.expression.operators.arithmetic.Addition;
+import net.sf.jsqlparser.expression.operators.arithmetic.BitwiseAnd;
+import net.sf.jsqlparser.expression.operators.arithmetic.BitwiseLeftShift;
+import net.sf.jsqlparser.expression.operators.arithmetic.BitwiseOr;
+import net.sf.jsqlparser.expression.operators.arithmetic.BitwiseRightShift;
+import net.sf.jsqlparser.expression.operators.arithmetic.BitwiseXor;
+import net.sf.jsqlparser.expression.operators.arithmetic.Concat;
+import net.sf.jsqlparser.expression.operators.arithmetic.Division;
+import net.sf.jsqlparser.expression.operators.arithmetic.IntegerDivision;
+import net.sf.jsqlparser.expression.operators.arithmetic.Modulo;
+import net.sf.jsqlparser.expression.operators.arithmetic.Multiplication;
+import net.sf.jsqlparser.expression.operators.arithmetic.Subtraction;
import net.sf.jsqlparser.expression.operators.conditional.AndExpression;
import net.sf.jsqlparser.expression.operators.conditional.OrExpression;
+import net.sf.jsqlparser.expression.operators.conditional.XorExpression;
+import net.sf.jsqlparser.expression.operators.relational.Between;
+import net.sf.jsqlparser.expression.operators.relational.ContainedBy;
+import net.sf.jsqlparser.expression.operators.relational.Contains;
+import net.sf.jsqlparser.expression.operators.relational.CosineSimilarity;
+import net.sf.jsqlparser.expression.operators.relational.DoubleAnd;
+import net.sf.jsqlparser.expression.operators.relational.EqualsTo;
+import net.sf.jsqlparser.expression.operators.relational.ExcludesExpression;
+import net.sf.jsqlparser.expression.operators.relational.ExistsExpression;
+import net.sf.jsqlparser.expression.operators.relational.ExpressionList;
+import net.sf.jsqlparser.expression.operators.relational.FullTextSearch;
+import net.sf.jsqlparser.expression.operators.relational.GeometryDistance;
+import net.sf.jsqlparser.expression.operators.relational.GreaterThan;
+import net.sf.jsqlparser.expression.operators.relational.GreaterThanEquals;
+import net.sf.jsqlparser.expression.operators.relational.InExpression;
+import net.sf.jsqlparser.expression.operators.relational.IncludesExpression;
+import net.sf.jsqlparser.expression.operators.relational.IsBooleanExpression;
+import net.sf.jsqlparser.expression.operators.relational.IsDistinctExpression;
+import net.sf.jsqlparser.expression.operators.relational.IsNullExpression;
+import net.sf.jsqlparser.expression.operators.relational.IsUnknownExpression;
import net.sf.jsqlparser.expression.operators.relational.JsonOperator;
-import net.sf.jsqlparser.expression.operators.relational.*;
+import net.sf.jsqlparser.expression.operators.relational.LikeExpression;
+import net.sf.jsqlparser.expression.operators.relational.Matches;
+import net.sf.jsqlparser.expression.operators.relational.MemberOfExpression;
+import net.sf.jsqlparser.expression.operators.relational.MinorThan;
+import net.sf.jsqlparser.expression.operators.relational.MinorThanEquals;
+import net.sf.jsqlparser.expression.operators.relational.NotEqualsTo;
+import net.sf.jsqlparser.expression.operators.relational.Plus;
+import net.sf.jsqlparser.expression.operators.relational.PriorTo;
+import net.sf.jsqlparser.expression.operators.relational.RegExpMatchOperator;
+import net.sf.jsqlparser.expression.operators.relational.SimilarToExpression;
+import net.sf.jsqlparser.expression.operators.relational.TSQLLeftJoin;
+import net.sf.jsqlparser.expression.operators.relational.TSQLRightJoin;
import net.sf.jsqlparser.schema.Column;
+import net.sf.jsqlparser.statement.piped.FromQuery;
import net.sf.jsqlparser.statement.select.AllColumns;
import net.sf.jsqlparser.statement.select.AllTableColumns;
-import net.sf.jsqlparser.statement.select.ExpressionListItem;
-import net.sf.jsqlparser.statement.select.FunctionItem;
+import net.sf.jsqlparser.statement.select.FunctionAllColumns;
import net.sf.jsqlparser.statement.select.OrderByElement;
+import net.sf.jsqlparser.statement.select.ParenthesedSelect;
import net.sf.jsqlparser.statement.select.Pivot;
import net.sf.jsqlparser.statement.select.PivotVisitor;
import net.sf.jsqlparser.statement.select.PivotXml;
-import net.sf.jsqlparser.statement.select.SelectExpressionItem;
+import net.sf.jsqlparser.statement.select.Select;
+import net.sf.jsqlparser.statement.select.SelectItem;
import net.sf.jsqlparser.statement.select.SelectItemVisitor;
import net.sf.jsqlparser.statement.select.SelectVisitor;
-import net.sf.jsqlparser.statement.select.SubSelect;
+import net.sf.jsqlparser.statement.select.UnPivot;
import net.sf.jsqlparser.statement.select.WithItem;
-public class ExpressionVisitorAdapter implements ExpressionVisitor, ItemsListVisitor, PivotVisitor, SelectItemVisitor {
+@SuppressWarnings({"PMD.CyclomaticComplexity", "PMD.UncommentedEmptyMethodBody"})
+public class ExpressionVisitorAdapter
+ implements ExpressionVisitor, PivotVisitor, SelectItemVisitor {
- private SelectVisitor selectVisitor;
+ private SelectVisitor selectVisitor;
- public SelectVisitor getSelectVisitor() {
+ public ExpressionVisitorAdapter(SelectVisitor selectVisitor) {
+ this.selectVisitor = selectVisitor;
+ }
+
+ public ExpressionVisitorAdapter() {
+ this.selectVisitor = null;
+ }
+
+ public SelectVisitor getSelectVisitor() {
return selectVisitor;
}
- public void setSelectVisitor(SelectVisitor selectVisitor) {
+ public ExpressionVisitorAdapter setSelectVisitor(SelectVisitor selectVisitor) {
this.selectVisitor = selectVisitor;
+ return this;
}
@Override
- public void visit(NullValue value) {
-
+ public T visit(NullValue nullValue, S context) {
+ return applyExpression(nullValue, context);
}
@Override
- public void visit(Function function) {
+ public T visit(Function function, S context) {
+ ArrayList subExpressions = new ArrayList<>();
if (function.getParameters() != null) {
- function.getParameters().accept(this);
+ subExpressions.addAll(function.getParameters());
+ }
+ if (function.getChainedParameters() != null) {
+ subExpressions.addAll(function.getChainedParameters());
}
if (function.getKeep() != null) {
- function.getKeep().accept(this);
+ subExpressions.add(function.getKeep());
+ }
+ if (function.getOrderByElements() != null) {
+ for (OrderByElement orderByElement : function.getOrderByElements()) {
+ subExpressions.add(orderByElement.getExpression());
+ }
}
+ return visitExpressions(function, context, subExpressions);
+ }
+
+ @Override
+ public T visit(SignedExpression signedExpression, S context) {
+ return signedExpression.getExpression().accept(this, context);
}
@Override
- public void visit(SignedExpression expr) {
- expr.getExpression().accept(this);
+ public T visit(JdbcParameter jdbcParameter, S context) {
+ return applyExpression(jdbcParameter, context);
}
@Override
- public void visit(JdbcParameter parameter) {
+ public T visit(JdbcNamedParameter jdbcNamedParameter, S context) {
+ return applyExpression(jdbcNamedParameter, context);
+ }
+
+ @Override
+ public T visit(DoubleValue doubleValue, S context) {
+ return applyExpression(doubleValue, context);
+ }
+ @Override
+ public T visit(LongValue longValue, S context) {
+ return applyExpression(longValue, context);
}
@Override
- public void visit(JdbcNamedParameter parameter) {
+ public T visit(DateValue dateValue, S context) {
+ return applyExpression(dateValue, context);
+ }
+ @Override
+ public T visit(TimeValue timeValue, S context) {
+ return applyExpression(timeValue, context);
}
@Override
- public void visit(DoubleValue value) {
+ public T visit(TimestampValue timestampValue, S context) {
+ return applyExpression(timestampValue, context);
+ }
+ @Override
+ public T visit(StringValue stringValue, S context) {
+ return applyExpression(stringValue, context);
}
@Override
- public void visit(LongValue value) {
+ public T visit(BooleanValue booleanValue, S context) {
+ return applyExpression(booleanValue, context);
+ }
+ @Override
+ public T visit(Addition addition, S context) {
+ return visitBinaryExpression(addition, context);
}
@Override
- public void visit(DateValue value) {
+ public T visit(Division division, S context) {
+ return visitBinaryExpression(division, context);
+ }
+ @Override
+ public T visit(IntegerDivision integerDivision, S context) {
+ return visitBinaryExpression(integerDivision, context);
}
@Override
- public void visit(TimeValue value) {
+ public T visit(Multiplication multiplication, S context) {
+ return visitBinaryExpression(multiplication, context);
+ }
+ @Override
+ public T visit(Subtraction subtraction, S context) {
+ return visitBinaryExpression(subtraction, context);
}
@Override
- public void visit(TimestampValue value) {
+ public T visit(AndExpression andExpression, S context) {
+ return visitBinaryExpression(andExpression, context);
+ }
+ @Override
+ public