-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feature/fix: parsing inserts/updates/delete within CTEs (#2055)
* feature parsing inserts/updates/delete within CTEs * removing System lines * fixing codacy issues * reducing the looping in NestedBracketsPerformanceTest to just 6 * formatting fixes via spotlessApply
- Loading branch information
Showing
36 changed files
with
1,313 additions
and
213 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
src/main/java/net/sf/jsqlparser/statement/ParenthesedStatement.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/*- | ||
* #%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.statement; | ||
|
||
import net.sf.jsqlparser.expression.Alias; | ||
|
||
public interface ParenthesedStatement extends Statement { | ||
|
||
<T, S> T accept(StatementVisitor<T> statementVisitor, S context); | ||
|
||
default void accept(StatementVisitor<?> statementVisitor) { | ||
this.accept(statementVisitor, null); | ||
} | ||
|
||
Alias getAlias(); | ||
|
||
void setAlias(Alias alias); | ||
|
||
default ParenthesedStatement withAlias(Alias alias) { | ||
setAlias(alias); | ||
return this; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
62 changes: 62 additions & 0 deletions
62
src/main/java/net/sf/jsqlparser/statement/delete/ParenthesedDelete.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
/*- | ||
* #%L | ||
* JSQLParser library | ||
* %% | ||
* Copyright (C) 2004 - 2023 JSQLParser | ||
* %% | ||
* Dual licensed under GNU LGPL 2.1 or Apache License 2.0 | ||
* #L% | ||
*/ | ||
package net.sf.jsqlparser.statement.delete; | ||
|
||
import net.sf.jsqlparser.expression.Alias; | ||
import net.sf.jsqlparser.statement.ParenthesedStatement; | ||
import net.sf.jsqlparser.statement.StatementVisitor; | ||
|
||
public class ParenthesedDelete extends Delete implements ParenthesedStatement { | ||
|
||
Alias alias; | ||
Delete delete; | ||
|
||
@Override | ||
public Alias getAlias() { | ||
return alias; | ||
} | ||
|
||
@Override | ||
public void setAlias(Alias alias) { | ||
this.alias = alias; | ||
} | ||
|
||
public ParenthesedDelete withAlias(Alias alias) { | ||
this.setAlias(alias); | ||
return this; | ||
} | ||
|
||
public Delete getDelete() { | ||
return delete; | ||
} | ||
|
||
public void setDelete(Delete delete) { | ||
this.delete = delete; | ||
} | ||
|
||
public ParenthesedDelete withDelete(Delete delete) { | ||
setDelete(delete); | ||
return this; | ||
} | ||
|
||
public String toString() { | ||
StringBuilder builder = new StringBuilder(); | ||
builder.append("(").append(delete).append(")"); | ||
if (alias != null) { | ||
builder.append(alias); | ||
} | ||
return builder.toString(); | ||
} | ||
|
||
@Override | ||
public <T, S> T accept(StatementVisitor<T> statementVisitor, S context) { | ||
return statementVisitor.visit(this, context); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
61 changes: 61 additions & 0 deletions
61
src/main/java/net/sf/jsqlparser/statement/insert/ParenthesedInsert.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
/*- | ||
* #%L | ||
* JSQLParser library | ||
* %% | ||
* Copyright (C) 2004 - 2023 JSQLParser | ||
* %% | ||
* Dual licensed under GNU LGPL 2.1 or Apache License 2.0 | ||
* #L% | ||
*/ | ||
package net.sf.jsqlparser.statement.insert; | ||
|
||
import net.sf.jsqlparser.expression.Alias; | ||
import net.sf.jsqlparser.statement.ParenthesedStatement; | ||
import net.sf.jsqlparser.statement.StatementVisitor; | ||
|
||
public class ParenthesedInsert extends Insert implements ParenthesedStatement { | ||
Alias alias; | ||
Insert insert; | ||
|
||
@Override | ||
public Alias getAlias() { | ||
return alias; | ||
} | ||
|
||
@Override | ||
public void setAlias(Alias alias) { | ||
this.alias = alias; | ||
} | ||
|
||
public ParenthesedInsert withAlias(Alias alias) { | ||
this.setAlias(alias); | ||
return this; | ||
} | ||
|
||
public Insert getInsert() { | ||
return insert; | ||
} | ||
|
||
public void setInsert(Insert insert) { | ||
this.insert = insert; | ||
} | ||
|
||
public ParenthesedInsert withInsert(Insert insert) { | ||
setInsert(insert); | ||
return this; | ||
} | ||
|
||
public String toString() { | ||
StringBuilder builder = new StringBuilder(); | ||
builder.append("(").append(insert).append(")"); | ||
if (alias != null) { | ||
builder.append(alias); | ||
} | ||
return builder.toString(); | ||
} | ||
|
||
@Override | ||
public <T, S> T accept(StatementVisitor<T> statementVisitor, S context) { | ||
return statementVisitor.visit(this, context); | ||
} | ||
} |
Oops, something went wrong.