improved PageUtils & support natural join. issue #1711

This commit is contained in:
wenshao
2017-05-08 03:27:32 +08:00
parent 2dbe1da578
commit 306f956273
8 changed files with 221 additions and 1 deletions
@@ -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());