mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
improved PageUtils & support natural join. issue #1711
This commit is contained in:
@@ -458,6 +458,12 @@ public class SQLSelectParser extends SQLParser {
|
||||
|
||||
SQLJoinTableSource.JoinType joinType = null;
|
||||
|
||||
boolean natural = false;
|
||||
if (JdbcConstants.MYSQL.equals(dbType) && identifierEquals("NATURAL")) {
|
||||
lexer.nextToken();
|
||||
natural = true;
|
||||
}
|
||||
|
||||
if (lexer.token() == Token.LEFT) {
|
||||
lexer.nextToken();
|
||||
if (lexer.token() == Token.OUTER) {
|
||||
@@ -516,6 +522,14 @@ public class SQLSelectParser extends SQLParser {
|
||||
join.setJoinType(joinType);
|
||||
join.setRight(parseTableSource());
|
||||
|
||||
if (!natural) {
|
||||
if (JdbcConstants.MYSQL.equals(dbType) && "NATURAL".equalsIgnoreCase(tableSource.getAlias())) {
|
||||
tableSource.setAlias(null);
|
||||
natural = true;
|
||||
}
|
||||
}
|
||||
join.setNatural(natural);
|
||||
|
||||
if (lexer.token() == Token.ON) {
|
||||
lexer.nextToken();
|
||||
join.setCondition(expr());
|
||||
|
||||
Reference in New Issue
Block a user