Search in sources :

Example 1 with AsOfFlashbackQueryClause

use of com.alibaba.druid.sql.dialect.oracle.ast.clause.FlashbackQueryClause.AsOfFlashbackQueryClause in project druid by alibaba.

the class OracleSelectParser method flashback.

private FlashbackQueryClause flashback() {
    if (lexer.token() == Token.AS) {
        lexer.nextToken();
    }
    if (lexer.token() == Token.OF) {
        lexer.nextToken();
        if (identifierEquals("SCN")) {
            AsOfFlashbackQueryClause clause = new AsOfFlashbackQueryClause();
            clause.setType(AsOfFlashbackQueryClause.Type.SCN);
            lexer.nextToken();
            clause.setExpr(exprParser.expr());
            return clause;
        } else if (identifierEquals("SNAPSHOT")) {
            lexer.nextToken();
            accept(Token.LPAREN);
            AsOfSnapshotClause clause = new AsOfSnapshotClause();
            clause.setExpr(this.expr());
            accept(Token.RPAREN);
            return clause;
        } else {
            AsOfFlashbackQueryClause clause = new AsOfFlashbackQueryClause();
            acceptIdentifier("TIMESTAMP");
            clause.setType(AsOfFlashbackQueryClause.Type.TIMESTAMP);
            clause.setExpr(exprParser.expr());
            return clause;
        }
    }
    return null;
}
Also used : AsOfFlashbackQueryClause(com.alibaba.druid.sql.dialect.oracle.ast.clause.FlashbackQueryClause.AsOfFlashbackQueryClause) AsOfSnapshotClause(com.alibaba.druid.sql.dialect.oracle.ast.clause.FlashbackQueryClause.AsOfSnapshotClause)

Aggregations

AsOfFlashbackQueryClause (com.alibaba.druid.sql.dialect.oracle.ast.clause.FlashbackQueryClause.AsOfFlashbackQueryClause)1 AsOfSnapshotClause (com.alibaba.druid.sql.dialect.oracle.ast.clause.FlashbackQueryClause.AsOfSnapshotClause)1