public final class Comparison extends Expression
| Modifier and Type | Field and Description |
|---|---|
static int |
BIGGER
The comparison type meaning > as in ID>1.
|
static int |
BIGGER_EQUAL
The comparison type meaning >= as in ID>=1.
|
static int |
EQUAL
The comparison type meaning = as in ID=1.
|
static int |
EQUAL_NULL_SAFE
The comparison type meaning ID IS NOT DISTINCT FROM 1.
|
static int |
FALSE
This is a pseudo comparison type that is only used for index conditions.
|
static int |
IN_LIST
This is a pseudo comparison type that is only used for index conditions.
|
static int |
IN_QUERY
This is a pseudo comparison type that is only used for index conditions.
|
static int |
NOT_EQUAL
The comparison type meaning <> as in ID<>1.
|
static int |
NOT_EQUAL_NULL_SAFE
The comparison type meaning ID IS DISTINCT FROM 1.
|
static int |
SMALLER
The comparison type meaning < as in ID<1.
|
static int |
SMALLER_EQUAL
The comparison type meaning <= as in ID<=1.
|
static int |
SPATIAL_INTERSECTS
This is a comparison type that is only used for spatial index
conditions (operator "&&").
|
AUTO_PARENTHESES, MAP_IN_AGGREGATE, MAP_IN_WINDOW, MAP_INITIAL, WITH_PARENTHESES, WITHOUT_PARENTHESESADD_PLAN_INFORMATION, DEFAULT_SQL_FLAGS, NO_CASTS, QUOTE_ONLY_WHEN_REQUIRED, REPLACE_LOBS_FOR_TRACE, TRACE_SQL_FLAGS| Constructor and Description |
|---|
Comparison(int compareType,
Expression left,
Expression right,
boolean whenOperand) |
| Modifier and Type | Method and Description |
|---|---|
void |
createIndexConditions(SessionLocal session,
TableFilter filter)
Create index conditions if possible and attach them to the table filter.
|
int |
getCost()
Estimate the cost to process the expression.
|
Expression |
getNotIfPossible(SessionLocal session)
If it is possible, return the negated expression.
|
Expression |
getSubexpression(int index)
Returns subexpression with specified index.
|
int |
getSubexpressionCount()
Returns count of subexpressions.
|
TypeInfo |
getType()
Returns the data type.
|
java.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.
|
java.lang.StringBuilder |
getWhenSQL(java.lang.StringBuilder builder,
int sqlFlags)
Appends the SQL statement of this when operand to the specified builder.
|
boolean |
getWhenValue(SessionLocal session,
Value left)
Return the resulting value of when operand for the current row.
|
boolean |
isEverything(ExpressionVisitor visitor)
Check if this expression and all sub-expressions can fulfill a criteria.
|
boolean |
isWhenConditionOperand()
Returns whether this expression is a right side of condition in a when
operand.
|
void |
mapColumns(ColumnResolver resolver,
int level,
int state)
Map the columns of the resolver to expression columns.
|
boolean |
needParentheses()
Returns whether this expressions needs to be wrapped in parentheses when
it is used as an argument of other expressions.
|
Expression |
optimize(SessionLocal session)
Try to optimize the expression.
|
void |
setEvaluatable(TableFilter tableFilter,
boolean b)
Tell the expression columns whether the table filter can return values
now.
|
void |
updateAggregate(SessionLocal session,
int stage)
Update an aggregate value.
|
addFilterConditions, getAlias, getBooleanValue, getColumnName, getColumnNameForView, getEnclosedSQL, getNonAliasExpression, getNullable, getSchemaName, getSQL, getSQL, getSQL, getSQL, getTableAlias, getTableName, isConstant, isIdentity, isNullConstant, isValueSet, optimizeCondition, toString, writeExpressions, writeExpressionsclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetTraceSQLpublic static final int EQUAL
public static final int NOT_EQUAL
public static final int SMALLER
public static final int BIGGER
public static final int SMALLER_EQUAL
public static final int BIGGER_EQUAL
public static final int EQUAL_NULL_SAFE
public static final int NOT_EQUAL_NULL_SAFE
public static final int SPATIAL_INTERSECTS
public static final int FALSE
public static final int IN_LIST
public static final int IN_QUERY
public Comparison(int compareType,
Expression left,
Expression right,
boolean whenOperand)
public boolean needParentheses()
ExpressionneedParentheses in class Expressiontrue if it ispublic java.lang.StringBuilder getUnenclosedSQL(java.lang.StringBuilder builder,
int sqlFlags)
ExpressiongetUnenclosedSQL in class Expressionbuilder - string buildersqlFlags - formatting flagspublic java.lang.StringBuilder getWhenSQL(java.lang.StringBuilder builder,
int sqlFlags)
ExpressiongetWhenSQL in class Expressionbuilder - string buildersqlFlags - formatting flagspublic Expression optimize(SessionLocal session)
Expressionoptimize in class Expressionsession - the sessionpublic Value getValue(SessionLocal session)
ExpressiongetValue in class Expressionsession - the sessionpublic boolean getWhenValue(SessionLocal session, Value left)
ExpressiongetWhenValue in class Expressionsession - the sessionleft - value on the left sidepublic boolean isWhenConditionOperand()
ExpressionisWhenConditionOperand in class Expressiontrue if it is, false otherwisepublic Expression getNotIfPossible(SessionLocal session)
ExpressiongetNotIfPossible in class Expressionsession - the sessionpublic void createIndexConditions(SessionLocal session, TableFilter filter)
ExpressioncreateIndexConditions in class Expressionsession - the sessionfilter - the table filterpublic void setEvaluatable(TableFilter tableFilter, boolean b)
ExpressionsetEvaluatable in class ExpressiontableFilter - the table filterb - true if the table filter can return valuepublic void updateAggregate(SessionLocal session, int stage)
ExpressionupdateAggregate in class Expressionsession - the sessionstage - select stagepublic 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_INITIALpublic boolean isEverything(ExpressionVisitor visitor)
ExpressionisEverything in class Expressionvisitor - the visitorpublic int getCost()
ExpressiongetCost in class Expressionpublic int getSubexpressionCount()
ExpressiongetSubexpressionCount in class Expressionpublic Expression getSubexpression(int index)
ExpressiongetSubexpression in class Expressionindex - 0-based indexpublic TypeInfo getType()
ExpressiongetType in interface TypedgetType in class Expression