[#845] [#846] Add support for the T-SQL and Oracle 12c CROSS / OUTER APPLY clauses

This commit is contained in:
Lukas Eder 2013-12-09 14:11:33 +01:00
parent 9a19767ec2
commit cb70397099
10 changed files with 499 additions and 18 deletions

View File

@ -307,6 +307,99 @@ extends BaseTest<A, AP, B, S, B2S, BS, L, X, DATE, BOOL, D, T, U, UU, I, IPK, T7
.fetchOne(0, int.class));
}
@Test
public void testCrossApply() throws Exception {
switch (dialect()) {
/* [pro] xx
xxxx xxxxxxxxxx
xxxx xxxxxxxxxx
xxxx xxxxxxxxxxxxxx
xxxx xxxxxxxxxxxxxx
xxxx xxxxxxx
xxxxxx
xx [/pro] */
default:
log.info("SKIPPING", "CROSS APPLY tests");
return;
}
/* [pro] xx
xxxxxxxxxxxxx
xxxxxxxxx xxx
xxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxx
xxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
x
xxxxxxxxxxx xxxxxxxxxx
xx
xxxxxxxxxxxxx
xxxxxxxxx xxx
xxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxx
xxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
x
xxxxxxxxxxx xxxxxxxxxx
xx
xxxxxxxxxxxxx
xxxxxxxxx xxx
xxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxx
xxxxxx
xxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
x
xxxxxxxxxxxxxxxxxxxx
x
xxxxxxxxxxx xxxxxxxxxx
xx
xxxxxxxxxxxxx
xxxxxxxxx xxx
xxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
x
xxxxxxxxxxx xxxxxxxxxx
xx
xxxxxxxxxxxxx
xxxxxxxxx xxx
xxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
x
xxxxxxxxxxx xxxxxxxxxx
xx
xxxxxxxxxxxxx
xxxxxxxxx xxx
xxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
x
xxxxxxxxxxxxxxxxxxxxx
x
xxxxxxxxxxx xxxxxxxxxx
xx
xx [/pro] */
}
@Test
public void testNaturalJoin() throws Exception {
boolean unqualified = false;

View File

@ -1956,6 +1956,11 @@ public abstract class jOOQAbstractTest<
new JoinTests(this).testCrossJoin();
}
@Test
public void testCrossApply() throws Exception {
new JoinTests(this).testCrossApply();
}
@Test
public void testNaturalJoin() throws Exception {
new JoinTests(this).testNaturalJoin();

View File

@ -108,6 +108,8 @@ public enum Clause {
TABLE_JOIN_OUTER_FULL,
TABLE_JOIN_NATURAL_OUTER_LEFT,
TABLE_JOIN_NATURAL_OUTER_RIGHT,
TABLE_JOIN_CROSS_APPLY,
TABLE_JOIN_OUTER_APPLY,
TABLE_JOIN_ON,
TABLE_JOIN_USING,
TABLE_JOIN_PARTITION_BY,

View File

@ -41,6 +41,10 @@
package org.jooq;
// ...
// ...
// ...
/**
* The type of join
@ -50,53 +54,65 @@ package org.jooq;
public enum JoinType {
/**
* <code>INNER JOIN</code> two tables
* <code>INNER JOIN</code> two tables.
*/
@Support
JOIN("join"),
/**
* <code>CROSS JOIN</code> two tables
* <code>CROSS JOIN</code> two tables.
*/
@Support
CROSS_JOIN("cross join"),
/**
* <code>LEFT OUTER JOIN</code> two tables
* <code>LEFT OUTER JOIN</code> two tables.
*/
@Support
LEFT_OUTER_JOIN("left outer join"),
/**
* <code>RIGHT OUTER JOIN</code> two tables
* <code>RIGHT OUTER JOIN</code> two tables.
*/
@Support
RIGHT_OUTER_JOIN("right outer join"),
/**
* <code>FULL OUTER JOIN</code> two tables
* <code>FULL OUTER JOIN</code> two tables.
*/
@Support
FULL_OUTER_JOIN("full outer join"),
/**
* <code>NATURAL INNER JOIN</code> two tables
* <code>NATURAL INNER JOIN</code> two tables.
*/
@Support
NATURAL_JOIN("natural join"),
/**
* <code>NATURAL LEFT OUTER JOIN</code> two tables
* <code>NATURAL LEFT OUTER JOIN</code> two tables.
*/
@Support
NATURAL_LEFT_OUTER_JOIN("natural left outer join"),
/**
* <code>NATURAL RIGHT OUTER JOIN</code> two tables
* <code>NATURAL RIGHT OUTER JOIN</code> two tables.
*/
@Support
NATURAL_RIGHT_OUTER_JOIN("natural right outer join"),
/**
* <code>CROSS APPLY</code> two tables.
*/
@Support({})
CROSS_APPLY("cross apply"),
/**
* <code>OUTER APPLY</code> two tables.
*/
@Support({})
OUTER_APPLY("outer apply"),
;
private final String sql;

View File

@ -52,6 +52,7 @@ import static org.jooq.SQLDialect.HSQLDB;
import static org.jooq.SQLDialect.MARIADB;
import static org.jooq.SQLDialect.MYSQL;
// ...
// ...
import static org.jooq.SQLDialect.POSTGRES;
// ...
// ...
@ -658,4 +659,112 @@ public interface SelectJoinStep<R extends Record> extends SelectWhereStep<R> {
@Support({ CUBRID, DERBY, FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES })
SelectJoinStep<R> naturalRightOuterJoin(String sql, QueryPart... parts);
// -------------------------------------------------------------------------
// XXX: APPLY clauses on tables
// -------------------------------------------------------------------------
/* [pro] xx
xxx
x xxxxxxxxxxx xxxxxxxxxxxx x xxxxx xx xxxx xxxxxx
x
x xxxx xxxxxxxxxxxxxxxxxxxxxxxxxxx
xx
xxxxxxxxxx xxxxxxxxxx xxxxxxxxxx xxxxxx xx
xxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxx xxxxxxx
xxx
x xxxxxxxxxxx xxxxxxxxxxxx x xxxxx xx xxxx xxxxxx
x xxx
x xxxxxxxxxxxx xxxx xxxxxxxxx xxxxx xxx xxxx xxxx xxxxxxxx xxx xxxx
x xxxxxxxxx xxxxxx xxxxxxxxxx xxx xxx xxxx xxxxxx xxx xxxxxxxxxxx xx
x xxxxxxxxx xxx xxxxxxxxxx xx xxxx xx xxxxxxxx xxx xxxx xxxxxxxxx xxxxxx
x xxxxxx xxxxxxxx xxxx xxxxxxxxxxxx xxxx xxx xxxxxxxx
x
x xxxx xxxxxxxxxxxxxxxxx
x xxxx xxxxxxxxxxxxxxxxxxxxxxxx
xx
xxxxxxxxxx xxxxxxxxxx xxxxxxxxxx xxxxxx xx
xxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxx xxxxx
xxx
x xxxxxxxxxxx xxxxxxxxxxxx x xxxxx xx xxxx xxxxxx
x xxx
x xxxxxxxxxxxx xxxx xxxxxxxxx xxxxx xxx xxxx xxxx xxxxxxxx xxx xxxx
x xxxxxxxxx xxxxxx xxxxxxxxxx xxx xxx xxxx xxxxxx xxx xxxxxxxxxxx xx
x xxxxxxxxx xxx xxxxxxxxxx xx xxxx xx xxxxxxxx xxx xxxx xxxxxxxxx xxxxxx
x xxxxxx xxxxxxxx xxxx xxxxxxxxxxxx xxxx xxx xxxxxxxx
x
x xxxx xxxxxxxxxxxxxxxxx xxxxxxxxxx
x xxxx xxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxx
xx
xxxxxxxxxx xxxxxxxxxx xxxxxxxxxx xxxxxx xx
xxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxx xxxx xxxxxxxxx xxxxxxxxxx
xxx
x xxxxxxxxxxx xxxxxxxxxxxx x xxxxx xx xxxx xxxxxx
x xxx
x xxxxxxxxxxxx xxxx xxxxxxxxx xxxxx xxx xxxx xxxx xxxxxxxx xxx xxxx
x xxxxxxxxx xxxxxx xxxxxxxxxx xxx xxx xxxx xxxxxx xxx xxxxxxxxxxx xx
x xxxxxxxxx xxx xxxxxxxxxx xx xxxx xx xxxxxxxx xxx xxxx xxxxxxxxx xxxxxx
x xxxxxx xxxxxxxx xxxx xxxxxxxxxxxx xxxx xxx xxxxxxxx
x
x xxxx xxxxxxxxxxxxxxxxx xxxxxxxxxxxxx
x xxxx xxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxx
xx
xxxxxxxxxx xxxxxxxxxx xxxxxxxxxx xxxxxx xx
xxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxx xxxx xxxxxxxxxxxx xxxxxxx
xxx
x xxxxxxxxxxx xxxxxxxxxxxx x xxxxx xx xxxx xxxxxx
x
x xxxx xxxxxxxxxxxxxxxxxxxxxxxxxxx
xx
xxxxxxxxxx xxxxxxxxxx xxxxxxxxxx xxxxxx xx
xxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxx xxxxxxx
xxx
x xxxxxxxxxxx xxxxxxxxxxxx x xxxxx xx xxxx xxxxxx
x xxx
x xxxxxxxxxxxx xxxx xxxxxxxxx xxxxx xxx xxxx xxxx xxxxxxxx xxx xxxx
x xxxxxxxxx xxxxxx xxxxxxxxxx xxx xxx xxxx xxxxxx xxx xxxxxxxxxxx xx
x xxxxxxxxx xxx xxxxxxxxxx xx xxxx xx xxxxxxxx xxx xxxx xxxxxxxxx xxxxxx
x xxxxxx xxxxxxxx xxxx xxxxxxxxxxxx xxxx xxx xxxxxxxx
x
x xxxx xxxxxxxxxxxxxxxxx
x xxxx xxxxxxxxxxxxxxxxxxxxxxxx
xx
xxxxxxxxxx xxxxxxxxxx xxxxxxxxxx xxxxxx xx
xxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxx xxxxx
xxx
x xxxxxxxxxxx xxxxxxxxxxxx x xxxxx xx xxxx xxxxxx
x xxx
x xxxxxxxxxxxx xxxx xxxxxxxxx xxxxx xxx xxxx xxxx xxxxxxxx xxx xxxx
x xxxxxxxxx xxxxxx xxxxxxxxxx xxx xxx xxxx xxxxxx xxx xxxxxxxxxxx xx
x xxxxxxxxx xxx xxxxxxxxxx xx xxxx xx xxxxxxxx xxx xxxx xxxxxxxxx xxxxxx
x xxxxxx xxxxxxxx xxxx xxxxxxxxxxxx xxxx xxx xxxxxxxx
x
x xxxx xxxxxxxxxxxxxxxxx xxxxxxxxxx
x xxxx xxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxx
xx
xxxxxxxxxx xxxxxxxxxx xxxxxxxxxx xxxxxx xx
xxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxx xxxx xxxxxxxxx xxxxxxxxxx
xxx
x xxxxxxxxxxx xxxxxxxxxxxx x xxxxx xx xxxx xxxxxx
x xxx
x xxxxxxxxxxxx xxxx xxxxxxxxx xxxxx xxx xxxx xxxx xxxxxxxx xxx xxxx
x xxxxxxxxx xxxxxx xxxxxxxxxx xxx xxx xxxx xxxxxx xxx xxxxxxxxxxx xx
x xxxxxxxxx xxx xxxxxxxxxx xx xxxx xx xxxxxxxx xxx xxxx xxxxxxxxx xxxxxx
x xxxxxx xxxxxxxx xxxx xxxxxxxxxxxx xxxx xxx xxxxxxxx
x
x xxxx xxxxxxxxxxxxxxxxx xxxxxxxxxxxxx
x xxxx xxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxx
xx
xxxxxxxxxx xxxxxxxxxx xxxxxxxxxx xxxxxx xx
xxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxx xxxx xxxxxxxxxxxx xxxxxxx
xx [/pro] */
}

View File

@ -909,6 +909,144 @@ public interface Table<R extends Record> extends TableLike<R> {
)
Table<Record> naturalRightOuterJoin(String sql, QueryPart... parts);
// -------------------------------------------------------------------------
// XXX: APPLY clauses on tables
// -------------------------------------------------------------------------
/* [pro] xx
xxx
x xxxxxxxxxxx xxxxxxxxxxxx x xxxxx xx xxxx xxxxxx
xx
xxxxxxxxxx xxxxxxxxxx xxxxxxxxxx xxxxxx xx
xxxxxxxxxxxx
xxxx x xxxxxx xxxxxxx
xxxx x xxxxxxxx
xx x xxxxxxxxxxxxx
x
xxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxx xxxxxxx
xxx
x xxxxxxxxxxx xxxxxxxxxxxx x xxxxx xx xxxx xxxxxx
x xxx
x xxxxxxxxxxxx xxxx xxxxxxxxx xxxxx xxx xxxx xxxx xxxxxxxx xxx xxxx
x xxxxxxxxx xxxxxx xxxxxxxxxx xxx xxx xxxx xxxxxx xxx xxxxxxxxxxx xx
x xxxxxxxxx xxx xxxxxxxxxx xx xxxx xx xxxxxxxx xxx xxxx xxxxxxxxx xxxxxx
x xxxxxx xxxxxxxx xxxx xxxxxxxxxxxx xxxx xxx xxxxxxxx
x
x xxxx xxxxxxxxxxxxxxxxx
xx
xxxxxxxxxx xxxxxxxxxx xxxxxxxxxx xxxxxx xx
xxxxxxxxxxxx
xxxx x xxxxxx xxxxxxx
xxxx x xxxxxxxx
xx x xxxxxxxxxxxxx
x
xxxxxxxxxxxxx xxxxxxxxxxxxxxxxx xxxxx
xxx
x xxxxxxxxxxx xxxxxxxxxxxx x xxxxx xx xxxx xxxxxx
x xxx
x xxxxxxxxxxxx xxxx xxxxxxxxx xxxxx xxx xxxx xxxx xxxxxxxx xxx xxxx
x xxxxxxxxx xxxxxx xxxxxxxxxx xxx xxx xxxx xxxxxx xxx xxxxxxxxxxx xx
x xxxxxxxxx xxx xxxxxxxxxx xx xxxx xx xxxxxxxx xxx xxxx xxxxxxxxx xxxxxx
x xxxxxx xxxxxxxx xxxx xxxxxxxxxxxx xxxx xxx xxxxxxxx
x
x xxxx xxxxxxxxxxxxxxxxx xxxxxxxxxx
xx
xxxxxxxxxx xxxxxxxxxx xxxxxxxxxx xxxxxx xx
xxxxxxxxxxxx
xxxx x xxxxxx xxxxxxx
xxxx x xxxxxxxx
xx x xxxxxxxxxxxxx
x
xxxxxxxxxxxxx xxxxxxxxxxxxxxxxx xxxx xxxxxxxxx xxxxxxxxxx
xxx
x xxxxxxxxxxx xxxxxxxxxxxx x xxxxx xx xxxx xxxxxx
x xxx
x xxxxxxxxxxxx xxxx xxxxxxxxx xxxxx xxx xxxx xxxx xxxxxxxx xxx xxxx
x xxxxxxxxx xxxxxx xxxxxxxxxx xxx xxx xxxx xxxxxx xxx xxxxxxxxxxx xx
x xxxxxxxxx xxx xxxxxxxxxx xx xxxx xx xxxxxxxx xxx xxxx xxxxxxxxx xxxxxx
x xxxxxx xxxxxxxx xxxx xxxxxxxxxxxx xxxx xxx xxxxxxxx
x
x xxxx xxxxxxxxxxxxxxxxx xxxxxxxxxxxxx
xx
xxxxxxxxxx xxxxxxxxxx xxxxxxxxxx xxxxxx xx
xxxxxxxxxxxx
xxxx x xxxxxx xxxxxxx
xxxx x xxxxxxxx
xx x xxxxxxxxxxxxx
x
xxxxxxxxxxxxx xxxxxxxxxxxxxxxxx xxxx xxxxxxxxxxxx xxxxxxx
xxx
x xxxxxxxxxxx xxxxxxxxxxxx x xxxxx xx xxxx xxxxxx
xx
xxxxxxxxxx xxxxxxxxxx xxxxxxxxxx xxxxxx xx
xxxxxxxxxxxx
xxxx x xxxxxx xxxxxxx
xxxx x xxxxxxxx
xx x xxxxxxxxxxxxx
x
xxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxx xxxxxxx
xxx
x xxxxxxxxxxx xxxxxxxxxxxx x xxxxx xx xxxx xxxxxx
x xxx
x xxxxxxxxxxxx xxxx xxxxxxxxx xxxxx xxx xxxx xxxx xxxxxxxx xxx xxxx
x xxxxxxxxx xxxxxx xxxxxxxxxx xxx xxx xxxx xxxxxx xxx xxxxxxxxxxx xx
x xxxxxxxxx xxx xxxxxxxxxx xx xxxx xx xxxxxxxx xxx xxxx xxxxxxxxx xxxxxx
x xxxxxx xxxxxxxx xxxx xxxxxxxxxxxx xxxx xxx xxxxxxxx
x
x xxxx xxxxxxxxxxxxxxxxx
xx
xxxxxxxxxx xxxxxxxxxx xxxxxxxxxx xxxxxx xx
xxxxxxxxxxxx
xxxx x xxxxxx xxxxxxx
xxxx x xxxxxxxx
xx x xxxxxxxxxxxxx
x
xxxxxxxxxxxxx xxxxxxxxxxxxxxxxx xxxxx
xxx
x xxxxxxxxxxx xxxxxxxxxxxx x xxxxx xx xxxx xxxxxx
x xxx
x xxxxxxxxxxxx xxxx xxxxxxxxx xxxxx xxx xxxx xxxx xxxxxxxx xxx xxxx
x xxxxxxxxx xxxxxx xxxxxxxxxx xxx xxx xxxx xxxxxx xxx xxxxxxxxxxx xx
x xxxxxxxxx xxx xxxxxxxxxx xx xxxx xx xxxxxxxx xxx xxxx xxxxxxxxx xxxxxx
x xxxxxx xxxxxxxx xxxx xxxxxxxxxxxx xxxx xxx xxxxxxxx
x
x xxxx xxxxxxxxxxxxxxxxx xxxxxxxxxx
xx
xxxxxxxxxx xxxxxxxxxx xxxxxxxxxx xxxxxx xx
xxxxxxxxxxxx
xxxx x xxxxxx xxxxxxx
xxxx x xxxxxxxx
xx x xxxxxxxxxxxxx
x
xxxxxxxxxxxxx xxxxxxxxxxxxxxxxx xxxx xxxxxxxxx xxxxxxxxxx
xxx
x xxxxxxxxxxx xxxxxxxxxxxx x xxxxx xx xxxx xxxxxx
x xxx
x xxxxxxxxxxxx xxxx xxxxxxxxx xxxxx xxx xxxx xxxx xxxxxxxx xxx xxxx
x xxxxxxxxx xxxxxx xxxxxxxxxx xxx xxx xxxx xxxxxx xxx xxxxxxxxxxx xx
x xxxxxxxxx xxx xxxxxxxxxx xx xxxx xx xxxxxxxx xxx xxxx xxxxxxxxx xxxxxx
x xxxxxx xxxxxxxx xxxx xxxxxxxxxxxx xxxx xxx xxxxxxxx
x
x xxxx xxxxxxxxxxxxxxxxx xxxxxxxxxxxxx
xx
xxxxxxxxxx xxxxxxxxxx xxxxxxxxxx xxxxxx xx
xxxxxxxxxxxx
xxxx x xxxxxx xxxxxxx
xxxx x xxxxxxxx
xx x xxxxxxxxxxxxx
x
xxxxxxxxxxxxx xxxxxxxxxxxxxxxxx xxxx xxxxxxxxxxxx xxxxxxx
xx [/pro] */
// -------------------------------------------------------------------------
// XXX: Exotic and vendor-specific clauses on tables
// -------------------------------------------------------------------------

View File

@ -41,6 +41,16 @@
package org.jooq.impl;
import static org.jooq.Clause.TABLE;
import static org.jooq.JoinType.CROSS_APPLY;
import static org.jooq.JoinType.CROSS_JOIN;
import static org.jooq.JoinType.FULL_OUTER_JOIN;
import static org.jooq.JoinType.JOIN;
import static org.jooq.JoinType.LEFT_OUTER_JOIN;
import static org.jooq.JoinType.NATURAL_JOIN;
import static org.jooq.JoinType.NATURAL_LEFT_OUTER_JOIN;
import static org.jooq.JoinType.NATURAL_RIGHT_OUTER_JOIN;
import static org.jooq.JoinType.OUTER_APPLY;
import static org.jooq.JoinType.RIGHT_OUTER_JOIN;
import static org.jooq.impl.DSL.table;
import static org.jooq.impl.DSL.val;
@ -402,7 +412,7 @@ abstract class AbstractTable<R extends Record> extends AbstractQueryPart impleme
@Override
public final TableOnStep join(TableLike<?> table) {
return join(table, JoinType.JOIN);
return join(table, JOIN);
}
@Override
@ -422,7 +432,7 @@ abstract class AbstractTable<R extends Record> extends AbstractQueryPart impleme
@Override
public final TablePartitionByStep leftOuterJoin(TableLike<?> table) {
return join(table, JoinType.LEFT_OUTER_JOIN);
return join(table, LEFT_OUTER_JOIN);
}
@Override
@ -442,7 +452,7 @@ abstract class AbstractTable<R extends Record> extends AbstractQueryPart impleme
@Override
public final TablePartitionByStep rightOuterJoin(TableLike<?> table) {
return join(table, JoinType.RIGHT_OUTER_JOIN);
return join(table, RIGHT_OUTER_JOIN);
}
@Override
@ -462,7 +472,7 @@ abstract class AbstractTable<R extends Record> extends AbstractQueryPart impleme
@Override
public final TableOnStep fullOuterJoin(TableLike<?> table) {
return join(table, JoinType.FULL_OUTER_JOIN);
return join(table, FULL_OUTER_JOIN);
}
@Override
@ -482,7 +492,7 @@ abstract class AbstractTable<R extends Record> extends AbstractQueryPart impleme
@Override
public final Table<Record> crossJoin(TableLike<?> table) {
return join(table, JoinType.CROSS_JOIN);
return join(table, CROSS_JOIN);
}
@Override
@ -502,7 +512,7 @@ abstract class AbstractTable<R extends Record> extends AbstractQueryPart impleme
@Override
public final Table<Record> naturalJoin(TableLike<?> table) {
return join(table, JoinType.NATURAL_JOIN);
return join(table, NATURAL_JOIN);
}
@Override
@ -522,7 +532,7 @@ abstract class AbstractTable<R extends Record> extends AbstractQueryPart impleme
@Override
public final Table<Record> naturalLeftOuterJoin(TableLike<?> table) {
return join(table, JoinType.NATURAL_LEFT_OUTER_JOIN);
return join(table, NATURAL_LEFT_OUTER_JOIN);
}
@Override
@ -542,7 +552,7 @@ abstract class AbstractTable<R extends Record> extends AbstractQueryPart impleme
@Override
public final Table<Record> naturalRightOuterJoin(TableLike<?> table) {
return join(table, JoinType.NATURAL_RIGHT_OUTER_JOIN);
return join(table, NATURAL_RIGHT_OUTER_JOIN);
}
@Override
@ -560,6 +570,50 @@ abstract class AbstractTable<R extends Record> extends AbstractQueryPart impleme
return naturalRightOuterJoin(table(sql, parts));
}
/* [pro] xx
xxxxxxxxx
xxxxxx xxxxx xxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxx xxxxxx x
xxxxxx xxxxxxxxxxx xxxxxxxxxxxxx
x
xxxxxxxxx
xxxxxx xxxxx xxxxxxxxxxxxx xxxxxxxxxxxxxxxxx xxxx x
xxxxxx xxxxxxxxxxxxxxxxxxxxxxx
x
xxxxxxxxx
xxxxxx xxxxx xxxxxxxxxxxxx xxxxxxxxxxxxxxxxx xxxx xxxxxxxxx xxxxxxxxx x
xxxxxx xxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxx
x
xxxxxxxxx
xxxxxx xxxxx xxxxxxxxxxxxx xxxxxxxxxxxxxxxxx xxxx xxxxxxxxxxxx xxxxxx x
xxxxxx xxxxxxxxxxxxxxxxxxxxx xxxxxxxx
x
xxxxxxxxx
xxxxxx xxxxx xxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxx xxxxxx x
xxxxxx xxxxxxxxxxx xxxxxxxxxxxxx
x
xxxxxxxxx
xxxxxx xxxxx xxxxxxxxxxxxx xxxxxxxxxxxxxxxxx xxxx x
xxxxxx xxxxxxxxxxxxxxxxxxxxxxx
x
xxxxxxxxx
xxxxxx xxxxx xxxxxxxxxxxxx xxxxxxxxxxxxxxxxx xxxx xxxxxxxxx xxxxxxxxx x
xxxxxx xxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxx
x
xxxxxxxxx
xxxxxx xxxxx xxxxxxxxxxxxx xxxxxxxxxxxxxxxxx xxxx xxxxxxxxxxxx xxxxxx x
xxxxxx xxxxxxxxxxxxxxxxxxxxx xxxxxxxx
x
xx [/pro] */
// ------------------------------------------------------------------------
// XXX: Object API
// ------------------------------------------------------------------------

View File

@ -44,22 +44,26 @@ import static java.util.Arrays.asList;
import static org.jooq.Clause.TABLE;
import static org.jooq.Clause.TABLE_JOIN;
import static org.jooq.Clause.TABLE_JOIN_CROSS;
import static org.jooq.Clause.TABLE_JOIN_CROSS_APPLY;
import static org.jooq.Clause.TABLE_JOIN_INNER;
import static org.jooq.Clause.TABLE_JOIN_NATURAL;
import static org.jooq.Clause.TABLE_JOIN_NATURAL_OUTER_LEFT;
import static org.jooq.Clause.TABLE_JOIN_NATURAL_OUTER_RIGHT;
import static org.jooq.Clause.TABLE_JOIN_ON;
import static org.jooq.Clause.TABLE_JOIN_OUTER_APPLY;
import static org.jooq.Clause.TABLE_JOIN_OUTER_FULL;
import static org.jooq.Clause.TABLE_JOIN_OUTER_LEFT;
import static org.jooq.Clause.TABLE_JOIN_OUTER_RIGHT;
import static org.jooq.Clause.TABLE_JOIN_PARTITION_BY;
import static org.jooq.Clause.TABLE_JOIN_USING;
import static org.jooq.JoinType.CROSS_APPLY;
import static org.jooq.JoinType.CROSS_JOIN;
import static org.jooq.JoinType.JOIN;
import static org.jooq.JoinType.LEFT_OUTER_JOIN;
import static org.jooq.JoinType.NATURAL_JOIN;
import static org.jooq.JoinType.NATURAL_LEFT_OUTER_JOIN;
import static org.jooq.JoinType.NATURAL_RIGHT_OUTER_JOIN;
import static org.jooq.JoinType.OUTER_APPLY;
import static org.jooq.JoinType.RIGHT_OUTER_JOIN;
// ...
// ...
@ -198,7 +202,9 @@ class JoinTable extends AbstractTable<Record> implements TableOptionalOnStep, Ta
if (!asList(CROSS_JOIN,
NATURAL_JOIN,
NATURAL_LEFT_OUTER_JOIN,
NATURAL_RIGHT_OUTER_JOIN).contains(translatedType)) {
NATURAL_RIGHT_OUTER_JOIN,
CROSS_APPLY,
OUTER_APPLY).contains(translatedType)) {
toSQLJoinCondition(context);
}
@ -219,6 +225,8 @@ class JoinTable extends AbstractTable<Record> implements TableOptionalOnStep, Ta
case FULL_OUTER_JOIN: return TABLE_JOIN_OUTER_FULL;
case NATURAL_LEFT_OUTER_JOIN: return TABLE_JOIN_NATURAL_OUTER_LEFT;
case NATURAL_RIGHT_OUTER_JOIN: return TABLE_JOIN_NATURAL_OUTER_RIGHT;
case CROSS_APPLY: return TABLE_JOIN_CROSS_APPLY;
case OUTER_APPLY: return TABLE_JOIN_OUTER_APPLY;
default: throw new IllegalArgumentException("Bad join type: " + translatedType);
}
}

View File

@ -1975,7 +1975,9 @@ class SelectImpl<R extends Record, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
case CROSS_JOIN:
case NATURAL_JOIN:
case NATURAL_LEFT_OUTER_JOIN:
case NATURAL_RIGHT_OUTER_JOIN: {
case NATURAL_RIGHT_OUTER_JOIN:
case CROSS_APPLY:
case OUTER_APPLY: {
getQuery().addJoin(table, type);
joinTable = null;
joinPartitionBy = null;
@ -2016,6 +2018,20 @@ class SelectImpl<R extends Record, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
return join(table, JoinType.NATURAL_RIGHT_OUTER_JOIN);
}
/* [pro] xx
xxxxxxxxx
xxxxxx xxxxx xxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxx xxxxxx x
xxxxxx xxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxx
x
xxxxxxxxx
xxxxxx xxxxx xxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxx xxxxxx x
xxxxxx xxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxx
x
xx [/pro] */
@Override
public final SelectImpl join(String sql) {
return join(table(sql));
@ -2137,6 +2153,37 @@ class SelectImpl<R extends Record, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
}
/* [pro] xx
xxxxxxxxx
xxxxxx xxxxx xxxxxxxxxx xxxxxxxxxxxxxxxxx xxxx x
xxxxxx xxxxxxxxxxxxxxxxxxxxxxx
x
xxxxxxxxx
xxxxxx xxxxx xxxxxxxxxx xxxxxxxxxxxxxxxxx xxxx xxxxxxxxx xxxxxxxxx x
xxxxxx xxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxx
x
xxxxxxxxx
xxxxxx xxxxx xxxxxxxxxx xxxxxxxxxxxxxxxxx xxxx xxxxxxxxxxxx xxxxxx x
xxxxxx xxxxxxxxxxxxxxxxxxxxx xxxxxxxx
x
xxxxxxxxx
xxxxxx xxxxx xxxxxxxxxx xxxxxxxxxxxxxxxxx xxxx x
xxxxxx xxxxxxxxxxxxxxxxxxxxxxx
x
xxxxxxxxx
xxxxxx xxxxx xxxxxxxxxx xxxxxxxxxxxxxxxxx xxxx xxxxxxxxx xxxxxxxxx x
xxxxxx xxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxx
x
xxxxxxxxx
xxxxxx xxxxx xxxxxxxxxx xxxxxxxxxxxxxxxxx xxxx xxxxxxxxxxxx xxxxxx x
xxxxxx xxxxxxxxxxxxxxxxxxxxx xxxxxxxx
x
xxxxxxxxx
xxxxxx xxxxx xxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxx xxxxxxx x
xxxxxxxxxxxxxxx x xxxxxxx

View File

@ -1318,6 +1318,15 @@ class SelectQueryImpl<R extends Record> extends AbstractSelect<R> implements Sel
case NATURAL_RIGHT_OUTER_JOIN:
joined = getFrom().get(index).naturalRightOuterJoin(table);
break;
/* [pro] xx
xxxx xxxxxxxxxxxx
xxxxxx x xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxx
xxxx xxxxxxxxxxxx
xxxxxx x xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxx
xx [/pro] */
}
getFrom().set(index, joined);