Class IntervalOperation

  • All Implemented Interfaces:
    HasSQL, Typed

    public class IntervalOperation
    extends Operation2
    A mathematical operation with intervals.
    • Field Detail

      • INTERVAL_YEAR_DIGITS

        private static final int INTERVAL_YEAR_DIGITS
        Number of digits enough to hold INTERVAL '999999999999999999' YEAR / INTERVAL '1' MONTH.
        See Also:
        Constant Field Values
      • INTERVAL_DAY_DIGITS

        private static final int INTERVAL_DAY_DIGITS
        Number of digits enough to hold INTERVAL '999999999999999999' DAY / INTERVAL '0.000000001' SECOND.
        See Also:
        Constant Field Values
      • INTERVAL_DIVIDE_INTERVAL_YEAR_TYPE

        private static final TypeInfo INTERVAL_DIVIDE_INTERVAL_YEAR_TYPE
      • INTERVAL_DIVIDE_INTERVAL_DAY_TYPE

        private static final TypeInfo INTERVAL_DIVIDE_INTERVAL_DAY_TYPE
      • forcedType

        private TypeInfo forcedType
    • Method Detail

      • nanosFromValue

        private static java.math.BigInteger nanosFromValue​(SessionLocal session,
                                                           Value v)
      • needParentheses

        public boolean needParentheses()
        Description copied from class: Expression
        Returns whether this expressions needs to be wrapped in parentheses when it is used as an argument of other expressions.
        Overrides:
        needParentheses in class Expression
        Returns:
        true if it is
      • getUnenclosedSQL

        public java.lang.StringBuilder getUnenclosedSQL​(java.lang.StringBuilder builder,
                                                        int sqlFlags)
        Description copied from class: Expression
        Get the SQL statement of this expression. This may not always be the original SQL statement, especially after optimization. Enclosing '(' and ')' are never appended.
        Specified by:
        getUnenclosedSQL in class Expression
        Parameters:
        builder - string builder
        sqlFlags - formatting flags
        Returns:
        the specified string builder
      • getInnerSQL2

        private void getInnerSQL2​(java.lang.StringBuilder builder,
                                  int sqlFlags)
      • getForcedTypeSQL

        static java.lang.StringBuilder getForcedTypeSQL​(java.lang.StringBuilder builder,
                                                        TypeInfo forcedType)
      • getOperationToken

        private char getOperationToken()
      • getValue

        public Value getValue​(SessionLocal session)
        Description copied from class: Expression
        Return the resulting value for the current row.
        Specified by:
        getValue in class Expression
        Parameters:
        session - the session
        Returns:
        the result
      • getDateTimeWithInterval

        private Value getDateTimeWithInterval​(SessionLocal session,
                                              Value l,
                                              Value r,
                                              int lType,
                                              int rType)
      • getTimeWithInterval

        private long getTimeWithInterval​(Value r,
                                         long nanos)
      • optimize

        public Expression optimize​(SessionLocal session)
        Description copied from class: Expression
        Try to optimize the expression.
        Specified by:
        optimize in class Expression
        Parameters:
        session - the session
        Returns:
        the optimized expression