Skip to content

Assorted Fixes #6 #1740

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
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
6 changes: 0 additions & 6 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -106,12 +106,6 @@ test {
minHeapSize = "128m"
maxHeapSize = "1G"

jvmArgs << [
'-Djunit.jupiter.execution.parallel.enabled=true',
'-Djunit.jupiter.execution.parallel.config.strategy=dynamic',
'-Djunit.jupiter.execution.parallel.mode.default=concurrent'
]

finalizedBy check
}

Expand Down
4 changes: 2 additions & 2 deletions config/checkstyle/checkstyle_checks.xml
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@
<property name="format" value="^ \* .+(Type|Default value|Validation type) is \{@code "/>
<property name="minimum" value="0"/>
<property name="maximum" value="0"/>
<property name="message" value="Property attribute should be on new javadoc line"/>
<property name="message" value="Property attributeExpression should be on new javadoc line"/>
</module>
<module name="RegexpSingleline">
<property name="id" value="commentFirstSentenceSingleline"/>
Expand Down Expand Up @@ -410,7 +410,7 @@
<property name="query" value="//METHOD_DEF/MODIFIERS//
ANNOTATION[./IDENT[@text='Test']]/ANNOTATION_MEMBER_VALUE_PAIR
[./IDENT[@text='expected']]"/>
<message key="matchxpath.match" value="Avoid using 'expected' attribute in Test annotation."/>
<message key="matchxpath.match" value="Avoid using 'expected' attributeExpression in Test annotation."/>
</module>
<module name="MatchXpath">
<property name="query" value="//ANNOTATION[./IDENT[@text='Issue']]"/>
Expand Down
49 changes: 33 additions & 16 deletions src/main/java/net/sf/jsqlparser/expression/Function.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import net.sf.jsqlparser.expression.operators.relational.ExpressionList;
import net.sf.jsqlparser.expression.operators.relational.NamedExpressionList;
import net.sf.jsqlparser.parser.ASTNodeAccessImpl;
import net.sf.jsqlparser.schema.*;
import net.sf.jsqlparser.statement.select.OrderByElement;
import net.sf.jsqlparser.statement.select.PlainSelect;

Expand All @@ -29,8 +30,8 @@ public class Function extends ASTNodeAccessImpl implements Expression {
private boolean distinct = false;
private boolean unique = false;
private boolean isEscaped = false;
private Expression attribute;
private String attributeName;
private Expression attributeExpression;
private Column attributeColumn = null;
private List<OrderByElement> orderByElements;
private KeepExpression keep = null;
private boolean ignoreNulls = false;
Expand All @@ -43,20 +44,20 @@ public void accept(ExpressionVisitor expressionVisitor) {
public String getName() {
return nameparts == null ? null : String.join(".", nameparts);
}

public List<String> getMultipartName() {
return nameparts;
}

public void setName(String string) {
nameparts = Arrays.asList(string);
}

public Function withName(String name) {
this.setName(name);
return this;
}

public void setName(List<String> string) {
nameparts = string;
}
Expand Down Expand Up @@ -148,20 +149,35 @@ public void setEscaped(boolean isEscaped) {
this.isEscaped = isEscaped;
}

public Expression getAttribute() {
return attribute;
public Object getAttribute() {
return attributeExpression != null ? attributeExpression : attributeColumn;
}

public void setAttribute(Expression attribute) {
this.attribute = attribute;
public void setAttribute(Expression attributeExpression) {
this.attributeExpression = attributeExpression;
}

@Deprecated
public String getAttributeName() {
return attributeName;
return attributeColumn.toString();
}

public void setAttributeName(String attributeName) {
this.attributeName = attributeName;
this.attributeColumn = new Column().withColumnName(attributeName);
}

public Column getAttributeColumn() {
return attributeColumn;
}

public void setAttribute(Column attributeColumn) {
attributeExpression = null;
this.attributeColumn = attributeColumn;
}

public Function withAttribute(Column attributeColumn) {
setAttribute(attributeColumn);
return this;
}

public KeepExpression getKeep() {
Expand Down Expand Up @@ -213,14 +229,14 @@ public String toString() {

String ans = getName() + params;

if (attribute != null) {
ans += "." + attribute.toString();
} else if (attributeName != null) {
ans += "." + attributeName;
if (attributeExpression != null) {
ans += "." + attributeExpression;
} else if (attributeColumn != null) {
ans += "." + attributeColumn;
}

if (keep != null) {
ans += " " + keep.toString();
ans += " " + keep;
}

if (isEscaped) {
Expand All @@ -235,6 +251,7 @@ public Function withAttribute(Expression attribute) {
return this;
}

@Deprecated
public Function withAttributeName(String attributeName) {
this.setAttributeName(attributeName);
return this;
Expand Down
36 changes: 25 additions & 11 deletions src/main/java/net/sf/jsqlparser/statement/select/Fetch.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,27 +9,41 @@
*/
package net.sf.jsqlparser.statement.select;

import net.sf.jsqlparser.expression.JdbcParameter;
import net.sf.jsqlparser.expression.*;

import java.io.Serializable;

public class Fetch implements Serializable {

private long rowCount;
private JdbcParameter fetchJdbcParameter = null;
private Expression expression = null;
private boolean isFetchParamFirst = false;
private String fetchParam = "ROW";

@Deprecated
public long getRowCount() {
return rowCount;
return expression instanceof LongValue ? ((LongValue) expression).getValue() : null;
}

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

public Expression getExpression() {
return expression;
}

public void setExpression(Expression expression) {
this.expression = expression;
}

public Fetch withExpression(Expression expression) {
this.setExpression(expression);
return this;
}

@Deprecated
public JdbcParameter getFetchJdbcParameter() {
return fetchJdbcParameter;
return expression instanceof JdbcParameter ? (JdbcParameter) expression : null;
}

public String getFetchParam() {
Expand All @@ -40,8 +54,9 @@ public boolean isFetchParamFirst() {
return isFetchParamFirst;
}

@Deprecated
public void setFetchJdbcParameter(JdbcParameter jdbc) {
fetchJdbcParameter = jdbc;
this.setExpression(jdbc);
}

public void setFetchParam(String s) {
Expand All @@ -54,9 +69,8 @@ public void setFetchParamFirst(boolean b) {

@Override
public String toString() {
return " FETCH " + (isFetchParamFirst ? "FIRST" : "NEXT") + " "
+ (fetchJdbcParameter!=null ? fetchJdbcParameter.toString() :
Long.toString(rowCount)) + " " + fetchParam + " ONLY";
return " FETCH " + (isFetchParamFirst ? "FIRST" : "NEXT") + " " + expression.toString()
+ " " + fetchParam + " ONLY";
}

public Fetch withRowCount(long rowCount) {
Expand Down
Loading