Package org.h2.mode

Class ModeFunction

    • Field Detail

      • VAR_ARGS

        protected static final int VAR_ARGS
        Constant for variable number of arguments.
        See Also:
        Constant Field Values
      • info

        protected final FunctionInfo info
        The information about this function.
    • Constructor Detail

      • ModeFunction

        ModeFunction​(FunctionInfo info)
        Creates a new instance of function.
        Parameters:
        info - function information
    • Method Detail

      • getFunction

        public static ModeFunction getFunction​(Database database,
                                               java.lang.String name)
        Get an instance of the given function for this database. If no function with this name is found, null is returned.
        Parameters:
        database - the database
        name - the upper case function name
        Returns:
        the function object or null
      • getCompatibilityModeFunction

        private static ModeFunction getCompatibilityModeFunction​(java.lang.String name,
                                                                 Mode.ModeEnum modeEnum)
      • getNullOrValue

        static Value getNullOrValue​(SessionLocal session,
                                    Expression[] args,
                                    Value[] values,
                                    int i)
        Get value transformed by expression, or null if i is out of range or the input value is null.
        Parameters:
        session - database session
        args - expressions
        values - array of input values
        i - index of value of transform
        Returns:
        value or null
      • getArgumentsValues

        final Value[] getArgumentsValues​(SessionLocal session,
                                         Expression[] args)
        Gets values of arguments and checks them for NULL values if function returns NULL on NULL argument.
        Parameters:
        session - the session
        args - the arguments
        Returns:
        the values, or null if function should return NULL due to NULL argument
      • checkParameterCount

        void checkParameterCount​(int len)
        Check if the parameter count is correct.
        Parameters:
        len - the number of parameters set
        Throws:
        DbException - if the parameter count is incorrect
      • optimizeArguments

        final boolean optimizeArguments​(SessionLocal session)
        Optimizes arguments.
        Parameters:
        session - the session
        Returns:
        whether all arguments are constants and function is deterministic
      • getName

        public java.lang.String getName()
        Description copied from interface: NamedExpression
        Get the name.
        Returns:
        the name in uppercase
      • isEverything

        public boolean isEverything​(ExpressionVisitor visitor)
        Description copied from class: Expression
        Check if this expression and all sub-expressions can fulfill a criteria. If any part returns false, the result is false.
        Overrides:
        isEverything in class OperationN
        Parameters:
        visitor - the visitor
        Returns:
        if the criteria can be fulfilled