Package org.h2.expression
Class Format
- java.lang.Object
-
- org.h2.expression.Expression
-
- org.h2.expression.Operation1
-
- org.h2.expression.Format
-
public final class Format extends Operation1
A format clause such as FORMAT JSON.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Format.FormatEnum
Supported formats.
-
Field Summary
Fields Modifier and Type Field Description private Format.FormatEnum
format
-
Fields inherited from class org.h2.expression.Operation1
arg, type
-
Fields inherited from class org.h2.expression.Expression
AUTO_PARENTHESES, MAP_IN_AGGREGATE, MAP_IN_WINDOW, MAP_INITIAL, WITH_PARENTHESES, WITHOUT_PARENTHESES
-
Fields inherited from interface org.h2.util.HasSQL
ADD_PLAN_INFORMATION, DEFAULT_SQL_FLAGS, NO_CASTS, QUOTE_ONLY_WHEN_REQUIRED, REPLACE_LOBS_FOR_TRACE, TRACE_SQL_FLAGS
-
-
Constructor Summary
Constructors Constructor Description Format(Expression arg, Format.FormatEnum format)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
getColumnName(SessionLocal session, int columnIndex)
Get the column name or alias name of this expression.int
getNullable()
Check whether this expression is a column and can store NULL.java.lang.String
getTableName()
Get the table name, or nulljava.lang.StringBuilder
getUnenclosedSQL(java.lang.StringBuilder builder, int sqlFlags)
Get the SQL statement of this expression.Value
getValue(SessionLocal session)
Return the resulting value for the current row.Value
getValue(Value value)
Returns the value with applied format.boolean
isIdentity()
Check if this is an identity column.Expression
optimize(SessionLocal session)
Try to optimize the expression.-
Methods inherited from class org.h2.expression.Operation1
getCost, getSubexpression, getSubexpressionCount, getType, isEverything, mapColumns, setEvaluatable, updateAggregate
-
Methods inherited from class org.h2.expression.Expression
addFilterConditions, createIndexConditions, getAlias, getBooleanValue, getColumnNameForView, getEnclosedSQL, getNonAliasExpression, getNotIfPossible, getSchemaName, getSQL, getSQL, getSQL, getSQL, getTableAlias, getWhenSQL, getWhenValue, isConstant, isNullConstant, isValueSet, isWhenConditionOperand, needParentheses, optimizeCondition, toString, writeExpressions, writeExpressions
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.h2.util.HasSQL
getTraceSQL
-
-
-
-
Field Detail
-
format
private final Format.FormatEnum format
-
-
Constructor Detail
-
Format
public Format(Expression arg, Format.FormatEnum format)
-
-
Method Detail
-
getValue
public Value getValue(SessionLocal session)
Description copied from class:Expression
Return the resulting value for the current row.- Specified by:
getValue
in classExpression
- Parameters:
session
- the session- Returns:
- the result
-
getValue
public Value getValue(Value value)
Returns the value with applied format.- Parameters:
value
- the value- Returns:
- the value with applied format
-
optimize
public Expression optimize(SessionLocal session)
Description copied from class:Expression
Try to optimize the expression.- Specified by:
optimize
in classExpression
- Parameters:
session
- the session- Returns:
- the optimized expression
-
isIdentity
public boolean isIdentity()
Description copied from class:Expression
Check if this is an identity column.- Overrides:
isIdentity
in classExpression
- Returns:
- true if it is an identity column
-
getUnenclosedSQL
public java.lang.StringBuilder getUnenclosedSQL(java.lang.StringBuilder builder, int sqlFlags)
Description copied from class:Expression
Get the SQL statement of this expression. This may not always be the original SQL statement, especially after optimization. Enclosing '(' and ')' are never appended.- Specified by:
getUnenclosedSQL
in classExpression
- Parameters:
builder
- string buildersqlFlags
- formatting flags- Returns:
- the specified string builder
-
getNullable
public int getNullable()
Description copied from class:Expression
Check whether this expression is a column and can store NULL.- Overrides:
getNullable
in classExpression
- Returns:
- whether NULL is allowed
-
getTableName
public java.lang.String getTableName()
Description copied from class:Expression
Get the table name, or null- Overrides:
getTableName
in classExpression
- Returns:
- the table name
-
getColumnName
public java.lang.String getColumnName(SessionLocal session, int columnIndex)
Description copied from class:Expression
Get the column name or alias name of this expression.- Overrides:
getColumnName
in classExpression
- Parameters:
session
- the sessioncolumnIndex
- 0-based column index- Returns:
- the column name
-
-