public class Function extends Expression implements FunctionCall, ExpressionWithFlags
| Modifier and Type | Field and Description |
|---|---|
static int |
ABS |
static int |
ACOS |
static int |
ADD_MONTHS |
protected Expression[] |
args |
static int |
ARRAY_APPEND |
static int |
ARRAY_CONCAT |
static int |
ARRAY_CONTAINS |
static int |
ARRAY_GET |
static int |
ARRAY_LENGTH |
static int |
ARRAY_SLICE |
static int |
ASCII |
static int |
ASIN |
static int |
ATAN |
static int |
ATAN2 |
static int |
AUTOCOMMIT |
static int |
BIT_LENGTH |
static int |
BITAND |
static int |
BITGET |
static int |
BITNOT |
static int |
BITOR |
static int |
BITXOR |
static int |
CANCEL_SESSION |
static int |
CASE |
static int |
CASEWHEN |
static int |
CAST |
static int |
CEILING |
static int |
CENTURY
Pseudo functions for DATEADD, DATEDIFF, and EXTRACT.
|
static int |
CHAR |
static int |
CHAR_LENGTH |
static int |
COALESCE |
static int |
COMPRESS |
static int |
CONCAT |
static int |
CONCAT_WS |
static int |
CONVERT |
static int |
COS |
static int |
COSH |
static int |
COT |
static int |
CSVREAD |
static int |
CSVWRITE |
static int |
CURRENT_CATALOG |
static int |
CURRENT_DATE |
static int |
CURRENT_SCHEMA |
static int |
CURRENT_TIME |
static int |
CURRENT_TIMESTAMP |
static int |
CURRENT_USER |
static int |
CURRVAL |
static int |
DATABASE_PATH |
static int |
DATE_TRUNC |
static int |
DATEADD |
static int |
DATEDIFF |
static int |
DAY_NAME |
static int |
DAY_OF_MONTH |
static int |
DAY_OF_WEEK |
static int |
DAY_OF_YEAR |
static int |
DECADE
Pseudo functions for DATEADD, DATEDIFF, and EXTRACT.
|
static int |
DECODE |
static int |
DECRYPT |
static int |
DEGREES |
static int |
DIFFERENCE |
static int |
DISK_SPACE_USED |
static int |
DOW
Pseudo functions for DATEADD, DATEDIFF, and EXTRACT.
|
static int |
ENCRYPT |
static int |
EPOCH
Pseudo functions for DATEADD, DATEDIFF, and EXTRACT.
|
static int |
ESTIMATED_ENVELOPE |
static int |
EXP |
static int |
EXPAND |
static int |
EXTRACT |
static int |
FILE_READ |
static int |
FILE_WRITE |
static int |
FLOOR |
static int |
FORMATDATETIME |
static int |
GREATEST |
static int |
H2VERSION
This is called H2VERSION() and not VERSION(), because we return a fake
value for VERSION() when running under the PostgreSQL ODBC driver.
|
static int |
HASH |
static int |
HEXTORAW |
static int |
HOUR |
static int |
IDENTITY |
static int |
IFNULL |
protected FunctionInfo |
info |
static int |
INSERT |
static int |
INSTR |
static int |
ISO_DAY_OF_WEEK |
static int |
ISO_WEEK |
static int |
ISO_YEAR |
static int |
JSON_ABSENT_ON_NULL
The ABSENT ON NULL flag for JSON_ARRAY and JSON_OBJECT functions.
|
static int |
JSON_ARRAY |
static int |
JSON_OBJECT |
static int |
JSON_WITH_UNIQUE_KEYS
The WITH UNIQUE KEYS flag for JSON_OBJECT function.
|
static int |
LCASE |
static int |
LEAST |
static int |
LEFT |
static int |
LENGTH |
static int |
LINK_SCHEMA |
static int |
LN |
static int |
LOCALTIME |
static int |
LOCALTIMESTAMP |
static int |
LOCATE |
static int |
LOCK_MODE |
static int |
LOCK_TIMEOUT |
static int |
LOG |
static int |
LOG10 |
static int |
LOWER |
static int |
LPAD |
static int |
LSHIFT |
static int |
LTRIM |
static int |
MEMORY_FREE |
static int |
MEMORY_USED |
static int |
MICROSECOND
Pseudo functions for DATEADD, DATEDIFF, and EXTRACT.
|
static int |
MILLENNIUM
Pseudo functions for DATEADD, DATEDIFF, and EXTRACT.
|
static int |
MILLISECOND
Pseudo functions for DATEADD, DATEDIFF, and EXTRACT.
|
static int |
MINUTE |
static int |
MOD |
static int |
MONTH |
static int |
MONTH_NAME |
static int |
NANOSECOND
Pseudo functions for DATEADD, DATEDIFF, and EXTRACT.
|
static int |
NEXTVAL |
static int |
NULLIF |
static int |
NVL2 |
static int |
OCTET_LENGTH |
static int |
ORA_HASH |
static int |
PARSEDATETIME |
static int |
PI |
static int |
POSITION |
static int |
POWER |
static int |
QUARTER |
static int |
QUOTE_IDENT |
static int |
RADIANS |
static int |
RAND |
static int |
RANDOM_UUID |
static int |
RAWTOHEX |
static int |
READONLY |
static int |
REGEXP_LIKE |
static int |
REGEXP_REPLACE |
static int |
REPEAT |
static int |
REPLACE |
static int |
RIGHT |
static int |
ROUND |
static int |
ROUNDMAGIC |
static int |
RPAD |
static int |
RSHIFT |
static int |
RTRIM |
static int |
SCOPE_IDENTITY |
static int |
SECOND |
static int |
SECURE_RAND |
static int |
SESSION_ID |
static int |
SET |
static int |
SIGN |
static int |
SIGNAL |
static int |
SIN |
static int |
SINH |
static int |
SOUNDEX |
static int |
SPACE |
static int |
SQRT |
static int |
STRINGDECODE |
static int |
STRINGENCODE |
static int |
STRINGTOUTF8 |
static int |
SUBSTRING |
static int |
TABLE |
static int |
TABLE_DISTINCT |
static int |
TAN |
static int |
TANH |
static int |
TIMEZONE_HOUR
Pseudo functions for DATEADD, DATEDIFF, and EXTRACT.
|
static int |
TIMEZONE_MINUTE
Pseudo functions for DATEADD, DATEDIFF, and EXTRACT.
|
static int |
TIMEZONE_SECOND
Pseudo functions for DATEADD, DATEDIFF, and EXTRACT.
|
static int |
TO_CHAR |
static int |
TO_DATE |
static int |
TO_TIMESTAMP |
static int |
TO_TIMESTAMP_TZ |
static int |
TRANSACTION_ID |
static int |
TRANSLATE |
static int |
TRIM |
static int |
TRIM_LEADING
The flag for TRIM(LEADING ...) function.
|
static int |
TRIM_TRAILING
The flag for TRIM(TRAILING ...) function.
|
static int |
TRUNCATE |
static int |
TRUNCATE_VALUE |
protected TypeInfo |
type |
static int |
UCASE |
static int |
UNNEST |
static int |
UPPER |
static int |
USER |
static int |
UTF8TOSTRING |
static int |
VALUES
Used in MySQL-style INSERT ...
|
protected static int |
VAR_ARGS |
static int |
WEEK |
static int |
XMLATTR |
static int |
XMLCDATA |
static int |
XMLCOMMENT |
static int |
XMLNODE |
static int |
XMLSTARTDOC |
static int |
XMLTEXT |
static int |
YEAR |
static int |
ZERO |
MAP_IN_AGGREGATE, MAP_IN_WINDOW, MAP_INITIAL| Constructor and Description |
|---|
Function(Database database,
FunctionInfo info)
Creates a new instance of function.
|
Function(Database database,
FunctionInfo info,
Expression[] arguments)
Creates a new instance of function.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addParameter(Expression param)
Adds the parameter expression.
|
protected void |
checkParameterCount(int len)
Check if the parameter count is correct.
|
void |
doneWithParameters()
This method is called after all the parameters have been set.
|
Expression[] |
getArgs()
Get the function arguments.
|
int |
getCost()
Estimate the cost to process the expression.
|
int |
getFlags()
Returns the flags.
|
static Function |
getFunction(Database database,
int id)
Get an instance of the given function for this database.
|
static Function |
getFunction(Database database,
java.lang.String name)
Get an instance of the given function for this database.
|
static FunctionInfo |
getFunctionInfo(java.lang.String upperName)
Returns function information for the specified function name.
|
int |
getFunctionType() |
static Function |
getFunctionWithArgs(Database database,
int id,
Expression... arguments)
Get an instance of the given function for this database.
|
static void |
getJsonFunctionFlagsSQL(java.lang.StringBuilder builder,
int flags,
boolean forArray)
Appends flags of a JSON function to the specified string builder.
|
java.lang.String |
getName()
Get the name of the function.
|
protected static Value |
getNullOrValue(Session 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.
|
java.lang.StringBuilder |
getSQL(java.lang.StringBuilder builder,
boolean alwaysQuote)
Appends the SQL statement of this expression to the specified builder.
|
Expression |
getSubexpression(int index)
Returns subexpression with specified index.
|
int |
getSubexpressionCount()
Returns count of subexpressions.
|
TypeInfo |
getType()
Returns the data type.
|
Value |
getValue(Session session)
Return the resulting value for the current row.
|
ValueResultSet |
getValueForColumnList(Session session,
Expression[] argList)
Get an empty result set with the column names set.
|
int |
getValueType()
Get the data type.
|
protected Value |
getValueWithArgs(Session session,
Expression[] args)
Return the resulting value for the given expression arguments.
|
boolean |
isDeterministic()
Whether the function always returns the same result for the same
parameters.
|
boolean |
isEverything(ExpressionVisitor visitor)
Check if this expression and all sub-expressions can fulfill a criteria.
|
static void |
jsonArrayAppend(java.io.ByteArrayOutputStream baos,
Value value,
int flags)
Appends a value to a JSON array in the specified string builder.
|
static void |
jsonObjectAppend(java.io.ByteArrayOutputStream baos,
java.lang.String key,
Value value)
Appends a value to a JSON object in the specified string builder.
|
static Value |
jsonObjectFinish(java.io.ByteArrayOutputStream baos,
int flags)
Appends trailing closing brace to the specified string builder with a
JSON object, validates it, and converts to a JSON value.
|
void |
mapColumns(ColumnResolver resolver,
int level,
int state)
Map the columns of the resolver to expression columns.
|
Expression |
optimize(Session session)
Try to optimize the expression.
|
void |
setDataType(TypeInfo type) |
void |
setEvaluatable(TableFilter tableFilter,
boolean b)
Tell the expression columns whether the table filter can return values
now.
|
void |
setFlags(int flags)
Set the flags for this expression.
|
void |
updateAggregate(Session session,
int stage)
Update an aggregate value.
|
addFilterConditions, createIndexConditions, getAlias, getBooleanValue, getColumnName, getExpressionColumns, getExpressionColumns, getExpressionColumns, getNonAliasExpression, getNotIfPossible, getNullable, getSchemaName, getSQL, getTableAlias, getTableName, getUnenclosedSQL, isAutoIncrement, isConstant, isNullConstant, isValueSet, toString, writeExpressions, writeExpressionsclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetSQLpublic static final int ABS
public static final int ACOS
public static final int ASIN
public static final int ATAN
public static final int ATAN2
public static final int BITAND
public static final int BITOR
public static final int BITXOR
public static final int CEILING
public static final int COS
public static final int COT
public static final int DEGREES
public static final int EXP
public static final int FLOOR
public static final int LOG
public static final int LOG10
public static final int MOD
public static final int PI
public static final int POWER
public static final int RADIANS
public static final int RAND
public static final int ROUND
public static final int ROUNDMAGIC
public static final int SIGN
public static final int SIN
public static final int SQRT
public static final int TAN
public static final int TRUNCATE
public static final int SECURE_RAND
public static final int HASH
public static final int ENCRYPT
public static final int DECRYPT
public static final int COMPRESS
public static final int EXPAND
public static final int ZERO
public static final int RANDOM_UUID
public static final int COSH
public static final int SINH
public static final int TANH
public static final int LN
public static final int BITGET
public static final int ORA_HASH
public static final int BITNOT
public static final int LSHIFT
public static final int RSHIFT
public static final int ASCII
public static final int BIT_LENGTH
public static final int CHAR
public static final int CHAR_LENGTH
public static final int CONCAT
public static final int DIFFERENCE
public static final int HEXTORAW
public static final int INSERT
public static final int INSTR
public static final int LCASE
public static final int LEFT
public static final int LENGTH
public static final int LOCATE
public static final int LTRIM
public static final int OCTET_LENGTH
public static final int RAWTOHEX
public static final int REPEAT
public static final int REPLACE
public static final int RIGHT
public static final int RTRIM
public static final int SOUNDEX
public static final int SPACE
public static final int SUBSTRING
public static final int UCASE
public static final int LOWER
public static final int UPPER
public static final int POSITION
public static final int TRIM
public static final int STRINGENCODE
public static final int STRINGDECODE
public static final int STRINGTOUTF8
public static final int UTF8TOSTRING
public static final int XMLATTR
public static final int XMLNODE
public static final int XMLCOMMENT
public static final int XMLCDATA
public static final int XMLSTARTDOC
public static final int XMLTEXT
public static final int REGEXP_REPLACE
public static final int RPAD
public static final int LPAD
public static final int CONCAT_WS
public static final int TO_CHAR
public static final int TRANSLATE
public static final int QUOTE_IDENT
public static final int TO_DATE
public static final int TO_TIMESTAMP
public static final int ADD_MONTHS
public static final int TO_TIMESTAMP_TZ
public static final int CURRENT_DATE
public static final int CURRENT_TIME
public static final int LOCALTIME
public static final int CURRENT_TIMESTAMP
public static final int LOCALTIMESTAMP
public static final int DATEADD
public static final int DATEDIFF
public static final int DAY_NAME
public static final int DAY_OF_MONTH
public static final int DAY_OF_WEEK
public static final int DAY_OF_YEAR
public static final int HOUR
public static final int MINUTE
public static final int MONTH
public static final int MONTH_NAME
public static final int QUARTER
public static final int SECOND
public static final int WEEK
public static final int YEAR
public static final int EXTRACT
public static final int FORMATDATETIME
public static final int PARSEDATETIME
public static final int ISO_YEAR
public static final int ISO_WEEK
public static final int ISO_DAY_OF_WEEK
public static final int DATE_TRUNC
public static final int MILLISECOND
public static final int EPOCH
public static final int MICROSECOND
public static final int NANOSECOND
public static final int TIMEZONE_HOUR
public static final int TIMEZONE_MINUTE
public static final int TIMEZONE_SECOND
public static final int DECADE
public static final int CENTURY
public static final int MILLENNIUM
public static final int DOW
public static final int CURRENT_CATALOG
public static final int USER
public static final int CURRENT_USER
public static final int IDENTITY
public static final int SCOPE_IDENTITY
public static final int AUTOCOMMIT
public static final int READONLY
public static final int DATABASE_PATH
public static final int LOCK_TIMEOUT
public static final int DISK_SPACE_USED
public static final int SIGNAL
public static final int ESTIMATED_ENVELOPE
public static final int IFNULL
public static final int CASEWHEN
public static final int CONVERT
public static final int CAST
public static final int COALESCE
public static final int NULLIF
public static final int CASE
public static final int NEXTVAL
public static final int CURRVAL
public static final int ARRAY_GET
public static final int CSVREAD
public static final int CSVWRITE
public static final int MEMORY_FREE
public static final int MEMORY_USED
public static final int LOCK_MODE
public static final int CURRENT_SCHEMA
public static final int SESSION_ID
public static final int ARRAY_LENGTH
public static final int LINK_SCHEMA
public static final int GREATEST
public static final int LEAST
public static final int CANCEL_SESSION
public static final int SET
public static final int TABLE
public static final int TABLE_DISTINCT
public static final int FILE_READ
public static final int TRANSACTION_ID
public static final int TRUNCATE_VALUE
public static final int NVL2
public static final int DECODE
public static final int ARRAY_CONTAINS
public static final int FILE_WRITE
public static final int UNNEST
public static final int ARRAY_CONCAT
public static final int ARRAY_APPEND
public static final int ARRAY_SLICE
public static final int REGEXP_LIKE
public static final int VALUES
public static final int JSON_OBJECT
public static final int JSON_ARRAY
public static final int H2VERSION
public static final int TRIM_LEADING
public static final int TRIM_TRAILING
public static final int JSON_ABSENT_ON_NULL
public static final int JSON_WITH_UNIQUE_KEYS
protected static final int VAR_ARGS
protected Expression[] args
protected final FunctionInfo info
protected TypeInfo type
public Function(Database database, FunctionInfo info)
database - databaseinfo - function informationpublic Function(Database database, FunctionInfo info, Expression[] arguments)
database - databaseinfo - function informationarguments - the argumentspublic static Function getFunction(Database database, int id)
database - the databaseid - the function numberpublic static Function getFunctionWithArgs(Database database, int id, Expression... arguments)
database - the databaseid - the function numberarguments - the argumentspublic static Function getFunction(Database database, java.lang.String name)
database - the databasename - the function namepublic static FunctionInfo getFunctionInfo(java.lang.String upperName)
upperName - the function name in upper casenullpublic void addParameter(Expression param)
param - the expressionpublic void setFlags(int flags)
ExpressionWithFlagssetFlags in interface ExpressionWithFlagsflags - the flags to setpublic int getFlags()
ExpressionWithFlagsgetFlags in interface ExpressionWithFlagspublic Value getValue(Session session)
ExpressiongetValue in class Expressionsession - the sessionprotected static Value getNullOrValue(Session session, Expression[] args, Value[] values, int i)
session - database sessionargs - expressionsvalues - array of input valuesi - index of value of transformprotected Value getValueWithArgs(Session session, Expression[] args)
session - the sessionargs - argument expressionspublic static void jsonObjectAppend(java.io.ByteArrayOutputStream baos,
java.lang.String key,
Value value)
baos - the output stream to append tokey - the name of the propertyvalue - the value of the propertypublic static Value jsonObjectFinish(java.io.ByteArrayOutputStream baos, int flags)
baos - the output stream with the objectflags - the flags (JSON_WITH_UNIQUE_KEYS)DbException - if JSON_WITH_UNIQUE_KEYS is specified and keys are
not uniquepublic static void jsonArrayAppend(java.io.ByteArrayOutputStream baos,
Value value,
int flags)
baos - the output stream to append tovalue - the valueflags - the flags (JSON_ABSENT_ON_NULL)public TypeInfo getType()
ExpressiongetType in class Expressionpublic int getValueType()
FunctionCallgetValueType in interface FunctionCallpublic void mapColumns(ColumnResolver resolver, int level, int state)
ExpressionmapColumns in class Expressionresolver - the column resolverlevel - the subquery nesting levelstate - current state for nesting checks, initial value is
Expression.MAP_INITIALprotected void checkParameterCount(int len)
len - the number of parameters setDbException - if the parameter count is incorrectpublic void doneWithParameters()
DbException - if the parameter count is incorrect.public void setDataType(TypeInfo type)
public Expression optimize(Session session)
Expressionoptimize in interface FunctionCalloptimize in class Expressionsession - the sessionpublic void setEvaluatable(TableFilter tableFilter, boolean b)
ExpressionsetEvaluatable in class ExpressiontableFilter - the table filterb - true if the table filter can return valuepublic java.lang.StringBuilder getSQL(java.lang.StringBuilder builder,
boolean alwaysQuote)
ExpressiongetSQL in class Expressionbuilder - string builderalwaysQuote - quote all identifierspublic static void getJsonFunctionFlagsSQL(java.lang.StringBuilder builder,
int flags,
boolean forArray)
builder - string builder to append toflags - flags to appendforArray - whether the function is an array functionpublic void updateAggregate(Session session, int stage)
ExpressionupdateAggregate in class Expressionsession - the sessionstage - select stagepublic int getFunctionType()
public java.lang.String getName()
FunctionCallgetName in interface FunctionCallpublic ValueResultSet getValueForColumnList(Session session, Expression[] argList)
FunctionCallgetValueForColumnList in interface FunctionCallsession - the sessionargList - the argument list (some arguments may be null)public Expression[] getArgs()
FunctionCallgetArgs in interface FunctionCallpublic boolean isEverything(ExpressionVisitor visitor)
ExpressionisEverything in class Expressionvisitor - the visitorpublic int getCost()
ExpressiongetCost in class Expressionpublic boolean isDeterministic()
FunctionCallisDeterministic in interface FunctionCallpublic int getSubexpressionCount()
ExpressiongetSubexpressionCount in class Expressionpublic Expression getSubexpression(int index)
ExpressiongetSubexpression in class Expressionindex - 0-based index