use of com.alibaba.druid.sql.dialect.postgresql.ast.PGWithClause in project druid by alibaba.
the class PGSQLStatementParser method parseWith.
public SQLStatement parseWith() {
PGWithClause with = this.parseWithClause();
if (lexer.token() == Token.INSERT) {
PGInsertStatement stmt = this.parseInsert();
stmt.setWith(with);
return stmt;
}
if (lexer.token() == Token.SELECT) {
PGSelectStatement stmt = this.parseSelect();
stmt.setWith(with);
return stmt;
}
if (lexer.token() == Token.DELETE) {
PGDeleteStatement stmt = this.parseDeleteStatement();
stmt.setWith(with);
return stmt;
}
throw new ParserException("TODO");
}
use of com.alibaba.druid.sql.dialect.postgresql.ast.PGWithClause in project druid by alibaba.
the class PGSQLStatementParser method parseWithClause.
public PGWithClause parseWithClause() {
lexer.nextToken();
PGWithClause withClause = new PGWithClause();
if (lexer.token() == Token.RECURSIVE) {
lexer.nextToken();
withClause.setRecursive(true);
}
for (; ; ) {
PGWithQuery withQuery = withQuery();
withClause.getWithQuery().add(withQuery);
if (lexer.token() == Token.COMMA) {
lexer.nextToken();
continue;
} else {
break;
}
}
return withClause;
}
use of com.alibaba.druid.sql.dialect.postgresql.ast.PGWithClause in project druid by alibaba.
the class PGASTVisitorAdapterTest method test_adapter.
public void test_adapter() throws Exception {
PGASTVisitorAdapter adapter = new PGASTVisitorAdapter();
new WindowClause().accept(adapter);
new FetchClause().accept(adapter);
new ForClause().accept(adapter);
new PGWithQuery().accept(adapter);
new PGWithClause().accept(adapter);
new PGDeleteStatement().accept(adapter);
new PGFunctionTableSource().accept(adapter);
}
Aggregations