improved sql parser, bug fixed for parent is null

This commit is contained in:
高铁
2016-02-27 19:21:28 +08:00
parent e86a34c07d
commit f5924d2661
86 changed files with 1038 additions and 667 deletions
@@ -48,6 +48,13 @@ public class PGWithQuery extends PGSQLObjectImpl {
return columns;
}
public void addColumn(SQLExpr column) {
if (column != null) {
column.setParent(this);
}
this.columns.add(column);
}
@Override
public void accept0(PGASTVisitor visitor) {
if (visitor.visit(this)) {
@@ -254,7 +254,7 @@ public class PGSQLStatementParser extends SQLStatementParser {
for (;;) {
SQLExpr expr = this.exprParser.expr();
withQuery.getColumns().add(expr);
withQuery.addColumn(expr);
if (lexer.token() == Token.COMMA) {
lexer.nextToken();
continue;