Top Description Fields Constructors Methods
org.h2.mode

public abstract Class ModeFunction

extends FunctionN
Class Inheritance
Known Direct Subclasses
org.h2.mode.FunctionsDB2Derby, org.h2.mode.FunctionsLegacy, org.h2.mode.FunctionsMSSQLServer, org.h2.mode.FunctionsMySQL, org.h2.mode.FunctionsOracle, org.h2.mode.FunctionsPostgreSQL
Imports
org.h2.api.ErrorCode, org.h2.engine.Database, .Mode.ModeEnum, .SessionLocal, org.h2.expression.Expression, .ExpressionVisitor, org.h2.expression.function.CurrentDateTimeValueFunction, .FunctionN, org.h2.message.DbException, org.h2.value.Value, .ValueNull

Base class for mode-specific functions.

Field Summary

Modifier and TypeField and Description
protected final FunctionInfo
info

The information about this function.

protected static final int
VAR_ARGS

Constant for variable number of arguments.

Constructor Summary

AccessConstructor and Description
pack-priv
ModeFunction(FunctionInfo
function information
info
)

Creates a new instance of function.

Method Summary

Modifier and TypeMethod and Description
pack-priv void
checkParameterCount(int
the number of parameters set
len
)

Check if the parameter count is correct.

public void
doneWithParameters()

Overrides org.h2.expression.OperationN.doneWithParameters.

Implements org.h2.expression.ExpressionWithVariableParameters.doneWithParameters.

This method must be called after all the parameters have been set.

pack-priv final Value[]

Returns:

the values, or null if function should return NULL due to NULL argument
getArgumentsValues
(SessionLocal
the session
session
,
Expression[]
the arguments
args
)

Gets values of arguments and checks them for NULL values if function returns NULL on NULL argument.

public static Expression

Returns:

the function object or null
getCompatibilityDateTimeValueFunction
(Database
the database
database
,
String
the upper case function name
name
,
int
the scale, or -1
scale
)

Get an instance of the given function without parentheses for this database.

private static ModeFunction
public static ModeFunction

Returns:

the function object or null
getFunction
(Database
the database
database
,
String
the upper case function name
name
)

Get an instance of the given function for this database.

public String
pack-priv static Value

Returns:

value or null
getNullOrValue
(SessionLocal
database session
session
,
Expression[]
expressions
args
,
Value[]
array of input values
values
,
int
index of value of transform
i
)

Get value transformed by expression, or null if i is out of range or the input value is null.

public boolean
isEverything(ExpressionVisitor
the visitor
visitor
)

Overrides org.h2.expression.OperationN.isEverything.

Check if this expression and all sub-expressions can fulfill a criteria.

pack-priv final boolean

Returns:

whether all arguments are constants and function is deterministic
optimizeArguments
(SessionLocal
the session
session
)

Optimizes arguments.

Inherited from org.h2.expression.function.FunctionN:
getUnenclosedSQLgetValuegetValue

Field Detail

infoback to summary
protected final FunctionInfo info

The information about this function.

VAR_ARGSback to summary
protected static final int VAR_ARGS

Constant for variable number of arguments.

Constructor Detail

ModeFunctionback to summary
pack-priv ModeFunction(FunctionInfo info)

Creates a new instance of function.

Parameters
info:FunctionInfo

function information

Method Detail

checkParameterCountback to summary
pack-priv void checkParameterCount(int len)

Check if the parameter count is correct.

Parameters
len:int

the number of parameters set

Exceptions
DbException:
if the parameter count is incorrect
doneWithParametersback to summary
public void doneWithParameters()

Overrides org.h2.expression.OperationN.doneWithParameters.

Implements org.h2.expression.ExpressionWithVariableParameters.doneWithParameters.

Doc from org.h2.expression.ExpressionWithVariableParameters.doneWithParameters.

This method must be called after all the parameters have been set. It checks if the parameter count is correct when required by the implementation.

Annotations
@Override
getArgumentsValuesback to summary
pack-priv 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:SessionLocal

the session

args:Expression[]

the arguments

Returns:Value[]

the values, or null if function should return NULL due to NULL argument

getCompatibilityDateTimeValueFunctionback to summary
public static Expression getCompatibilityDateTimeValueFunction(Database database, String name, int scale)

Get an instance of the given function without parentheses for this database. If no function with this name is found, null is returned.

Parameters
database:Database

the database

name:String

the upper case function name

scale:int

the scale, or -1

Returns:Expression

the function object or null

Annotations
@SuppressWarnings:incomplete-switch
getCompatibilityModeFunctionback to summary
private static ModeFunction getCompatibilityModeFunction(String name, Mode.ModeEnum modeEnum)
getFunctionback to summary
public static ModeFunction getFunction(Database database, 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:Database

the database

name:String

the upper case function name

Returns:ModeFunction

the function object or null

getNameback to summary
public String getName()

Implements org.h2.expression.function.NamedExpression.getName.

Doc from org.h2.expression.function.NamedExpression.getName.

Get the name.

Returns:String

the name in uppercase

Annotations
@Override
getNullOrValueback to summary
pack-priv 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:SessionLocal

database session

args:Expression[]

expressions

values:Value[]

array of input values

i:int

index of value of transform

Returns:Value

value or null

isEverythingback to summary
public boolean isEverything(ExpressionVisitor visitor)

Overrides org.h2.expression.OperationN.isEverything.

Doc from org.h2.expression.Expression.isEverything.

Check if this expression and all sub-expressions can fulfill a criteria. If any part returns false, the result is false.

Parameters
visitor:ExpressionVisitor

the visitor

Returns:boolean

if the criteria can be fulfilled

Annotations
@Override
optimizeArgumentsback to summary
pack-priv final boolean optimizeArguments(SessionLocal session)

Optimizes arguments.

Parameters
session:SessionLocal

the session

Returns:boolean

whether all arguments are constants and function is deterministic