mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
enhance SchemaStatVisitor
This commit is contained in:
+9
-1
@@ -1,5 +1,6 @@
|
||||
package com.alibaba.druid.sql.dialect.postgresql.ast.stmt;
|
||||
|
||||
import com.alibaba.druid.sql.ast.statement.SQLSelect;
|
||||
import com.alibaba.druid.sql.ast.statement.SQLSelectStatement;
|
||||
import com.alibaba.druid.sql.dialect.postgresql.ast.PGWithClause;
|
||||
import com.alibaba.druid.sql.dialect.postgresql.visitor.PGASTVisitor;
|
||||
@@ -10,6 +11,13 @@ public class PGSelectStatement extends SQLSelectStatement implements PGSQLStatem
|
||||
private static final long serialVersionUID = 1L;
|
||||
private PGWithClause with;
|
||||
|
||||
public PGSelectStatement(){
|
||||
}
|
||||
|
||||
public PGSelectStatement(SQLSelect select){
|
||||
super(select);
|
||||
}
|
||||
|
||||
public PGWithClause getWith() {
|
||||
return with;
|
||||
}
|
||||
@@ -17,7 +25,7 @@ public class PGSelectStatement extends SQLSelectStatement implements PGSQLStatem
|
||||
public void setWith(PGWithClause with) {
|
||||
this.with = with;
|
||||
}
|
||||
|
||||
|
||||
protected void accept0(SQLASTVisitor visitor) {
|
||||
accept0((PGASTVisitor) visitor);
|
||||
}
|
||||
|
||||
+11
-1
@@ -15,6 +15,7 @@ import com.alibaba.druid.sql.dialect.postgresql.ast.PGWithClause;
|
||||
import com.alibaba.druid.sql.dialect.postgresql.ast.PGWithQuery;
|
||||
import com.alibaba.druid.sql.dialect.postgresql.ast.stmt.PGDeleteStatement;
|
||||
import com.alibaba.druid.sql.dialect.postgresql.ast.stmt.PGInsertStatement;
|
||||
import com.alibaba.druid.sql.dialect.postgresql.ast.stmt.PGSelectStatement;
|
||||
import com.alibaba.druid.sql.dialect.postgresql.ast.stmt.PGTruncateStatement;
|
||||
import com.alibaba.druid.sql.dialect.postgresql.ast.stmt.PGUpdateStatement;
|
||||
import com.alibaba.druid.sql.parser.Lexer;
|
||||
@@ -311,6 +312,10 @@ public class PGSQLStatementParser extends SQLStatementParser {
|
||||
return withQuery;
|
||||
}
|
||||
|
||||
public PGSelectStatement parseSelect() throws ParserException {
|
||||
return new PGSelectStatement(createSQLSelectParser().select());
|
||||
}
|
||||
|
||||
public SQLStatement parseWith() {
|
||||
PGWithClause with = this.parseWithClause();
|
||||
if (lexer.token() == Token.INSERT) {
|
||||
@@ -318,7 +323,12 @@ public class PGSQLStatementParser extends SQLStatementParser {
|
||||
stmt.setWith(with);
|
||||
return stmt;
|
||||
}
|
||||
|
||||
|
||||
if (lexer.token() == Token.SELECT) {
|
||||
PGSelectStatement stmt = this.parseSelect();
|
||||
stmt.setWith(with);
|
||||
return stmt;
|
||||
}
|
||||
throw new ParserException("TODO");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user