.
+ * Dual licensed under GNU LGPL 2.1 or Apache License 2.0
* #L%
*/
package net.sf.jsqlparser.util.deparser;
@@ -44,6 +32,7 @@
import net.sf.jsqlparser.expression.KeepExpression;
import net.sf.jsqlparser.expression.LongValue;
import net.sf.jsqlparser.expression.MySQLGroupConcat;
+import net.sf.jsqlparser.expression.NextValExpression;
import net.sf.jsqlparser.expression.NotExpression;
import net.sf.jsqlparser.expression.NullValue;
import net.sf.jsqlparser.expression.NumericBind;
@@ -77,7 +66,6 @@
import net.sf.jsqlparser.expression.operators.relational.EqualsTo;
import net.sf.jsqlparser.expression.operators.relational.ExistsExpression;
import net.sf.jsqlparser.expression.operators.relational.ExpressionList;
-import net.sf.jsqlparser.expression.operators.relational.NamedExpressionList;
import net.sf.jsqlparser.expression.operators.relational.GreaterThan;
import net.sf.jsqlparser.expression.operators.relational.GreaterThanEquals;
import net.sf.jsqlparser.expression.operators.relational.InExpression;
@@ -89,6 +77,7 @@
import net.sf.jsqlparser.expression.operators.relational.MinorThan;
import net.sf.jsqlparser.expression.operators.relational.MinorThanEquals;
import net.sf.jsqlparser.expression.operators.relational.MultiExpressionList;
+import net.sf.jsqlparser.expression.operators.relational.NamedExpressionList;
import net.sf.jsqlparser.expression.operators.relational.NotEqualsTo;
import net.sf.jsqlparser.expression.operators.relational.OldOracleJoinBinaryExpression;
import net.sf.jsqlparser.expression.operators.relational.RegExpMatchOperator;
@@ -101,10 +90,6 @@
import net.sf.jsqlparser.statement.select.SubSelect;
import net.sf.jsqlparser.statement.select.WithItem;
-/**
- * A class to de-parse (that is, tranform from JSqlParser hierarchy into a string) an
- * {@link net.sf.jsqlparser.expression.Expression}
- */
public class ExpressionDeParser implements ExpressionVisitor, ItemsListVisitor {
private static final String NOT = "NOT ";
@@ -116,21 +101,6 @@ public class ExpressionDeParser implements ExpressionVisitor, ItemsListVisitor {
public ExpressionDeParser() {
}
- /**
- * @param selectVisitor a SelectVisitor to de-parse SubSelects. It has to share the same
- * StringBuilder as this object in order to work, as:
- *
- *
- *
- * StringBuilder myBuf = new StringBuilder();
- * MySelectDeparser selectDeparser = new MySelectDeparser();
- * selectDeparser.setBuffer(myBuf);
- * ExpressionDeParser expressionDeParser = new ExpressionDeParser(selectDeparser, myBuf);
- *
- *
- *
- * @param buffer the buffer that will be filled with the expression
- */
public ExpressionDeParser(SelectVisitor selectVisitor, StringBuilder buffer) {
this(selectVisitor, buffer, new OrderByDeParser());
}
@@ -373,7 +343,7 @@ public void visit(Subtraction subtraction) {
visitBinaryExpression(subtraction, " - ");
}
- private void visitBinaryExpression(BinaryExpression binaryExpression, String operator) {
+ protected void visitBinaryExpression(BinaryExpression binaryExpression, String operator) {
if (binaryExpression.isNot()) {
buffer.append(NOT);
}
@@ -447,10 +417,10 @@ public void visit(Function function) {
useBracketsInExprList = false;
buffer.append("(ALL ");
}
- if(function.getNamedParameters() != null){
+ if (function.getNamedParameters() != null) {
visit(function.getNamedParameters());
}
- if(function.getParameters() != null){
+ if (function.getParameters() != null) {
visit(function.getParameters());
}
useBracketsInExprList = oldUseBracketsInExprList;
@@ -495,12 +465,12 @@ public void visit(NamedExpressionList namedExpressionList) {
}
List names = namedExpressionList.getNames();
List expressions = namedExpressionList.getExpressions();
- for (int i=0; i0){
+ for (int i = 0; i < names.size(); i++) {
+ if (i > 0) {
buffer.append(" ");
}
String name = names.get(i);
- if(! name.equals("")){
+ if (!name.equals("")) {
buffer.append(name);
buffer.append(" ");
}
@@ -812,4 +782,9 @@ public void visit(DateTimeLiteralExpression literal) {
buffer.append(literal.toString());
}
+ @Override
+ public void visit(NextValExpression nextVal) {
+ buffer.append("NEXTVAL FOR ").append(nextVal.getName());
+ }
+
}
diff --git a/src/main/java/net/sf/jsqlparser/util/deparser/InsertDeParser.java b/src/main/java/net/sf/jsqlparser/util/deparser/InsertDeParser.java
index 26d48334e..672caea5d 100644
--- a/src/main/java/net/sf/jsqlparser/util/deparser/InsertDeParser.java
+++ b/src/main/java/net/sf/jsqlparser/util/deparser/InsertDeParser.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.util.deparser;
@@ -36,10 +24,6 @@
import net.sf.jsqlparser.statement.select.SubSelect;
import net.sf.jsqlparser.statement.select.WithItem;
-/**
- * A class to de-parse (that is, tranform from JSqlParser hierarchy into a string) an
- * {@link net.sf.jsqlparser.statement.insert.Insert}
- */
public class InsertDeParser implements ItemsListVisitor {
protected StringBuilder buffer;
@@ -49,15 +33,6 @@ public class InsertDeParser implements ItemsListVisitor {
public InsertDeParser() {
}
- /**
- * @param expressionVisitor a {@link ExpressionVisitor} to de-parse
- * {@link net.sf.jsqlparser.expression.Expression}s. It has to share the same
- * StringBuilder (buffer parameter) as this object in order to work
- * @param selectVisitor a {@link SelectVisitor} to de-parse {@link net.sf.jsqlparser.statement.select.Select}s. It
- * has to share the same
- * StringBuilder (buffer parameter) as this object in order to work
- * @param buffer the buffer that will be filled with the insert
- */
public InsertDeParser(ExpressionVisitor expressionVisitor, SelectVisitor selectVisitor, StringBuilder buffer) {
this.buffer = buffer;
this.expressionVisitor = expressionVisitor;
diff --git a/src/main/java/net/sf/jsqlparser/util/deparser/LimitDeparser.java b/src/main/java/net/sf/jsqlparser/util/deparser/LimitDeparser.java
index 9716b0691..4aa585e63 100644
--- a/src/main/java/net/sf/jsqlparser/util/deparser/LimitDeparser.java
+++ b/src/main/java/net/sf/jsqlparser/util/deparser/LimitDeparser.java
@@ -1,22 +1,10 @@
-/*
+/*-
* #%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.util.deparser;
diff --git a/src/main/java/net/sf/jsqlparser/util/deparser/OrderByDeParser.java b/src/main/java/net/sf/jsqlparser/util/deparser/OrderByDeParser.java
index f38802fad..9bd4bc018 100644
--- a/src/main/java/net/sf/jsqlparser/util/deparser/OrderByDeParser.java
+++ b/src/main/java/net/sf/jsqlparser/util/deparser/OrderByDeParser.java
@@ -1,22 +1,10 @@
-/*
+/*-
* #%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.util.deparser;
diff --git a/src/main/java/net/sf/jsqlparser/util/deparser/ReplaceDeParser.java b/src/main/java/net/sf/jsqlparser/util/deparser/ReplaceDeParser.java
index 8e0b03ac5..c39295002 100644
--- a/src/main/java/net/sf/jsqlparser/util/deparser/ReplaceDeParser.java
+++ b/src/main/java/net/sf/jsqlparser/util/deparser/ReplaceDeParser.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.util.deparser;
@@ -34,10 +22,6 @@
import net.sf.jsqlparser.statement.select.SelectVisitor;
import net.sf.jsqlparser.statement.select.SubSelect;
-/**
- * A class to de-parse (that is, tranform from JSqlParser hierarchy into a string) a
- * {@link net.sf.jsqlparser.statement.replace.Replace}
- */
public class ReplaceDeParser implements ItemsListVisitor {
protected StringBuilder buffer;
@@ -47,15 +31,6 @@ public class ReplaceDeParser implements ItemsListVisitor {
public ReplaceDeParser() {
}
- /**
- * @param expressionVisitor a {@link ExpressionVisitor} to de-parse expressions. It has to share
- * the same