sql parser refactor

This commit is contained in:
温少
2012-05-20 14:10:35 +08:00
15 changed files with 46 additions and 66 deletions
@@ -26,16 +26,15 @@ import com.alibaba.druid.sql.parser.Token;
public class PGSQLStatementParser extends SQLStatementParser {
public PGSQLStatementParser(String sql) throws ParserException{
this(new PGLexer(sql));
this.lexer.nextToken();
super (new PGExprParser(sql));
}
public PGSQLStatementParser(Lexer lexer){
super(lexer);
super(new PGExprParser(lexer));
}
public PGSelectParser createSQLSelectParser() {
return new PGSelectParser(this.lexer);
return new PGSelectParser(this.exprParser);
}
public SQLUpdateStatement parseUpdateStatement() throws ParserException {
@@ -7,7 +7,6 @@ import com.alibaba.druid.sql.ast.statement.SQLExprTableSource;
import com.alibaba.druid.sql.ast.statement.SQLSelectQuery;
import com.alibaba.druid.sql.dialect.postgresql.ast.stmt.PGSelectQueryBlock;
import com.alibaba.druid.sql.dialect.postgresql.ast.stmt.PGSelectQueryBlock.IntoOption;
import com.alibaba.druid.sql.parser.Lexer;
import com.alibaba.druid.sql.parser.ParserException;
import com.alibaba.druid.sql.parser.SQLExprParser;
import com.alibaba.druid.sql.parser.SQLSelectParser;
@@ -15,13 +14,12 @@ import com.alibaba.druid.sql.parser.Token;
public class PGSelectParser extends SQLSelectParser {
public PGSelectParser(Lexer lexer){
super(lexer);
public PGSelectParser(SQLExprParser exprParser){
super(exprParser);
}
public PGSelectParser(String sql) throws ParserException{
this(new PGLexer(sql));
this.lexer.nextToken();
this(new PGExprParser(sql));
}
protected SQLExprParser createExprParser() {