Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
123 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
21c4550
Merge branch 'master' of https://github.com/JSQLParser/JSqlParser
manticore-projects Mar 12, 2023
e8a29de
Merge branch 'master' of https://github.com/JSQLParser/JSqlParser
manticore-projects Apr 29, 2023
8a1bdec
feat: Lateral View
manticore-projects Apr 29, 2023
4efb99f
feat: Oracle `HAVING` before `GROUP BY`
manticore-projects Apr 29, 2023
9da7a06
feat: Multi-Part Names for Variables and Parameters
manticore-projects Apr 29, 2023
4b7f21c
feat: ClickHouse `Select...` ``FINAL` modifier
manticore-projects Apr 29, 2023
6281b07
feat: Test if a JOIN is an INNER JOIN according to the SQL:2016
manticore-projects Apr 30, 2023
b6ea8b1
feat: Switch off contradicting `JOIN` qualifiers, when setting a qual…
manticore-projects Apr 30, 2023
3a27a9d
feat: implement SQL:2016 Convert() and Trim()
manticore-projects Apr 30, 2023
4d5e26d
feat: ClickHouse `LIMIT ... BY ...` clause
manticore-projects Apr 30, 2023
f0a6f37
test: add specific tests for closed issues
manticore-projects Apr 30, 2023
ff16faf
test: add specific tests for closed issues
manticore-projects Apr 30, 2023
b9057d2
refactor: remove `SelectExpressionItem` in favor of `SelectItem`
manticore-projects Apr 30, 2023
286834d
doc: Update examples
manticore-projects Apr 30, 2023
0be65a4
build: Add missing import
manticore-projects Apr 30, 2023
4ddc835
doc: Update the README.md
manticore-projects May 1, 2023
fc577ca
fix: assign Enum case insensitive
manticore-projects May 2, 2023
86d0ace
fix: assign Enum case insensitive
manticore-projects May 2, 2023
a5140c7
Revert "fix: assign Enum case insensitive"
manticore-projects May 2, 2023
288b177
feat: Consolidate the `ExpressionList`, removing many redundant List …
manticore-projects May 3, 2023
905ef65
fix: Remove tests for `()`, since `ParenthesedExpressionList` will ca…
manticore-projects May 3, 2023
85b3bc4
refactor: UpdateSets for `Update` and `InsertConflictTarget`
manticore-projects May 3, 2023
e16ba5d
build: Increase TimeOut for the GitHub CI
manticore-projects May 3, 2023
2eb8c80
style: Appease Codacy
manticore-projects May 3, 2023
f449263
style: Checkstyle
manticore-projects May 3, 2023
141708e
refactor: Remove `ItemsList`, `MultiExpressionList`, `Replace`
manticore-projects May 4, 2023
67b3804
style: Appease Codacy
manticore-projects May 4, 2023
f89df27
style: Rework all the ENUMs
manticore-projects May 5, 2023
a590036
doc: Better Sphinx Tabs
manticore-projects May 6, 2023
c81d60a
doc: RR chart colors cater for Dark Mode
manticore-projects May 6, 2023
3903a80
refactor: remove SimpleFunction
manticore-projects May 6, 2023
2d200b0
build: improve Gradle Build
manticore-projects May 7, 2023
89600d4
refactor: `Insert` uses `ExpressionList` and `UpdateSet`
manticore-projects May 7, 2023
a11febb
test: Disable API Sanitation for the moment
manticore-projects May 7, 2023
399e1d7
style: Appease Checkstyle
manticore-projects May 7, 2023
f5d35d0
style: Appease PMD
manticore-projects May 7, 2023
21389b7
fix: find the correct position when field belongs to an internal class
manticore-projects May 9, 2023
52df291
style: replace all List<Expression> with ExpressionList<> and enforce…
manticore-projects May 9, 2023
9fbdaae
refactor: generify `SelectItem` and remove `FunctionItem` and `Expres…
manticore-projects May 9, 2023
7cecd29
fix: Java Version 8
manticore-projects May 9, 2023
c07a43b
feat: JdbcNamedParameter allows "&" (instead of ":")
manticore-projects May 11, 2023
09a70a4
feat: access Elements of Array Columns
manticore-projects May 11, 2023
6e7a78d
feat: `MEMBER OF` condition as shown at https://dev.mysql.com/doc/ref…
manticore-projects May 11, 2023
8a75aa7
style: appease PMD/Codacy
manticore-projects May 11, 2023
ce2b18a
style: appease PMD/Codacy
manticore-projects May 11, 2023
c9dce62
Merge remote-tracking branch 'manticore/Lateral_View' into Lateral_View
manticore-projects May 11, 2023
decf662
test: add unit test for issue #1778
manticore-projects May 11, 2023
c53667f
feat: Write API documentation to the WebSite via XMLDoclet
manticore-projects May 14, 2023
1132338
Update sphinx.yml
manticore-projects May 14, 2023
f3e8952
build: Sphinx build fixes
manticore-projects May 14, 2023
f515cda
Merge branch 'master' of https://github.com/manticore-projects/JSqlPa…
manticore-projects May 14, 2023
11b563c
build: Sphinx build fixes
manticore-projects May 14, 2023
961378d
build: Sphinx build fixes
manticore-projects May 14, 2023
48d5340
Merge branch 'master' of https://github.com/manticore-projects/JSqlPa…
manticore-projects May 14, 2023
8fb9110
build: improve the GIT Snapshot detection
manticore-projects May 15, 2023
88d1b62
fix: issue #1791
manticore-projects May 15, 2023
d20c8e9
fix: issue #1789
manticore-projects May 16, 2023
32ec561
fix: issue #1789
manticore-projects May 16, 2023
9fa0f4b
Merge remote-tracking branch 'manticore/Lateral_View' into Lateral_View
manticore-projects May 16, 2023
01a5fb7
refactor: simplify production `CreateParameter()`
manticore-projects May 16, 2023
daa56ed
refactor: SHOW statement, supporting any RDBMS specific implementation
manticore-projects May 16, 2023
4fb1cfb
refactor: RETURNING clause
manticore-projects May 16, 2023
da32442
refactor: CREATE and ALTER productions
manticore-projects May 16, 2023
4f0488c
fix: Complex Parsing Approach
manticore-projects May 17, 2023
3ff9774
style: Quieten the logger
manticore-projects May 17, 2023
a7dfb94
style: Cosmetic improvements
manticore-projects May 17, 2023
6ef5e0b
feat: chaining JSON Expressions
manticore-projects May 17, 2023
4f91746
style: remove unused imports
manticore-projects May 17, 2023
9dafae8
refact: Statements extends List<Statement>
manticore-projects May 17, 2023
4bdabed
build: try to work around the Maven/JDK8 issue on GitHub
manticore-projects May 17, 2023
64b0331
feat: parse CREATE TRIGGER as UnsupportedStatement
manticore-projects May 17, 2023
e19dc0e
feat: functions blocks, parenthesed JSON Expressions
manticore-projects May 18, 2023
5263b91
feat: functions blocks, parenthesed JSON Expressions
manticore-projects May 18, 2023
be7fc53
Create gradle.yml
manticore-projects May 18, 2023
73c55fd
feat: Quoted Identifiers can contain double-quotes (PostgreSQL)
manticore-projects May 18, 2023
a558871
build: improve Upload task
manticore-projects May 19, 2023
5e7732c
doc: Website improvements
manticore-projects May 22, 2023
68ce27c
doc: Website, fix tabs
manticore-projects May 24, 2023
cb960a3
fix: throw the specific exception
manticore-projects May 29, 2023
2b4a929
doc: write migration guide
manticore-projects May 29, 2023
54b4303
Merge branch 'master' of https://github.com/manticore-projects/JSqlPa…
manticore-projects May 29, 2023
b6fab2a
fix: expose IntervalExpression attributes and use DeParser
manticore-projects Jun 1, 2023
6d2b421
doc: migration guide
manticore-projects Jun 2, 2023
8027dbf
feat: T-SQL `FOR ...` clause
manticore-projects Jun 2, 2023
94d00f0
Merge remote-tracking branch 'origin/master'
manticore-projects Jun 2, 2023
6f27765
fix: SPHINX modules and themes
manticore-projects Jun 2, 2023
f5e9f53
docs: write migration guide
manticore-projects Jun 11, 2023
996ebd9
Merge branch 'master' of github.com:manticore-projects/JSqlParser
manticore-projects Jun 11, 2023
75e4d30
feat: `QUALIFY` clause
manticore-projects Jun 15, 2023
386dc7a
feat: Postgres `NOTNULL` support
manticore-projects Jun 15, 2023
f132547
feat: MySQL `NOT RLIKE`, `NOT REGEXP` expressions
manticore-projects Jun 15, 2023
420d7d8
fix: `INSERT` must use simple Column Names only
manticore-projects Jun 15, 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
feat: Oracle Alternative Quoting
- add support for Oracle Alternative Quoting e.g. `q'(...)'`
- fixes #1718
- add a Logo and FavIcon to the Website
- document recent changes on Quoting/Escaping
- add an example on building SQL from Java
- rework the README.md, promote the Website
- add Spotless Formatter, using Google Java Style (with Tab=4 Spaces)
  • Loading branch information
manticore-projects committed Jan 29, 2023
commit c57c427032c91d078230f3681f5d1c35dfeead75
152 changes: 44 additions & 108 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# JSqlParser
# [JSqlParser (4.5 Stable or 4.6 Snapshot)](https://jsqlparser.github.io/JSqlParser) <img src="src/site/sphinx/_images/logo-no-background.svg" alt="drawing" width="200" align="right"/>

![Build Status](https://github.com/JSQLParser/JSqlParser/actions/workflows/maven.yml/badge.svg)

Expand All @@ -9,127 +9,63 @@

[![Gitter](https://badges.gitter.im/JSQLParser/JSqlParser.svg)](https://gitter.im/JSQLParser/JSqlParser?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)

Look here for more information and examples: https://github.com/JSQLParser/JSqlParser/wiki.

## License

JSqlParser is dual licensed under **LGPL V2.1** or **Apache Software License, Version 2.0**.

## Discussion

Please provide feedback on:

* API changes: extend visitor with return values (https://github.com/JSQLParser/JSqlParser/issues/901)

## News
* Released version **4.5** of JSqlParser
* The array parsing is the default behaviour. Square bracket quotation has to be enabled using
a parser flag (**CCJSqlParser.withSquareBracketQuotation**).
* due to an API change the version will be 3.0
* JSqlParser uses now Java 8 at the minimum

More news can be found here: https://github.com/JSQLParser/JSqlParser/wiki/News.

## Alternatives to JSqlParser?
[**General SQL Parser**](http://www.sqlparser.com/features/introduce.php?utm_source=github-jsqlparser&utm_medium=text-general) looks pretty good, with extended SQL syntax (like PL/SQL and T-SQL) and java + .NET APIs. The tool is commercial (license available online), with a free download option.

## JSqlParser

JSqlParser is a SQL statement parser. It translates SQLs in a traversable hierarchy of Java classes. JSqlParser is not limited to one database but provides support for a lot of specials of Oracle, SqlServer, MySQL, PostgreSQL ... To name some, it has support for Oracles join syntax using (+), PostgreSQLs cast syntax using ::, relational operators like != and so on.

## Support
If you need help using JSqlParser feel free to file an issue or contact me.

## Contributions
To help JSqlParser's development you are encouraged to provide
* feedback
* bugreports
* pull requests for new features
* improvement requests
* fund new features or sponsor JSqlParser ([**Sponsor**](https://www.paypal.me/wumpz))

**Please write in English, since it's the language most of the dev team knows.**
## Summary

Any requests for examples or any particular documentation will be most welcome.
Please visit the [WebSite](https://jsqlparser.github.io/JSqlParser). **JSqlParser** is a RDBMS agnostic SQL statement parser. It translates SQL statements into a traversable hierarchy of Java classes (see [Samples](https://jsqlparser.github.io/JSqlParser/usage.html#parse-a-sql-statements)):

## Extensions in the latest SNAPSHOT version 4.6

* support for named windows in window expressions: `SELECT sum(c) OVER winName FROM mytable WINDOW winName AS (PARTITION BY pcol)`
```sql
SELECT 1 FROM dual WHERE a = b
```

Additionally, we have fixed many errors and improved the code quality and the test coverage.
```text
SQL Text
└─Statements: net.sf.jsqlparser.statement.select.Select
└─selectBody: net.sf.jsqlparser.statement.select.PlainSelect
├─selectItems -> Collection<SelectExpressionItem>
│ └─selectItems: net.sf.jsqlparser.statement.select.SelectExpressionItem
│ └─LongValue: 1
├─Table: dual
└─where: net.sf.jsqlparser.expression.operators.relational.EqualsTo
├─Column: a
└─Column: b
```

## Extensions of JSqlParser releases
```java
Statement statement = CCJSqlParserUtil.parse(sqlStr);
if (statement instanceof Select) {
Select select = (Select) statement;
PlainSelect plainSelect = (PlainSelect) select.getSelectBody();

* [Release Notes](https://github.com/JSQLParser/JSqlParser/releases)
* Modifications before GitHub's release tagging are listed in the [Older Releases](https://github.com/JSQLParser/JSqlParser/wiki/Older-Releases) page.
SelectExpressionItem selectExpressionItem =
(SelectExpressionItem) plainSelect.getSelectItems().get(0);

## Building from the sources
Table table = (Table) plainSelect.getFromItem();

As the project is a Maven project, building is rather simple by running:
```shell
mvn package
EqualsTo equalsTo = (EqualsTo) plainSelect.getWhere();
Column a = (Column) equalsTo.getLeftExpression();
Column b = (Column) equalsTo.getRightExpression();
}
```

Since 4.2, alternatively Gradle can be used
```shell
gradle build
```

The project requires the following to build:
- Maven (or Gradle)
- JDK 8 or later. The JAR will target JDK 8, but the version of the maven-compiler-plugin that JSqlParser uses requires JDK 8+
## [Supported Grammar and Syntax](https://jsqlparser.github.io/JSqlParser/syntax.html)

This will produce the jsqlparser-VERSION.jar file in the `target/` directory (`build/libs/jsqlparser-VERSION.jar` in case of Gradle).
**JSqlParser** aims to support the SQL standard as well as all major RDBMS. Any missing syntax or features can be added on demand.

**To build this project without using Maven or Gradle, one has to build the parser by JavaCC using the CLI options it provides.**
| RDBMS | Statements |
|------------------------------------|-----------------------------------------|
| Oracle<br>MS SQL Server and Sybase<br>PostgreSQL<br>MySQL and MariaDB<br>DB2<br>H2 and HSQLDB and Derby<br>SQLite| `SELECT`<br>`INSERT`, `UPDATE`, `UPSERT`, `MERGE`<br>`DELETE`, `TRUNCATE TABLE`<br>`CREATE ...`, `ALTER ....`, `DROP ...`<br>`WITH ...` |

## Debugging through problems

Refer to the [Visualize Parsing](https://github.com/JSQLParser/JSqlParser/wiki/Examples-of-SQL-parsing#visualize-parsing) section to learn how to run the parser in debug mode.
**JSqlParser** can also be used to create SQL Statements from Java Code with a fluent API (see [Samples](https://jsqlparser.github.io/JSqlParser/usage.html#build-a-sql-statements)).

## Source Code conventions
## [Documentation](https://jsqlparser.github.io/JSqlParser)

Recently a checkstyle process was integrated into the build process. JSqlParser follows the sun java format convention. There are no TABs allowed. Use spaces.
### [Samples](https://jsqlparser.github.io/JSqlParser/usage.html#parse-a-sql-statements)
### [Build Instructions](https://jsqlparser.github.io/JSqlParser/usage.html)
### [Contribution](https://jsqlparser.github.io/JSqlParser/contribution.html)
### [Change Log](https://jsqlparser.github.io/JSqlParser/changelog.html#latest-changes-since-jsqlparser-version)
### [Issues](https://github.com/JSQLParser/JSqlParser/issues)

```java
public void setUsingSelect(SubSelect usingSelect) {
this.usingSelect = usingSelect;
if (this.usingSelect != null) {
this.usingSelect.setUseBrackets(false);
}
}
```

This is a valid piece of source code:
* blocks without braces are not allowed
* after control statements (if, while, for) a whitespace is expected
* the opening brace should be in the same line as the control statement

## Maven Repository

JSQLParser is deployed at Sonatype open source maven repository.
Starting from now I will deploy there. The first snapshot version there will be 0.8.5-SNAPSHOT.
To use it this is the repository configuration:

```xml
<repositories>
<repository>
<id>jsqlparser-snapshots</id>
<snapshots>
<enabled>true</enabled>
</snapshots>
<url>https://oss.sonatype.org/content/groups/public/</url>
</repository>
</repositories>
```
These repository releases will be synchronised to Maven Central. Snapshots remain at Sonatype.

And this is the dependency declaration in your pom:
```xml
<dependency>
<groupId>com.github.jsqlparser</groupId>
<artifactId>jsqlparser</artifactId>
<version>4.5</version>
</dependency>
```
## License

**JSqlParser** is dual licensed under **LGPL V2.1** or **Apache Software License, Version 2.0**.
41 changes: 31 additions & 10 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@ plugins {
id "ca.coglinc2.javacc" version "latest.release"
id 'jacoco'
id "com.github.spotbugs" version "latest.release"
id "com.diffplug.spotless" version "latest.release"
id 'pmd'
id 'checkstyle'

// download the RR tools which have no Maven Repository
id "de.undercouch.download" version "latest.release"

Expand Down Expand Up @@ -98,6 +99,7 @@ java {
}

test {
environment = [ 'EXPORT_TEST_TO_FILE': 'True' ]
useJUnitPlatform()

// set heap size for the test JVM(s)
Expand Down Expand Up @@ -200,23 +202,23 @@ spotbugsMain {
spotbugs {
// fail only on P1 and without the net.sf.jsqlparser.parser.*
excludeFilter = file("config/spotbugs/spotBugsExcludeFilter.xml")

// do not run over the test, although we should do that eventually
spotbugsTest.enabled = false
spotbugsTest.enabled = false
}

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 {
excludes = [
"build/generated/*"
Expand All @@ -229,6 +231,25 @@ checkstyle {
configFile =rootProject.file('config/checkstyle/checkstyle.xml')
}

spotless {
// optional: limit format enforcement to just the files changed by this feature branch
ratchetFrom 'origin/master'

format 'misc', {
// define the files to apply `misc` to
target '*.gradle', '*.md', '.gitignore'

// define the steps to apply to those files
trimTrailingWhitespace()
indentWithSpaces(4) // or spaces. Takes an integer argument if you don't like 4
endWithNewline()
}
java {
indentWithSpaces(4)
eclipse().configFile('config/formatter/eclipse-java-google-style.xml')
}
}

tasks.withType(Checkstyle) {
reports {
xml.required = false
Expand All @@ -239,7 +260,7 @@ tasks.withType(Checkstyle) {
task renderRR() {
dependsOn(compileJavacc)
doLast {
// these WAR files have been provided as a courtesy by Gunther Rademacher
// these WAR files have been provided as a courtesy by Gunther Rademacher
// and belong to the RR - Railroad Diagram Generator Project
// https://github.com/GuntherRademacher/rr
//
Expand Down Expand Up @@ -340,8 +361,8 @@ task sphinx(type: Exec) {
dependsOn(gitChangelogTask, renderRR, updateKeywords)

String PROLOG = """
.. |_| unicode:: U+00A0
:trim:
.. |_| unicode:: U+00A0
:trim:

.. |JSQLPARSER_EMAIL| replace:: support@manticore-projects.com
.. |JSQLPARSER_VERSION| replace:: ${getVersion(false)}
Expand Down
4 changes: 2 additions & 2 deletions config/formatter/eclipse-java-google-style.xml
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.tabulation.size" value="2"/>
<setting id="org.eclipse.jdt.core.formatter.tabulation.size" value="4"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block" value="insert"/>
Expand Down Expand Up @@ -241,7 +241,7 @@
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant.count_dependent" value="16|-1|16"/>
<setting id="org.eclipse.jdt.core.formatter.comment.line_length" value="100"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.blank_lines_between_import_groups" value="1"/>
<setting id="org.eclipse.jdt.core.formatter.blank_lines_between_import_groups" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_semicolon" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration" value="end_of_line"/>
Expand Down
44 changes: 44 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,50 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>com.diffplug.spotless</groupId>
<artifactId>spotless-maven-plugin</artifactId>
<version>2.28.0</version>
<configuration>
<!-- optional: limit format enforcement to just the files changed by this feature branch -->
<ratchetFrom>origin/master</ratchetFrom>
<formats>
<!-- you can define as many formats as you want, each is independent -->
<format>
<!-- define the files to apply to -->
<includes>
<include>*.md</include>
<include>.gitignore</include>
</includes>
<!-- define the steps to apply to those files -->
<trimTrailingWhitespace/>
<endWithNewline/>
<indent>
<tabs>true</tabs>
<spacesPerTab>4</spacesPerTab>
</indent>
</format>
</formats>
<!-- define a language-specific format -->
<java>
<!-- These are the defaults, you can override if you want -->
<includes>
<include>src/main/java/**/*.java</include>
<include>src/test/java/**/*.java</include>
</includes>

<importOrder /> <!-- standard import order -->
<removeUnusedImports />

<!-- Apply Google style guide https://google.github.io/styleguide/javaguide.html -->
<eclipse>
<file>config/formatter/eclipse-java-google-style.xml</file>
</eclipse>

<formatAnnotations /> <!-- fixes formatting of type annotations, see below -->
</java>
</configuration>
</plugin>
</plugins>
</build>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public final class StringValue extends ASTNodeAccessImpl implements Expression {
private String value = "";
private String prefix = null;

public static final List<String> ALLOWED_PREFIXES = Arrays.asList("N", "U", "E", "R", "B", "RB", "_utf8");
public static final List<String> ALLOWED_PREFIXES = Arrays.asList("N", "U", "E", "R", "B", "RB", "_utf8", "Q");

public StringValue() {
// empty constructor
Expand Down
11 changes: 10 additions & 1 deletion src/main/jjtree/net/sf/jsqlparser/parser/JSqlParserCC.jjt
Original file line number Diff line number Diff line change
Expand Up @@ -518,7 +518,16 @@ TOKEN:

| < #SPECIAL_ESC: "\\'" > /* Allowing this will break LIKE ... ESCAPE ... */
| < #ESC: "\\" ["n","t","b","r","f","\\","\""] >
| < S_CHAR_LITERAL: (["U","E","N","R","B"]|"RB"|"_utf8")? (("'" ( <ESC> | <SPECIAL_ESC> | ~["'", "\\"] )* "'") | ("'" ("''" | ~["'"])* "'")) >
| < S_CHAR_LITERAL: (["U","E","N","R","B"]|"RB"|"_utf8")?
(
("'" ( <ESC> | <SPECIAL_ESC> | ~["'", "\\"] )* "'") | ("'" ("''" | ~["'"])* "'")
// Alternative Oracle Escape Modes
| ("q'{" (~[])* "}'")
| ("q'(" (~[])* ")'")
| ("q'[" (~[])* "]'")
| ("q''" (~[])* "''")
// | ("q'\\" (~[])* "\\'") <--- Does not work
) >
{
// <S_CHAR_LITERAL> contains the <SPECIAL_ESC> token and always the longest match is returned
// So when Backslash is explicitly not allowed as an Escape Character and a <S_CHAR_LITERAL> is found
Expand Down
12 changes: 11 additions & 1 deletion src/main/resources/rr/xhtml2rst.xsl
Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
#%L
JSQLParser library
%%
Copyright (C) 2004 - 2023 JSQLParser
%%
Dual licensed under GNU LGPL 2.1 or Apache License 2.0
#L%
-->

<xsl:stylesheet version="1.1"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xhtml="http://www.w3.org/1999/xhtml"
Expand Down Expand Up @@ -92,4 +102,4 @@ The EBNF and Railroad Diagrams for JSQLParser-|JSQLPARSER_VERSION|.
</a>
</li>
</xsl:template>
</xsl:stylesheet>
</xsl:stylesheet>
Loading