Search in sources :

Example 1 with TablePartitionByStep

use of org.jooq.TablePartitionByStep in project jOOQ by jOOQ.

the class DefaultParseContext method parseJoinedTableIf.

private final Table<?> parseJoinedTableIf(Table<?> left, BooleanSupplier forbiddenKeywords) {
    JoinType joinType = parseJoinTypeIf();
    if (joinType == null)
        return null;
    Table<?> right = joinType.qualified() ? parseTable(forbiddenKeywords) : parseLateral(forbiddenKeywords);
    TableOptionalOnStep<?> s0;
    TablePartitionByStep<?> s1;
    TableOnStep<?> s2;
    s2 = s1 = (TablePartitionByStep<?>) (s0 = left.join(right, joinType));
    switch(joinType) {
        case LEFT_OUTER_JOIN:
        case FULL_OUTER_JOIN:
        case RIGHT_OUTER_JOIN:
            if (!ignoreProEdition() && parseKeywordIf("PARTITION BY")) {
                requireProEdition();
            }
        case JOIN:
        case STRAIGHT_JOIN:
        case LEFT_SEMI_JOIN:
        case LEFT_ANTI_JOIN:
            if (parseKeywordIf("ON"))
                return s2.on(parseCondition());
            else if (parseKeywordIf("USING"))
                return parseJoinUsing(s2);
            else // [#9476] MySQL treats INNER JOIN and CROSS JOIN as the same
            if (joinType == JOIN)
                return s0;
            else
                throw expected("ON", "USING");
        case CROSS_JOIN:
            // [#9476] MySQL treats INNER JOIN and CROSS JOIN as the same
            if (parseKeywordIf("ON"))
                return left.join(right).on(parseCondition());
            else if (parseKeywordIf("USING"))
                return parseJoinUsing(left.join(right));
        default:
            return s0;
    }
}
Also used : JoinType(org.jooq.JoinType) TablePartitionByStep(org.jooq.TablePartitionByStep)

Aggregations

JoinType (org.jooq.JoinType)1 TablePartitionByStep (org.jooq.TablePartitionByStep)1