Class AsOfClause

  • All Implemented Interfaces:
    Expression

    public final class AsOfClause
    extends AbstractExpression
    An AS OF clause is part of a flashback query, which provides ways to view past states of database objects, or to return database objects to a previous state, without using traditional point-in-time recovery.

    Specify AS OF to retrieve the single version of the rows returned by the query at a particular change number (SCN) or timestamp. If you specify SCN, then the expression must evaluate to a number. If you specify TIMESTAMP, then the expression must evaluate to a timestamp value. Oracle Database returns rows as they existed at the specified system change number or time.

    BNF: asof_clause ::= AS OF { SCN | TIMESTAMP } scalar_expression

    Version:
    2.5
    Author:
    Pascal Filion
    Since:
    2.5
    • Constructor Detail

      • AsOfClause

        public AsOfClause​(AbstractExpression parent)
        Creates a new AsOfClause.
        Parameters:
        parent - The parent of this expression
    • Method Detail

      • getActualIdentifier

        public java.lang.String getActualIdentifier()
        Returns the actual AS OF identifier found in the string representation of the JPQL query, which has the actual case that was used.
        Returns:
        The AS OF identifier that was actually parsed
      • getActualScnIdentifier

        public java.lang.String getActualScnIdentifier()
        Returns the actual SCN identifier found in the string representation of the JPQL query, which has the actual case that was used.
        Returns:
        The SCN identifier that was actually parsed, or an empty string if it was not parsed
      • getActualTimestampIdentifier

        public java.lang.String getActualTimestampIdentifier()
        Returns the actual TIMESTAMP identifier found in the string representation of the JPQL query, which has the actual case that was used.
        Returns:
        The TIMESTAMP identifier that was actually parsed, or an empty string if it was not parsed
      • getExpression

        public Expression getExpression()
        Returns the Expression representing the timestamp or change number.
        Returns:
        The Expression that was parsed representing the timestamp or change number
      • hasExpression

        public boolean hasExpression()
        Determines whether the Expression representing the timestamp or change number was parsed or not.
        Returns:
        true if the timestamp or change number was parsed; false otherwise
      • hasScn

        public boolean hasScn()
        Determines whether the identifier SCN was part of the query.
        Returns:
        true if the identifier SCN was parsed; false otherwise
      • hasSpaceAfterCategory

        public boolean hasSpaceAfterCategory()
        Determines whether a whitespace was found after either SCN or TIMESTAMP.
        Returns:
        true if there was a whitespace after SCN or TIMESTAMP; false otherwise
      • hasSpaceAfterIdentifier

        public boolean hasSpaceAfterIdentifier()
        Determines whether a whitespace was found after AS OF.
        Returns:
        true if there was a whitespace after AS OF; false otherwise
      • hasTimestamp

        public boolean hasTimestamp()
        Determines whether the identifier TIMESTAMP was part of the query.
        Returns:
        true if the identifier TIMESTAMP was parsed; false otherwise
      • parse

        protected void parse​(WordParser wordParser,
                             boolean tolerant)
        Parses the query by starting at the current position, which is part of the given WordParser.
        Specified by:
        parse in class AbstractExpression
        Parameters:
        wordParser - The text to parse based on the current position of the cursor
        tolerant - Determines whether the parsing system should be tolerant, meaning if it should try to parse invalid or incomplete queries
      • toParsedText

        protected void toParsedText​(java.lang.StringBuilder writer,
                                    boolean actual)
        Generates a string representation of this Expression, including its children, if it has any.
        Specified by:
        toParsedText in class AbstractExpression
        Parameters:
        writer - The buffer used to append this Expression's string representation
        actual - Determines whether the string representation should represent what was parsed, i.e. include any "virtual" whitespace (such as ending whitespace) and the actual case of the JPQL identifiers