improve sql parser

This commit is contained in:
wenshao
2013-08-03 15:45:40 +08:00
parent 1974aa2cce
commit 6e5fb2e7df
346 changed files with 1700 additions and 1436 deletions
@@ -20,11 +20,8 @@ import com.alibaba.druid.sql.dialect.postgresql.visitor.PGASTVisitor;
import com.alibaba.druid.sql.visitor.SQLASTVisitor;
public class PGOrderBy extends SQLOrderBy {
private static final long serialVersionUID = 1L;
private boolean sibings;
private boolean sibings;
public boolean isSibings() {
return this.sibings;
@@ -21,8 +21,6 @@ import com.alibaba.druid.sql.visitor.SQLASTVisitor;
public abstract class PGSQLObjectImpl extends SQLObjectImpl implements PGSQLObject {
private static final long serialVersionUID = 1L;
public PGSQLObjectImpl(){
}
@@ -21,31 +21,31 @@ import java.util.List;
import com.alibaba.druid.sql.dialect.postgresql.visitor.PGASTVisitor;
public class PGWithClause extends PGSQLObjectImpl {
private static final long serialVersionUID = 1L;
private boolean recursive = false;
private List<PGWithQuery> withQuery = new ArrayList<PGWithQuery>(2);
public boolean isRecursive() {
return recursive;
}
private boolean recursive = false;
private List<PGWithQuery> withQuery = new ArrayList<PGWithQuery>(2);
public void setRecursive(boolean recursive) {
this.recursive = recursive;
}
public boolean isRecursive() {
return recursive;
}
public List<PGWithQuery> getWithQuery() {
return withQuery;
}
public void setRecursive(boolean recursive) {
this.recursive = recursive;
}
public void setWithQuery(List<PGWithQuery> withQuery) {
this.withQuery = withQuery;
}
public List<PGWithQuery> getWithQuery() {
return withQuery;
}
@Override
public void accept0(PGASTVisitor visitor) {
if (visitor.visit(this)) {
acceptChild(visitor, withQuery);
}
visitor.endVisit(this);
}
public void setWithQuery(List<PGWithQuery> withQuery) {
this.withQuery = withQuery;
}
@Override
public void accept0(PGASTVisitor visitor) {
if (visitor.visit(this)) {
acceptChild(visitor, withQuery);
}
visitor.endVisit(this);
}
}
@@ -24,9 +24,8 @@ import com.alibaba.druid.sql.dialect.postgresql.visitor.PGASTVisitor;
public class PGWithQuery extends PGSQLObjectImpl {
private static final long serialVersionUID = 1L;
private SQLExpr name;
private final List<SQLExpr> columns = new ArrayList<SQLExpr>();
private final List<SQLExpr> columns = new ArrayList<SQLExpr>();
private SQLStatement query;
public SQLExpr getName() {
@@ -22,10 +22,8 @@ import com.alibaba.druid.sql.dialect.postgresql.visitor.PGASTVisitor;
public class PGParameter extends PGSQLObjectImpl {
private static final long serialVersionUID = 1L;
private SQLExpr name;
private SQLDataType dataType;
private SQLExpr name;
private SQLDataType dataType;
public SQLExpr getName() {
return name;
@@ -26,12 +26,11 @@ import com.alibaba.druid.sql.visitor.SQLASTVisitor;
public class PGDeleteStatement extends SQLDeleteStatement implements PGSQLStatement {
private static final long serialVersionUID = 1L;
private PGWithClause with;
private boolean only = false;
private List<SQLName> using = new ArrayList<SQLName>(2);
private boolean returning;
private String alias;
private PGWithClause with;
private boolean only = false;
private List<SQLName> using = new ArrayList<SQLName>(2);
private boolean returning;
private String alias;
public boolean isReturning() {
return returning;
@@ -27,9 +27,7 @@ import com.alibaba.druid.sql.visitor.SQLASTVisitor;
public class PGFunctionTableSource extends SQLExprTableSource implements PGSQLObject {
private static final long serialVersionUID = 1L;
private final List<PGParameter> parameters = new ArrayList<PGParameter>();
private final List<PGParameter> parameters = new ArrayList<PGParameter>();
public PGFunctionTableSource(){
@@ -26,10 +26,8 @@ import com.alibaba.druid.sql.visitor.SQLASTVisitor;
public class PGInsertStatement extends SQLInsertStatement implements PGSQLStatement {
private static final long serialVersionUID = 1L;
private PGWithClause with;
private List<ValuesClause> valuesList = new ArrayList<ValuesClause>();
private List<ValuesClause> valuesList = new ArrayList<ValuesClause>();
private SQLExpr returning;
public SQLExpr getReturning() {
@@ -66,7 +64,7 @@ public class PGInsertStatement extends SQLInsertStatement implements PGSQLStatem
public List<ValuesClause> getValuesList() {
return valuesList;
}
public void addValueCause(ValuesClause valueClause) {
valueClause.setParent(this);
valuesList.add(valueClause);
@@ -28,18 +28,16 @@ import com.alibaba.druid.sql.visitor.SQLASTVisitor;
public class PGSelectQueryBlock extends SQLSelectQueryBlock {
private static final long serialVersionUID = 1L;
private PGWithClause with;
private List<SQLExpr> distinctOn = new ArrayList<SQLExpr>(2);
private SQLExpr limit;
private SQLExpr offset;
private WindowClause window;
private PGWithClause with;
private List<SQLExpr> distinctOn = new ArrayList<SQLExpr>(2);
private SQLExpr limit;
private SQLExpr offset;
private WindowClause window;
private SQLOrderBy orderBy;
private FetchClause fetch;
private ForClause forClause;
private IntoOption intoOption;
private SQLOrderBy orderBy;
private FetchClause fetch;
private ForClause forClause;
private IntoOption intoOption;
public static enum IntoOption {
TEMPORARY, TEMP, UNLOGGED
@@ -143,9 +141,8 @@ public class PGSelectQueryBlock extends SQLSelectQueryBlock {
public static class WindowClause extends PGSQLObjectImpl {
private static final long serialVersionUID = 1L;
private SQLExpr name;
private List<SQLExpr> definition = new ArrayList<SQLExpr>(2);
private SQLExpr name;
private List<SQLExpr> definition = new ArrayList<SQLExpr>(2);
public SQLExpr getName() {
return name;
@@ -175,8 +172,6 @@ public class PGSelectQueryBlock extends SQLSelectQueryBlock {
public static class FetchClause extends PGSQLObjectImpl {
private static final long serialVersionUID = 1L;
public static enum Option {
FIRST, NEXT
}
@@ -212,8 +207,6 @@ public class PGSelectQueryBlock extends SQLSelectQueryBlock {
public static class ForClause extends PGSQLObjectImpl {
private static final long serialVersionUID = 1L;
public static enum Option {
UPDATE, SHARE
}
@@ -23,8 +23,7 @@ import com.alibaba.druid.sql.visitor.SQLASTVisitor;
public class PGSelectStatement extends SQLSelectStatement implements PGSQLStatement {
private static final long serialVersionUID = 1L;
private PGWithClause with;
private PGWithClause with;
public PGSelectStatement(){
}
@@ -18,13 +18,11 @@ package com.alibaba.druid.sql.dialect.postgresql.ast.stmt;
import com.alibaba.druid.sql.ast.statement.SQLTruncateStatement;
import com.alibaba.druid.sql.dialect.postgresql.visitor.PGASTVisitor;
public class PGTruncateStatement extends SQLTruncateStatement implements PGSQLStatement{
public class PGTruncateStatement extends SQLTruncateStatement implements PGSQLStatement {
private static final long serialVersionUID = 1L;
private boolean only;
private Boolean restartIdentity;
private Boolean cascade;
private boolean only;
private Boolean restartIdentity;
private Boolean cascade;
public boolean isOnly() {
return only;
@@ -27,15 +27,13 @@ import com.alibaba.druid.sql.visitor.SQLASTVisitor;
public class PGUpdateStatement extends SQLUpdateStatement implements PGSQLStatement {
private static final long serialVersionUID = 1L;
private boolean only = false;
private boolean only = false;
private PGWithClause with;
private PGWithClause with;
private List<SQLExpr> returning = new ArrayList<SQLExpr>(2);
private List<SQLExpr> returning = new ArrayList<SQLExpr>(2);
private SQLTableSource from;
private SQLTableSource from;
public SQLTableSource getFrom() {
return from;