diff --git a/src/main/java/net/sf/jsqlparser/parser/AbstractJSqlParser.java b/src/main/java/net/sf/jsqlparser/parser/AbstractJSqlParser.java index 771402b1a..13ebcd781 100644 --- a/src/main/java/net/sf/jsqlparser/parser/AbstractJSqlParser.java +++ b/src/main/java/net/sf/jsqlparser/parser/AbstractJSqlParser.java @@ -9,12 +9,12 @@ */ package net.sf.jsqlparser.parser; -import java.util.ArrayList; -import java.util.List; - import net.sf.jsqlparser.parser.feature.Feature; import net.sf.jsqlparser.parser.feature.FeatureConfiguration; +import java.util.ArrayList; +import java.util.List; + public abstract class AbstractJSqlParser
{
protected int jdbcParameterIndex = 0;
@@ -26,7 +26,7 @@ public P withSquareBracketQuotation(boolean allowSquareBracketQuotation) {
}
public P withAllowComplexParsing(boolean allowComplexParsing) {
- return withFeature(Feature.allowComplexParsing, allowComplexParsing);
+ return withFeature(Feature.allowComplexParsing, allowComplexParsing);
}
public P withUnsupportedStatements(boolean allowUnsupportedStatements) {
@@ -40,7 +40,7 @@ public P withTimeOut(long timeOutMillSeconds) {
public P withBackslashEscapeCharacter(boolean allowBackslashEscapeCharacter) {
return withFeature(Feature.allowBackslashEscapeCharacter, allowBackslashEscapeCharacter);
}
-
+
public P withFeature(Feature f, boolean enabled) {
getConfiguration().setValue(f, enabled);
return me();
diff --git a/src/main/java/net/sf/jsqlparser/util/TablesNamesFinder.java b/src/main/java/net/sf/jsqlparser/util/TablesNamesFinder.java
index 7a94ceff7..4dc760925 100644
--- a/src/main/java/net/sf/jsqlparser/util/TablesNamesFinder.java
+++ b/src/main/java/net/sf/jsqlparser/util/TablesNamesFinder.java
@@ -176,6 +176,7 @@
import net.sf.jsqlparser.statement.update.Update;
import net.sf.jsqlparser.statement.upsert.Upsert;
+
/**
* Find all used tables within an select statement.
*
@@ -294,15 +295,7 @@ public void visit(PlainSelect plainSelect) {
plainSelect.getFromItem().accept(this);
}
- if (plainSelect.getJoins() != null) {
- for (Join join : plainSelect.getJoins()) {
- join.getFromItem().accept(this);
- join.getRightItem().accept(this);
- for (Expression expression : join.getOnExpressions()) {
- expression.accept(this);
- }
- }
- }
+ visitJoins(plainSelect.getJoins());
if (plainSelect.getWhere() != null) {
plainSelect.getWhere().accept(this);
}
@@ -807,15 +800,7 @@ public void visit(Delete delete) {
}
}
- if (delete.getJoins() != null) {
- for (Join join : delete.getJoins()) {
- join.getFromItem().accept(this);
- join.getRightItem().accept(this);
- for (Expression expression : join.getOnExpressions()) {
- expression.accept(this);
- }
- }
- }
+ visitJoins(delete.getJoins());
if (delete.getWhere() != null) {
delete.getWhere().accept(this);
@@ -1033,6 +1018,26 @@ public void visit(UseStatement use) {
@Override
public void visit(ParenthesedFromItem parenthesis) {
parenthesis.getFromItem().accept(this);
+ // support join keyword in fromItem
+ visitJoins(parenthesis.getJoins());
+ }
+
+ /**
+ * visit join block
+ *
+ * @param parenthesis join sql block
+ */
+ private void visitJoins(List