Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
747152a
Fixes #1684: Support CREATE MATERIALIZED VIEW with AUTO REFRESH
zaza Dec 11, 2022
9e09005
Merge branch 'master' into 1684-create-mv-auto-refresh
zaza Dec 22, 2022
ea4477b
Reduce cyclomatic complexity in CreateView.toString
zaza Jan 8, 2023
b5321d6
Enhanced Keywords
manticore-projects Oct 18, 2021
5fae2f5
Fix incorrect tests
manticore-projects Oct 18, 2021
f49e828
Define Reserved Keywords explicitly
manticore-projects Oct 24, 2021
86f337d
Fix test resources
manticore-projects Oct 24, 2021
2d51a82
Adjust Gradle to JUnit 5
manticore-projects Nov 22, 2021
232aff6
Do not mark SpeedTest for concurrent execution
manticore-projects Nov 24, 2021
3ba5410
Remove unused imports
manticore-projects Nov 28, 2021
e960a35
Adjust Gradle to JUnit 5
manticore-projects Nov 22, 2021
67f7951
Do not mark SpeedTest for concurrent execution
manticore-projects Nov 24, 2021
a016be0
Remove unused imports
manticore-projects Nov 28, 2021
2ef6637
Sphinx Documentation
manticore-projects Sep 2, 2022
57193b8
doc: request for `Conventional Commit` messages
manticore-projects Sep 6, 2022
b94b2cc
feat: make important Classes Serializable
manticore-projects Sep 15, 2022
02202c5
chore: Make Serializable
manticore-projects Oct 14, 2022
a3ca325
doc: Better integration of the RR diagrams
manticore-projects Jan 7, 2023
fcb5ab1
Merge
manticore-projects Jan 7, 2023
c57c427
feat: Oracle Alternative Quoting
manticore-projects Jan 29, 2023
2aec1f6
style: Appease PMD/Codacy
manticore-projects Jan 29, 2023
1c8d8da
feat: CREATE VIEW ... REFRESH AUTO...
manticore-projects Jan 30, 2023
b707b23
doc: fix the issue template
manticore-projects Feb 1, 2023
46314c4
Update issue templates
manticore-projects Feb 1, 2023
4aeafbc
Update issue templates
manticore-projects Feb 1, 2023
b081484
feat: Support more Statement Separators
manticore-projects Feb 2, 2023
5885e1c
Merge remote-tracking branch 'origin/master'
manticore-projects Feb 13, 2023
581d97a
Merge branch 'master' of https://github.com/JSQLParser/JSqlParser
manticore-projects Feb 24, 2023
0979b2e
feat: FETCH uses EXPRESSION
manticore-projects Mar 7, 2023
ed17f87
style: apply Spotless
manticore-projects Mar 7, 2023
96808d2
test: commit missing test
manticore-projects Mar 7, 2023
2ecfd49
feat: Unicode CJK Unified Ideographs (Unicode block)
manticore-projects Mar 7, 2023
ec542cf
feat: Unicode CJK Unified Ideographs (Unicode block)
manticore-projects Mar 8, 2023
25043d2
feat: Functions with nested Attributes
manticore-projects Mar 8, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
style: apply Spotless
  • Loading branch information
manticore-projects committed Mar 7, 2023
commit ed17f8759e799cd799609d395b78354a8ca5a16d
6 changes: 3 additions & 3 deletions src/main/java/net/sf/jsqlparser/statement/select/Fetch.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public long getRowCount() {

@Deprecated
public void setRowCount(long l) {
setExpression( new LongValue(l));
setExpression(new LongValue(l));
}

public Expression getExpression() {
Expand Down Expand Up @@ -69,8 +69,8 @@ public void setFetchParamFirst(boolean b) {

@Override
public String toString() {
return " FETCH " + (isFetchParamFirst ? "FIRST" : "NEXT") + " "
+ expression.toString() + " " + fetchParam + " ONLY";
return " FETCH " + (isFetchParamFirst ? "FIRST" : "NEXT") + " " + expression.toString()
+ " " + fetchParam + " ONLY";
}

public Fetch withRowCount(long rowCount) {
Expand Down
78 changes: 46 additions & 32 deletions src/main/java/net/sf/jsqlparser/util/deparser/SelectDeParser.java
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@
import net.sf.jsqlparser.statement.values.ValuesStatement;

@SuppressWarnings({"PMD.CyclomaticComplexity"})
public class SelectDeParser extends AbstractDeParser<PlainSelect>
implements SelectVisitor, SelectItemVisitor, FromItemVisitor, PivotVisitor, ItemsListVisitor {
public class SelectDeParser extends AbstractDeParser<PlainSelect> implements SelectVisitor,
SelectItemVisitor, FromItemVisitor, PivotVisitor, ItemsListVisitor {

private ExpressionVisitor expressionVisitor;

Expand All @@ -71,7 +71,8 @@ public SelectDeParser(ExpressionVisitor expressionVisitor, StringBuilder buffer)
}

@Override
@SuppressWarnings({"PMD.CyclomaticComplexity", "PMD.ExcessiveMethodLength", "PMD.NPathComplexity"})
@SuppressWarnings({"PMD.CyclomaticComplexity", "PMD.ExcessiveMethodLength",
"PMD.NPathComplexity"})
public void visit(PlainSelect plainSelect) {
if (plainSelect.isUseBrackets()) {
buffer.append("(");
Expand Down Expand Up @@ -105,8 +106,8 @@ public void visit(PlainSelect plainSelect) {
}
if (plainSelect.getDistinct().getOnSelectItems() != null) {
buffer.append("ON (");
for (Iterator<SelectItem> iter = plainSelect.getDistinct().getOnSelectItems().iterator(); iter
.hasNext();) {
for (Iterator<SelectItem> iter =
plainSelect.getDistinct().getOnSelectItems().iterator(); iter.hasNext();) {
SelectItem selectItem = iter.next();
selectItem.accept(this);
if (iter.hasNext()) {
Expand Down Expand Up @@ -185,7 +186,8 @@ public void visit(PlainSelect plainSelect) {
}
if (plainSelect.getWindowDefinitions() != null) {
buffer.append(" WINDOW ");
buffer.append(plainSelect.getWindowDefinitions().stream().map(WindowDefinition::toString).collect(joining(", ")));
buffer.append(plainSelect.getWindowDefinitions().stream()
.map(WindowDefinition::toString).collect(joining(", ")));
}
if (plainSelect.getOrderByElements() != null) {
new OrderByDeParser(expressionVisitor, buffer).deParse(plainSelect.isOracleSiblings(),
Expand Down Expand Up @@ -251,7 +253,8 @@ public void visit(SubSelect subSelect) {
buffer.append(subSelect.isUseBrackets() ? "(" : "");
if (subSelect.getWithItemsList() != null && !subSelect.getWithItemsList().isEmpty()) {
buffer.append("WITH ");
for (Iterator<WithItem> iter = subSelect.getWithItemsList().iterator(); iter.hasNext();) {
for (Iterator<WithItem> iter = subSelect.getWithItemsList().iterator(); iter
.hasNext();) {
WithItem withItem = iter.next();
withItem.accept(this);
if (iter.hasNext()) {
Expand Down Expand Up @@ -305,9 +308,12 @@ public void visit(Table tableName) {
@Override
public void visit(Pivot pivot) {
List<Column> forColumns = pivot.getForColumns();
buffer.append(" PIVOT (").append(PlainSelect.getStringList(pivot.getFunctionItems())).append(" FOR ")
.append(PlainSelect.getStringList(forColumns, true, forColumns != null && forColumns.size() > 1))
.append(" IN ").append(PlainSelect.getStringList(pivot.getInItems(), true, true)).append(")");
buffer.append(" PIVOT (").append(PlainSelect.getStringList(pivot.getFunctionItems()))
.append(" FOR ")
.append(PlainSelect.getStringList(forColumns, true,
forColumns != null && forColumns.size() > 1))
.append(" IN ").append(PlainSelect.getStringList(pivot.getInItems(), true, true))
.append(")");
if (pivot.getAlias() != null) {
buffer.append(pivot.getAlias().toString());
}
Expand All @@ -319,15 +325,16 @@ public void visit(UnPivot unpivot) {
boolean includeNulls = unpivot.getIncludeNulls();
List<Column> unPivotClause = unpivot.getUnPivotClause();
List<Column> unpivotForClause = unpivot.getUnPivotForClause();
buffer
.append(" UNPIVOT")
.append(showOptions && includeNulls ? " INCLUDE NULLS" : "")
.append(showOptions && !includeNulls ? " EXCLUDE NULLS" : "")
.append(" (").append(PlainSelect.getStringList(unPivotClause, true,
unPivotClause != null && unPivotClause.size() > 1))
.append(" FOR ").append(PlainSelect.getStringList(unpivotForClause, true,
unpivotForClause != null && unpivotForClause.size() > 1))
.append(" IN ").append(PlainSelect.getStringList(unpivot.getUnPivotInClause(), true, true)).append(")");
buffer.append(" UNPIVOT").append(showOptions && includeNulls ? " INCLUDE NULLS" : "")
.append(showOptions && !includeNulls ? " EXCLUDE NULLS" : "").append(" (")
.append(PlainSelect.getStringList(unPivotClause, true,
unPivotClause != null && unPivotClause.size() > 1))
.append(" FOR ")
.append(PlainSelect.getStringList(unpivotForClause, true,
unpivotForClause != null && unpivotForClause.size() > 1))
.append(" IN ")
.append(PlainSelect.getStringList(unpivot.getUnPivotInClause(), true, true))
.append(")");
if (unpivot.getAlias() != null) {
buffer.append(unpivot.getAlias().toString());
}
Expand All @@ -336,8 +343,9 @@ public void visit(UnPivot unpivot) {
@Override
public void visit(PivotXml pivot) {
List<Column> forColumns = pivot.getForColumns();
buffer.append(" PIVOT XML (").append(PlainSelect.getStringList(pivot.getFunctionItems())).append(" FOR ")
.append(PlainSelect.getStringList(forColumns, true, forColumns != null && forColumns.size() > 1))
buffer.append(" PIVOT XML (").append(PlainSelect.getStringList(pivot.getFunctionItems()))
.append(" FOR ").append(PlainSelect.getStringList(forColumns, true,
forColumns != null && forColumns.size() > 1))
.append(" IN (");
if (pivot.isInAny()) {
buffer.append("ANY");
Expand Down Expand Up @@ -397,7 +405,7 @@ public void visit(SubJoin subjoin) {

@SuppressWarnings({"PMD.CyclomaticComplexity"})
public void deparseJoin(Join join) {
if ( join.isGlobal() ) {
if (join.isGlobal()) {
buffer.append(" GLOBAL ");
}

Expand Down Expand Up @@ -451,7 +459,8 @@ public void deparseJoin(Join join) {
}
if (join.getUsingColumns().size() > 0) {
buffer.append(" USING (");
for (Iterator<Column> iterator = join.getUsingColumns().iterator(); iterator.hasNext();) {
for (Iterator<Column> iterator = join.getUsingColumns().iterator(); iterator
.hasNext();) {
Column column = iterator.next();
buffer.append(column.toString());
if (iterator.hasNext()) {
Expand Down Expand Up @@ -503,7 +512,8 @@ public void visit(WithItem withItem) {
}
buffer.append(withItem.getName());
if (withItem.getWithItemList() != null) {
buffer.append(" ").append(PlainSelect.getStringList(withItem.getWithItemList(), true, true));
buffer.append(" ")
.append(PlainSelect.getStringList(withItem.getWithItemList(), true, true));
}
buffer.append(" AS ");

Expand All @@ -513,8 +523,8 @@ public void visit(WithItem withItem) {
buffer.append("(VALUES ");

ExpressionList expressionList = (ExpressionList) itemsList;
buffer.append(
PlainSelect.getStringList(expressionList.getExpressions(), true, useBracketsForValues));
buffer.append(PlainSelect.getStringList(expressionList.getExpressions(), true,
useBracketsForValues));
buffer.append(")");
} else {
SubSelect subSelect = withItem.getSubSelect();
Expand All @@ -536,12 +546,14 @@ public void visit(LateralSubSelect lateralSubSelect) {
@Override
public void visit(ValuesList valuesList) {
buffer.append("(VALUES ");
List<ExpressionList> expressionLists = valuesList.getMultiExpressionList().getExpressionLists();
List<ExpressionList> expressionLists =
valuesList.getMultiExpressionList().getExpressionLists();
int n = expressionLists.size() - 1;
int i = 0;
for (ExpressionList expressionList : expressionLists) {
new ExpressionListDeParser(expressionVisitor, buffer, !valuesList.isNoBrackets(), true).deParse(expressionList.getExpressions());
if (i<n) {
new ExpressionListDeParser(expressionVisitor, buffer, !valuesList.isNoBrackets(), true)
.deParse(expressionList.getExpressions());
if (i < n) {
buffer.append(", ");
}
i++;
Expand Down Expand Up @@ -602,7 +614,8 @@ void deParse(PlainSelect statement) {

@Override
public void visit(ExpressionList expressionList) {
new ExpressionListDeParser(expressionVisitor, buffer, expressionList.isUsingBrackets(), true).deParse(expressionList.getExpressions());
new ExpressionListDeParser(expressionVisitor, buffer, expressionList.isUsingBrackets(),
true).deParse(expressionList.getExpressions());
}

@Override
Expand Down Expand Up @@ -632,8 +645,9 @@ public void visit(MultiExpressionList multiExprList) {
int n = expressionLists.size() - 1;
int i = 0;
for (ExpressionList expressionList : expressionLists) {
new ExpressionListDeParser(expressionVisitor, buffer, expressionList.isUsingBrackets(), true).deParse(expressionList.getExpressions());
if (i<n) {
new ExpressionListDeParser(expressionVisitor, buffer, expressionList.isUsingBrackets(),
true).deParse(expressionList.getExpressions());
if (i < n) {
buffer.append(", ");
}
i++;
Expand Down