Skip to content

Oracle Alternative Quoting #1722

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 26 commits into from
Feb 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 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
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
25 changes: 19 additions & 6 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -1,28 +1,41 @@
---
name: SQL Parser Error
name: @ SQL Parser Error
about: Create a report to help us improve
title: 'JSQLParser Version : RDBMS : failing feature description'
title: '[BUG] JSQLParser Version : RDBMS : failing feature description'
labels: 'Parser Error', 'Feature Request', 'Documentation', 'Java API', 'RDBMS support'
assignees: ''

---

**Failing SQL Feature**
<!--
Note: Please search to see if an issue already exists for the bug you encountered.
-->

### Failing SQL Feature:
<!--
- Brief description of the failing SQL feature
- Example: `WITH ROLLUP` can't be parsed
-->

**SQL Example**
### SQL Example:
<!--
- Simplified Query Example, focusing on the failing feature
```sql
-- Replace with your ACTUAL example
select 1
from dual
```
-->

**Software Information**
### Software Information:
<!--
- JSqlParser version
- Database (e. g. Oracle, MS SQL Server, H2, PostgreSQL, IBM DB2 )
-->

**Tips**
### Tips:
<!--
Please write in English and avoid Screenshots (as we can't copy and paste content from it).
[Try your example online with the latest JSQLParser](http://217.160.215.75:8080/jsqlformatter/demo.html) and share the link in the error report.
Do provide Links or References to the specific Grammar and Syntax you are trying to use.
-->
31 changes: 31 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---
name: Feature request
about: Suggest an unsupported Statement or Expression
title: "[FEATURE] missing feature description"
labels: ''
assignees: ''

---

### Grammar or Syntax Description
- Brief description of the failing SQL feature and the EBNF
- Example: `WITH ROLLUP` clause is not supported yet

### SQL Example
- Simplified Query Example, focusing on the failing feature
```sql
-- Replace with your ACTUAL example
select 1
from dual
```
- Please don't send screen shots

### Additional context
The used JSQLParser Version (please test the latest SNAPSHOT version before submitting).
State the applicable RDBMS and version
Links to the reference documentation

### Tips:
<!--
Please write in English and avoid Screenshots (as we can't copy and paste content from it).
-->
31 changes: 31 additions & 0 deletions .github/ISSUE_TEMPLATE/sql-parser-error.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---
name: SQL Parser Error
about: Report a Parser Error
title: "[BUG] JSQLParser Version : RDBMS : failing feature description"
labels: ''
assignees: ''

---

Always check against the **Latest SNAPSHOT of JSQLParser** and the [Syntax Diagram](https://jsqlparser.github.io/JSqlParser/syntax.html)

### Failing SQL Feature:
- Brief description of the failing SQL feature
- Example: `WITH ROLLUP` can't be parsed

### SQL Example:
- Simplified Query Example, focusing on the failing feature
```sql
-- Replace with your ACTUAL example
select 1
from dual
```

### Software Information:
- JSqlParser version
- Database (e. g. Oracle, MS SQL Server, H2, PostgreSQL, IBM DB2 )

### Tips:
Please write in English and avoid Screenshots (as we can't copy and paste content from it).
[Try your example online with the latest JSQLParser](http://217.160.215.75:8080/jsqlformatter/demo.html) and share the link in the error report.
Do provide Links or References to the specific Grammar and Syntax you are trying to use.
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**.
Loading