Skip to content

Assorted Fixes #5 #1715

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 11 commits into from
Jan 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 0 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -180,15 +180,12 @@ spotbugs {

pmd {
consoleOutput = false
toolVersion = "6.46.0"

sourceSets = [sourceSets.main]

// clear the ruleset in order to use configured rules only
ruleSets = []

//rulesMinimumPriority = 1

ruleSetFiles = files("config/pmd/ruleset.xml")

pmdMain {
Expand Down
4 changes: 2 additions & 2 deletions config/pmd/ruleset.xml
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ under the License.
<rule ref="category/java/codestyle.xml/UnnecessaryReturn" />
<rule ref="category/java/codestyle.xml/UselessParentheses" />
<rule ref="category/java/codestyle.xml/UselessQualifiedThis" />
<!-- for Codazy -->

<!-- for Codazy -->
<rule ref="category/java/codestyle.xml/MethodNamingConventions">
<properties>
<property name="methodPattern" value="[a-z][a-zA-Z0-9]*" />
Expand Down
87 changes: 3 additions & 84 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-pmd-plugin</artifactId>
<version>3.14.0</version>
<version>3.19.0</version>
<configuration>
<rulesets>
<!-- Custom local file system rule set -->
Expand Down Expand Up @@ -218,7 +218,7 @@
<dependency>
<groupId>net.java.dev.javacc</groupId>
<artifactId>javacc</artifactId>
<version>7.0.11</version>
<version>7.0.12</version>
</dependency>
</dependencies>
</plugin>
Expand Down Expand Up @@ -418,92 +418,11 @@
<version>3.3.0</version>
</plugin>

<!-- Cobertura is broken with Java 1.8 and there is not fix
please refer to https://github.com/cobertura/cobertura/issues/248

<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>cobertura-maven-plugin</artifactId>
<version>2.7</version>
<configuration>
<aggregate>true</aggregate>
<outputDirectory>${project.reporting.outputDirectory}/cobertura</outputDirectory>
</configuration>
</plugin>
-->

<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>findbugs-maven-plugin</artifactId>
<version>3.0.5</version>
</plugin>

<!-- Obsolete or Unused
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<configuration>
<configLocation>config/sun_checks.xml</configLocation>
</configuration>
</plugin>
-->

<!-- JJDoc report generating the BNF documentation -->
<plugin>
<groupId>org.javacc.plugin</groupId>
<artifactId>javacc-maven-plugin</artifactId>
<version>3.0.3</version>
<configuration>
<!--
/**
* A flag to specify the output format for the generated documentation. If set to <code>true</code>, JJDoc will
* generate a plain text description of the BNF. Some formatting is done via tab characters, but the intention is to
* leave it as plain as possible. Specifying <code>false</code> causes JJDoc to generate a hyperlinked HTML document
* unless the parameter {@link #bnf} has been set to <code>true</code>. Default value is <code>false</code>.
*
* @parameter expression="${text}"
*/
-->
<text>false</text>

<!--
/**
* A flag whether to generate a plain text document with the unformatted BNF. Note that setting this option to
* <code>true</code> is only effective if the parameter {@link #text} is <code>false</code>. Default value is
* <code>false</code>.
*
* @parameter expression="${bnf}"
* @since 2.6
*/
-->
<bnf>false</bnf>

<!--
/**
* This option controls the structure of the generated HTML output. If set to <code>true</code>, a single HTML
* table for the entire BNF is generated. Setting it to <code>false</code> will produce one table for every
* production in the grammar.
*
* @parameter expression="${oneTable}" default-value=true
*/
-->
<oneTable>false</oneTable>

<!--
/**
* The hypertext reference to an optional CSS file for the generated HTML documents. If specified, this CSS file
* will be included via a <code>&lt;link&gt;</code> element in the HTML documents. Otherwise, the default style will
* be used.
*
* @parameter expression="${cssHref}"
* @since 2.5
*/
-->
<!-- <cssHref></cssHref> -->

<outputDirectory>${project.reporting.outputDirectory}</outputDirectory>
</configuration>
</plugin>
</plugins>
</reporting>

Expand Down Expand Up @@ -628,7 +547,7 @@

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<pmdVersion>6.46.0</pmdVersion>
<pmdVersion>6.53.0</pmdVersion>
</properties>

<description>JSqlParser parses an SQL statement and translate it into a hierarchy of Java classes.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ public P withUnsupportedStatements(boolean allowUnsupportedStatements) {
public P withTimeOut(int timeOutMillSeconds) {
return withFeature(Feature.timeOut, timeOutMillSeconds);
}

public P withBackslashEscapeCharacter(boolean allowBackslashEscapeCharacter) {
return withFeature(Feature.allowBackslashEscapeCharacter, allowBackslashEscapeCharacter);
}

public P withFeature(Feature f, boolean enabled) {
getConfiguration().setValue(f, enabled);
Expand Down
10 changes: 8 additions & 2 deletions src/main/java/net/sf/jsqlparser/parser/feature/Feature.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
import net.sf.jsqlparser.statement.DeclareStatement;
import net.sf.jsqlparser.statement.DescribeStatement;
import net.sf.jsqlparser.statement.ExplainStatement;
import net.sf.jsqlparser.statement.SetStatement;
import net.sf.jsqlparser.statement.ResetStatement;
import net.sf.jsqlparser.statement.SetStatement;
import net.sf.jsqlparser.statement.ShowColumnsStatement;
import net.sf.jsqlparser.statement.ShowStatement;
import net.sf.jsqlparser.statement.UseStatement;
Expand Down Expand Up @@ -447,6 +447,7 @@ public enum Feature {
*
* @see Replace
*/
@Deprecated
replace,
/**
* SQL "DROP" statement is allowed
Expand Down Expand Up @@ -758,7 +759,12 @@ public enum Feature {
*/
allowUnsupportedStatements(false),

timeOut( 6000)
timeOut( 6000),

/**
* allows Backslash '\' as Escape Character
*/
allowBackslashEscapeCharacter(false),
;

private Object value;
Expand Down
18 changes: 17 additions & 1 deletion src/main/java/net/sf/jsqlparser/statement/drop/Drop.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ public class Drop implements Statement {
private boolean ifExists = false;
private boolean materialized = false;

private boolean isUsingTemporary;

@Override
public void accept(StatementVisitor statementVisitor) {
statementVisitor.visit(this);
Expand Down Expand Up @@ -67,6 +69,19 @@ public void setIfExists(boolean ifExists) {
this.ifExists = ifExists;
}

public boolean isUsingTemporary() {
return isUsingTemporary;
}

public void setUsingTemporary(boolean useTemporary) {
this.isUsingTemporary=useTemporary;
}

public Drop withUsingTemporary(boolean useTemporary) {
setUsingTemporary(useTemporary);
return this;
}

public boolean isMaterialized() {
return materialized;
}
Expand All @@ -85,7 +100,8 @@ public void setTypeToParameters(Map<String, List<String>> typeToParameters) {

@Override
public String toString() {
String sql = "DROP "
String sql = "DROP "
+ (isUsingTemporary ? "TEMPORARY " : "")
+ (materialized ? "MATERIALIZED " : "")
+ type + " "
+ (ifExists ? "IF EXISTS " : "") + name.toString();
Expand Down
Loading