Skip to content
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

Merge commits from JSQLParser/JSqlParser/master into PraTrick/JSqlParser/master #2

Merged
merged 26 commits into from
Feb 16, 2019
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ Please provide feedback on https://github.com/JSQLParser/JSqlParser/issues/677,

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

## Alternatives to JSqlParser?
[**General SQL Parser**](http://www.sqlparser.com/gspjava.php?ref=jsqlparser) 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.
Expand All @@ -55,6 +58,9 @@ Also I would like to know about needed examples or documentation stuff.

## Extensions in the latest SNAPSHOT version 2.0

* support for **NEXTVAL FOR**
* changed all source code license headers to reflect the dual license of JSqlParser more correctly
* support of **OPTIMIZE FOR 20 ROWS** like expressions
* allowed conditions within **then** and **else** of a **case** statement
* **SELECT * FROM mytable WHERE CASE WHEN a = 1 THEN b IN (1,2,3) ELSE c IN (1,2,3) END**
* **change of parsing** for not within condition: outer not is represented now by NotExpression
Expand Down
12 changes: 4 additions & 8 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -135,11 +135,13 @@
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>license-maven-plugin</artifactId>
<version>1.6</version>
<version>1.17</version>
<configuration>
<verbose>false</verbose>
<addJavaLicenseAfterPackage>false</addJavaLicenseAfterPackage>
<canUpdateDescription>false</canUpdateDescription>
<licenseName>dual_lgpl_ap2</licenseName>
<licenseResolver>${project.baseUri}/src/license</licenseResolver>
</configuration>
<executions>
<execution>
Expand All @@ -148,12 +150,6 @@
<goal>update-file-header</goal>
</goals>
<phase>process-sources</phase>
<configuration>
<licenseName>lgpl_v2_1</licenseName>
<roots>
<root>src/main/java</root>
</roots>
</configuration>
</execution>
</executions>
</plugin>
Expand Down Expand Up @@ -401,7 +397,7 @@
<module name="RedundantImport" />
<module name="UnusedImports" />

<module name="WhitespaceAfter" />
<module name="WhitespaceAfter" />

<module name="NeedBraces" />
<module name="UnnecessaryParentheses" />
Expand Down
1 change: 1 addition & 0 deletions src/license/dual_lgpl_ap2/header.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Dual licensed under GNU LGPL 2.1 or Apache License 2.0
710 changes: 710 additions & 0 deletions src/license/dual_lgpl_ap2/license.txt

Large diffs are not rendered by default.

10 changes: 10 additions & 0 deletions src/license/licenses.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
###
# #%L
# JSQLParser library
# %%
# Copyright (C) 2004 - 2019 JSQLParser
# %%
# Dual licensed under GNU LGPL 2.1 or Apache License 2.0
# #L%
###
dual_lgpl_ap2=Dual License GNU LGPL 2.1 or Apache License 2.0
22 changes: 3 additions & 19 deletions src/main/java/net/sf/jsqlparser/JSQLParserException.java
Original file line number Diff line number Diff line change
@@ -1,32 +1,16 @@
/*
/*-
* #%L
* JSQLParser library
* %%
* Copyright (C) 2004 - 2013 JSQLParser
* Copyright (C) 2004 - 2019 JSQLParser
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 2.1 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Lesser Public License for more details.
*
* You should have received a copy of the GNU General Lesser Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/lgpl-2.1.html>.
* Dual licensed under GNU LGPL 2.1 or Apache License 2.0
* #L%
*/
package net.sf.jsqlparser;

/**
* An exception class with stack trace informations
*/
public class JSQLParserException extends Exception {

/* The serial class version */
private static final long serialVersionUID = -1099039459759769980L;
private Throwable cause = null;

Expand Down
22 changes: 3 additions & 19 deletions src/main/java/net/sf/jsqlparser/expression/Alias.java
Original file line number Diff line number Diff line change
@@ -1,30 +1,14 @@
/*
/*-
* #%L
* JSQLParser library
* %%
* Copyright (C) 2004 - 2014 JSQLParser
* Copyright (C) 2004 - 2019 JSQLParser
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 2.1 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Lesser Public License for more details.
*
* You should have received a copy of the GNU General Lesser Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/lgpl-2.1.html>.
* Dual licensed under GNU LGPL 2.1 or Apache License 2.0
* #L%
*/
package net.sf.jsqlparser.expression;

/**
*
* @author toben
*/
public class Alias {

private String name;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,22 +1,10 @@
/*
/*-
* #%L
* JSQLParser library
* %%
* Copyright (C) 2004 - 2013 JSQLParser
* Copyright (C) 2004 - 2019 JSQLParser
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 2.1 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Lesser Public License for more details.
*
* You should have received a copy of the GNU General Lesser Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/lgpl-2.1.html>.
* Dual licensed under GNU LGPL 2.1 or Apache License 2.0
* #L%
*/
package net.sf.jsqlparser.expression;
Expand Down
26 changes: 3 additions & 23 deletions src/main/java/net/sf/jsqlparser/expression/AnalyticExpression.java
Original file line number Diff line number Diff line change
@@ -1,22 +1,10 @@
/*
/*-
* #%L
* JSQLParser library
* %%
* Copyright (C) 2004 - 2013 JSQLParser
* Copyright (C) 2004 - 2019 JSQLParser
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 2.1 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Lesser Public License for more details.
*
* You should have received a copy of the GNU General Lesser Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/lgpl-2.1.html>.
* Dual licensed under GNU LGPL 2.1 or Apache License 2.0
* #L%
*/
package net.sf.jsqlparser.expression;
Expand All @@ -27,14 +15,6 @@
import java.util.List;
import net.sf.jsqlparser.expression.operators.relational.ExpressionList;

/**
* Analytic function. The name of the function is variable but the parameters following the special
* analytic function path. e.g. row_number() over (order by test). Additional there can be an
* expression for an analytical aggregate like sum(col) or the "all collumns" wildcard like
* count(*).
*
* @author tw
*/
public class AnalyticExpression extends ASTNodeAccessImpl implements Expression {

private final OrderByClause orderBy = new OrderByClause();
Expand Down
40 changes: 3 additions & 37 deletions src/main/java/net/sf/jsqlparser/expression/AnalyticType.java
Original file line number Diff line number Diff line change
@@ -1,48 +1,14 @@
/*
/*-
* #%L
* JSQLParser library
* %%
* Copyright (C) 2004 - 2017 JSQLParser
* Copyright (C) 2004 - 2019 JSQLParser
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 2.1 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Lesser Public License for more details.
*
* You should have received a copy of the GNU General Lesser Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/lgpl-2.1.html>.
* Dual licensed under GNU LGPL 2.1 or Apache License 2.0
* #L%
*/
/*
* Copyright (C) 2017 JSQLParser.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA
*/
package net.sf.jsqlparser.expression;

/**
*
* @author Tobias Warneke (t.warneke@gmx.net)
*/
public enum AnalyticType {
OVER,
WITHIN_GROUP
Expand Down
Original file line number Diff line number Diff line change
@@ -1,34 +1,17 @@
/*
/*-
* #%L
* JSQLParser library
* %%
* Copyright (C) 2004 - 2013 JSQLParser
* Copyright (C) 2004 - 2019 JSQLParser
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 2.1 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Lesser Public License for more details.
*
* You should have received a copy of the GNU General Lesser Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/lgpl-2.1.html>.
* Dual licensed under GNU LGPL 2.1 or Apache License 2.0
* #L%
*/
package net.sf.jsqlparser.expression;

import net.sf.jsqlparser.parser.ASTNodeAccessImpl;
import net.sf.jsqlparser.statement.select.SubSelect;

/**
* Combines ANY and SOME expressions.
*
* @author toben
*/
public class AnyComparisonExpression extends ASTNodeAccessImpl implements Expression {

private final SubSelect subSelect;
Expand Down
40 changes: 3 additions & 37 deletions src/main/java/net/sf/jsqlparser/expression/AnyType.java
Original file line number Diff line number Diff line change
@@ -1,48 +1,14 @@
/*
/*-
* #%L
* JSQLParser library
* %%
* Copyright (C) 2004 - 2015 JSQLParser
* Copyright (C) 2004 - 2019 JSQLParser
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 2.1 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Lesser Public License for more details.
*
* You should have received a copy of the GNU General Lesser Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/lgpl-2.1.html>.
* Dual licensed under GNU LGPL 2.1 or Apache License 2.0
* #L%
*/
/*
* Copyright (C) 2015 JSQLParser.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA
*/
package net.sf.jsqlparser.expression;

/**
*
* @author toben
*/
public enum AnyType {

ANY,
Expand Down
22 changes: 3 additions & 19 deletions src/main/java/net/sf/jsqlparser/expression/BinaryExpression.java
Original file line number Diff line number Diff line change
@@ -1,32 +1,16 @@
/*
/*-
* #%L
* JSQLParser library
* %%
* Copyright (C) 2004 - 2013 JSQLParser
* Copyright (C) 2004 - 2019 JSQLParser
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 2.1 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Lesser Public License for more details.
*
* You should have received a copy of the GNU General Lesser Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/lgpl-2.1.html>.
* Dual licensed under GNU LGPL 2.1 or Apache License 2.0
* #L%
*/
package net.sf.jsqlparser.expression;

import net.sf.jsqlparser.parser.ASTNodeAccessImpl;

/**
* A basic class for binary expressions, that is expressions having a left member and a right member
* which are in turn expressions.
*/
public abstract class BinaryExpression extends ASTNodeAccessImpl implements Expression {

private Expression leftExpression;
Expand Down
Loading