h2/src/main/org/h2/expression/Comparison.java
/**
     * Compare two values, given the values are not NULL.
     *
     * @param database the database
     * @param l the first value
     * @param r the second value
     * @param compareType the compare type
     * @return the result of the comparison (1 if the first value is bigger, -1
     *         if smaller, 0 if both are equal)
     */
Compare two values, given the values are not NULL.
Compare two values given the values are not NULL .
static boolean compareNotNull(Database database, Value l, Value r, int compareType) {
        boolean result;
        switch (compareType) {
        case EQUAL:
        case EQUAL_NULL_SAFE:
            result = database.areEqual(l, r);
            break;
        case NOT_EQUAL:
        case NOT_EQUAL_NULL_SAFE:
            result = !database.areEqual(l, r);
            break;
        case BIGGER_EQUAL:
            result = database.compare(l, r) >= 0;
            break;
        case BIGGER:
            result = database.compare(l, r) > 0;
            break;
        case SMALLER_EQUAL:
            result = database.compare(l, r) <= 0;
            break;
        case SMALLER:
            result = database.compare(l, r) < 0;
            break;
        case SPATIAL_INTERSECTS: {
            ValueGeometry lg = (ValueGeometry) l.convertTo(Value.GEOMETRY);
            ValueGeometry rg = (ValueGeometry) r.convertTo(Value.GEOMETRY);
            result = lg.intersectsBoundingBox(rg);
            break;
        }
        default:
            throw DbException.throwInternalError("type=" + compareType);
        }
        return result;
    }
static boolean compareNotNull ( Database database , Value l , Value r , int compareType ) { boolean result ; switch ( compareType ) { case EQUAL : case EQUAL_NULL_SAFE : result = database . areEqual ( l , r ) ; break ; case NOT_EQUAL : case NOT_EQUAL_NULL_SAFE : result = ! database . areEqual ( l , r ) ; break ; case BIGGER_EQUAL : result = database . compare ( l , r ) >= 0 ; break ; case BIGGER : result = database . compare ( l , r ) > 0 ; break ; case SMALLER_EQUAL : result = database . compare ( l , r ) <= 0 ; break ; case SMALLER : result = database . compare ( l , r ) < 0 ; break ; case SPATIAL_INTERSECTS : { ValueGeometry lg = ( ValueGeometry ) l . convertTo ( Value . GEOMETRY ) ; ValueGeometry rg = ( ValueGeometry ) r . convertTo ( Value . GEOMETRY ) ; result = lg . intersectsBoundingBox ( rg ) ; break ; } default : throw DbException . throwInternalError ( "type=" + compareType ) ; } return result ; }
Compare two values, given the values are not NULL.
Compare two values given the values are not NULL .