Class BinaryOperation

  • All Implemented Interfaces:
    HasSQL, Typed

    public class BinaryOperation
    extends Operation2
    A mathematical expression, or string concatenation.
    • Method Detail

      • setForcedType

        public void setForcedType​(TypeInfo forcedType)
        Sets a forced data type of a datetime minus datetime operation.
        Parameters:
        forcedType - the forced data type
      • 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
      • getOperationToken

        private java.lang.String 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
      • 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
      • optimizeNumeric

        private void optimizeNumeric​(TypeInfo leftType,
                                     TypeInfo rightType)
      • optimizeDecfloat

        private void optimizeDecfloat​(TypeInfo leftType,
                                      TypeInfo rightType)
      • optimizeInterval

        private Expression optimizeInterval​(int l,
                                            int r)
      • getUnsupported

        private DbException getUnsupported​(int l,
                                           int r)
      • getUnexpectedForcedTypeException

        private DbException getUnexpectedForcedTypeException()
      • swap

        private void swap()
      • getOperationType

        public BinaryOperation.OpType getOperationType()
        Returns the type of this binary operation.
        Returns:
        the type of this binary operation