Top Description Fields Constructors Methods
org.h2.expression.function

public final Class JsonConstructorFunction

extends OperationN
implements ExpressionWithFlags, NamedExpression
Class Inheritance
All Implemented Interfaces
org.h2.expression.function.NamedExpression, org.h2.expression.ExpressionWithFlags
Imports
java.io.ByteArrayOutputStream, org.h2.engine.SessionLocal, org.h2.expression.Expression, .ExpressionWithFlags, .Format, .OperationN, .Subquery, .TypedValueExpression, org.h2.message.DbException, org.h2.util.json.JsonConstructorUtils, org.h2.value.TypeInfo, .Value, .ValueJson, .ValueNull

JSON constructor function.

Field Summary

Modifier and TypeField and Description
private final boolean
private int
Inherited from org.h2.expression.OperationN:
argsargsCounttype

Constructor Summary

AccessConstructor and Description
public
JsonConstructorFunction(boolean
false for JSON_OBJECT, true for JSON_ARRAY.
array
)

Creates a new instance of JSON constructor function.

Method Summary

Modifier and TypeMethod and Description
public int
public static StringBuilder

Returns:

the specified string builder
getJsonFunctionFlagsSQL
(StringBuilder
string builder to append to
builder
,
int
flags to append
flags
,
boolean
whether the function is an array function
forArray
)

Appends flags of a JSON function to the specified string builder.

public String
public StringBuilder
getUnenclosedSQL(StringBuilder
string builder
builder
,
int
formatting flags
sqlFlags
)

Implements abstract org.h2.expression.Expression.getUnenclosedSQL.

Get the SQL statement of this expression.

public Value
getValue(SessionLocal
the session
session
)

Implements abstract org.h2.expression.Expression.getValue.

Return the resulting value for the current row.

private Value
private Value
public Expression
optimize(SessionLocal
the session
session
)

Implements abstract org.h2.expression.Expression.optimize.

Try to optimize the expression.

public void
setFlags(int
the flags to set
flags
)

Implements org.h2.expression.ExpressionWithFlags.setFlags.

Set the flags for this expression.

Inherited from org.h2.expression.OperationN:
addParameterdoneWithParametersgetCostgetSubexpressiongetSubexpressionCountgetTypeisEverythingmapColumnsoptimizeArgumentssetEvaluatableupdateAggregate

Field Detail

arrayback to summary
private final boolean array
flagsback to summary
private int flags

Constructor Detail

JsonConstructorFunctionback to summary
public JsonConstructorFunction(boolean array)

Creates a new instance of JSON constructor function.

Parameters
array:boolean

false for JSON_OBJECT, true for JSON_ARRAY.

Method Detail

getFlagsback to summary
public int getFlags()

Implements org.h2.expression.ExpressionWithFlags.getFlags.

Doc from org.h2.expression.ExpressionWithFlags.getFlags.

Returns the flags.

Returns:int

the flags

Annotations
@Override
getJsonFunctionFlagsSQLback to summary
public static StringBuilder getJsonFunctionFlagsSQL(StringBuilder builder, int flags, boolean forArray)

Appends flags of a JSON function to the specified string builder.

Parameters
builder:StringBuilder

string builder to append to

flags:int

flags to append

forArray:boolean

whether the function is an array function

Returns:StringBuilder

the specified string builder

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
getUnenclosedSQLback to summary
public StringBuilder getUnenclosedSQL(StringBuilder builder, int sqlFlags)

Implements abstract org.h2.expression.Expression.getUnenclosedSQL.

Doc from org.h2.expression.Expression.getUnenclosedSQL.

Get the SQL statement of this expression. This may not always be the original SQL statement, especially after optimization. Enclosing '(' and ')' are never appended.

Parameters
builder:StringBuilder

string builder

sqlFlags:int

formatting flags

Returns:StringBuilder

the specified string builder

Annotations
@Override
getValueback to summary
public Value getValue(SessionLocal session)

Implements abstract org.h2.expression.Expression.getValue.

Doc from org.h2.expression.Expression.getValue.

Return the resulting value for the current row.

Parameters
session:SessionLocal

the session

Returns:Value

the result

Annotations
@Override
jsonArrayback to summary
private Value jsonArray(SessionLocal session, Expression[] args)
jsonObjectback to summary
private Value jsonObject(SessionLocal session, Expression[] args)
optimizeback to summary
public Expression optimize(SessionLocal session)

Implements abstract org.h2.expression.Expression.optimize.

Doc from org.h2.expression.Expression.optimize.

Try to optimize the expression.

Parameters
session:SessionLocal

the session

Returns:Expression

the optimized expression

Annotations
@Override
setFlagsback to summary
public void setFlags(int flags)

Implements org.h2.expression.ExpressionWithFlags.setFlags.

Doc from org.h2.expression.ExpressionWithFlags.setFlags.

Set the flags for this expression.

Parameters
flags:int

the flags to set

Annotations
@Override