Class ModeFunction
java.lang.Object
org.h2.expression.Expression
org.h2.expression.OperationN
org.h2.expression.function.FunctionN
org.h2.mode.ModeFunction
- All Implemented Interfaces:
ExpressionWithVariableParameters, NamedExpression, HasSQL, Typed
- Direct Known Subclasses:
FunctionsDB2Derby, FunctionsLegacy, FunctionsMSSQLServer, FunctionsMySQL, FunctionsOracle, FunctionsPostgreSQL
Base class for mode-specific functions.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final FunctionInfoThe information about this function.protected static final intConstant for variable number of arguments.Fields inherited from class OperationN
args, argsCount, typeFields inherited from class Expression
AUTO_PARENTHESES, MAP_IN_AGGREGATE, MAP_IN_WINDOW, MAP_INITIAL, WITH_PARENTHESES, WITHOUT_PARENTHESESFields inherited from interface HasSQL
ADD_PLAN_INFORMATION, DEFAULT_SQL_FLAGS, NO_CASTS, QUOTE_ONLY_WHEN_REQUIRED, REPLACE_LOBS_FOR_TRACE, TRACE_SQL_FLAGS -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) voidcheckParameterCount(int len) Check if the parameter count is correct.voidThis method must be called after all the parameters have been set.(package private) final Value[]getArgumentsValues(SessionLocal session, Expression[] args) Gets values of arguments and checks them for NULL values if function returns NULL on NULL argument.private static ModeFunctiongetCompatibilityModeFunction(String name, Mode.ModeEnum modeEnum) static ModeFunctiongetFunction(Database database, String name) Get an instance of the given function for this database.getName()Get the name.(package private) static ValuegetNullOrValue(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.booleanisEverything(ExpressionVisitor visitor) Check if this expression and all sub-expressions can fulfill a criteria.(package private) final booleanoptimizeArguments(SessionLocal session) Optimizes arguments.Methods inherited from class FunctionN
getUnenclosedSQL, getValue, getValueMethods inherited from class OperationN
addParameter, getCost, getSubexpression, getSubexpressionCount, getType, mapColumns, optimizeArguments, setEvaluatable, updateAggregateMethods inherited from class Expression
addFilterConditions, createIndexConditions, getAlias, getBooleanValue, getColumnName, getColumnNameForView, getEnclosedSQL, getNonAliasExpression, getNotIfPossible, getNullable, getSchemaName, getSQL, getSQL, getSQL, getSQL, getTableAlias, getTableName, getWhenSQL, getWhenValue, isConstant, isIdentity, isNullConstant, isValueSet, isWhenConditionOperand, needParentheses, optimize, optimizeCondition, toString, writeExpressions, writeExpressionsMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface HasSQL
getTraceSQL
-
Field Details
-
VAR_ARGS
protected static final int VAR_ARGSConstant for variable number of arguments.- See Also:
-
info
The information about this function.
-
-
Constructor Details
-
ModeFunction
ModeFunction(FunctionInfo info) Creates a new instance of function.- Parameters:
info- function information
-
-
Method Details
-
getFunction
Get an instance of the given function for this database. If no function with this name is found, null is returned.- Parameters:
database- the databasename- the upper case function name- Returns:
- the function object or null
-
getCompatibilityModeFunction
-
getNullOrValue
Get value transformed by expression, or null if i is out of range or the input value is null.- Parameters:
session- database sessionargs- expressionsvalues- array of input valuesi- index of value of transform- Returns:
- value or null
-
getArgumentsValues
Gets values of arguments and checks them for NULL values if function returns NULL on NULL argument.- Parameters:
session- the sessionargs- the arguments- Returns:
- the values, or
nullif 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
-
doneWithParameters
public void doneWithParameters()Description copied from interface:ExpressionWithVariableParametersThis method must be called after all the parameters have been set. It checks if the parameter count is correct when required by the implementation.- Specified by:
doneWithParametersin interfaceExpressionWithVariableParameters- Overrides:
doneWithParametersin classOperationN
-
optimizeArguments
Optimizes arguments.- Parameters:
session- the session- Returns:
- whether all arguments are constants and function is deterministic
-
getName
-
isEverything
Description copied from class:ExpressionCheck if this expression and all sub-expressions can fulfill a criteria. If any part returns false, the result is false.- Overrides:
isEverythingin classOperationN- Parameters:
visitor- the visitor- Returns:
- if the criteria can be fulfilled
-