Comparison
Example comparison expressions are ID=1, NAME=NAME, NAME IS NULL.
| Methods |
| static boolean |
compareNotNull(Database database, Value l, Value r, int compareType)
Compare two values, given the values are not NULL.
|
| static boolean |
compareNotNull(Database database, Value l, Value r, int compareType)
Compare two values, given the values are not NULL.
Parameters:
database - the database
l - the first value
r - the second value
compareType - the compare type
Returns:
true if the comparison indicated by the comparison type evaluates
to true
|
| static String |
getCompareOperator(int compareType)
Get the comparison operator string ("=", ">",...).
|
| static String |
getCompareOperator(int compareType)
Get the comparison operator string ("=", ">",...).
Parameters:
compareType - the compare type
Returns:
the string
|
| void |
addFilterConditions(TableFilter filter, boolean outerJoin)
|
| void |
addFilterConditions(TableFilter filter, boolean outerJoin)
|
| void |
createIndexConditions(Session session, TableFilter filter)
|
| void |
createIndexConditions(Session session, TableFilter filter)
|
| Expression |
getAdditional(Session session, Comparison other, boolean and)
Get an additional condition if possible.
|
| Expression |
getAdditional(Session session, Comparison other, boolean and)
Get an additional condition if possible. Example: given two conditions
A=B AND B=C, the new condition A=C is returned. Given the two conditions
A=1 OR A=2, the new condition A IN(1, 2) is returned.
Parameters:
session - the session
other - the second condition
and - true for AND, false for OR
Returns:
null or the third condition
|
| int |
getCost()
|
| int |
getCost()
|
| Expression |
getExpression(boolean getLeft)
Get the left or the right sub-expression of this condition.
|
| Expression |
getExpression(boolean getLeft)
Get the left or the right sub-expression of this condition.
Parameters:
getLeft - true to get the left sub-expression, false to get the
right sub-expression.
Returns:
the sub-expression
|
| Expression |
getIfEquals(Expression match)
Get the other expression if this is an equals comparison and the other
expression matches.
|
| Expression |
getIfEquals(Expression match)
Get the other expression if this is an equals comparison and the other
expression matches.
Parameters:
match - the expression that should match
Returns:
null if no match, the other expression if there is a match
|
| Expression |
getNotIfPossible(Session session)
|
| Expression |
getNotIfPossible(Session session)
|
| String |
getSQL()
|
| String |
getSQL()
|
| Value |
getValue(Session session)
|
| Value |
getValue(Session session)
|
| boolean |
isEverything(ExpressionVisitor visitor)
|
| boolean |
isEverything(ExpressionVisitor visitor)
|
| void |
mapColumns(ColumnResolver resolver, int level)
|
| void |
mapColumns(ColumnResolver resolver, int level)
|
| Expression |
optimize(Session session)
|
| Expression |
optimize(Session session)
|
| void |
setEvaluatable(TableFilter tableFilter, boolean b)
|
| void |
setEvaluatable(TableFilter tableFilter, boolean b)
|
| void |
updateAggregate(Session session)
|
| void |
updateAggregate(Session session)
|
EQUAL
= 0
The comparison type meaning = as in ID=1.
BIGGER_EQUAL
= 1
The comparison type meaning >= as in ID>=1.
IN_QUERY
= 10
This is a pseudo comparison type that is only used for index conditions.
It means equals any value of a list. Example: IN(SELECT ...).
SPATIAL_INTERSECTS
= 11
This is a comparison type that is only used for spatial index
conditions (operator "&&").
EQUAL_NULL_SAFE
= 16
The comparison type meaning ID IS 1 (ID IS NOT DISTINCT FROM 1).
NULL_SAFE
= 16
This is a flag meaning the comparison is null safe (meaning never returns
NULL even if one operand is NULL). Only EQUAL and NOT_EQUAL are supported
currently.
BIGGER
= 2
The comparison type meaning > as in ID>1.
NOT_EQUAL_NULL_SAFE
= 21
The comparison type meaning ID IS NOT 1 (ID IS DISTINCT FROM 1).
SMALLER_EQUAL
= 3
The comparison type meaning <= as in ID<=1.
SMALLER
= 4
The comparison type meaning < as in ID<1.
NOT_EQUAL
= 5
The comparison type meaning <> as in ID<>1.
IS_NULL
= 6
The comparison type meaning IS NULL as in NAME IS NULL.
IS_NOT_NULL
= 7
The comparison type meaning IS NOT NULL as in NAME IS NOT NULL.
FALSE
= 8
This is a pseudo comparison type that is only used for index conditions.
It means the comparison will always yield FALSE. Example: 1=0.
IN_LIST
= 9
This is a pseudo comparison type that is only used for index conditions.
It means equals any value of a list. Example: IN(1, 2, 3).