From 433129e614ce2bce7ee44d43402d9fac1f745738 Mon Sep 17 00:00:00 2001 From: lukaseder Date: Sun, 18 Oct 2015 17:16:57 +0200 Subject: [PATCH] [#4676] Add SelectFromStep.from(Name) and similar convenience methods --- .../jooq/util/postgres/PostgresDatabase.java | 5 +- .../main/java/org/jooq/SelectFromStep.java | 8 + .../main/java/org/jooq/SelectJoinStep.java | 180 ++++++++++++++++++ jOOQ/src/main/java/org/jooq/Table.java | 147 ++++++++++++++ .../main/java/org/jooq/UpdateFromStep.java | 8 + .../java/org/jooq/impl/AbstractTable.java | 70 +++++++ .../main/java/org/jooq/impl/SelectImpl.java | 79 +++++++- .../main/java/org/jooq/impl/UpdateImpl.java | 6 + 8 files changed, 498 insertions(+), 5 deletions(-) diff --git a/jOOQ-meta/src/main/java/org/jooq/util/postgres/PostgresDatabase.java b/jOOQ-meta/src/main/java/org/jooq/util/postgres/PostgresDatabase.java index d6538ffa70..f17cbd1588 100644 --- a/jOOQ-meta/src/main/java/org/jooq/util/postgres/PostgresDatabase.java +++ b/jOOQ-meta/src/main/java/org/jooq/util/postgres/PostgresDatabase.java @@ -50,7 +50,6 @@ import static org.jooq.impl.DSL.max; import static org.jooq.impl.DSL.name; import static org.jooq.impl.DSL.select; import static org.jooq.impl.DSL.selectOne; -import static org.jooq.impl.DSL.table; import static org.jooq.impl.DSL.upper; import static org.jooq.impl.DSL.val; import static org.jooq.util.postgres.PostgresDSL.arrayAppend; @@ -499,7 +498,7 @@ public class PostgresDatabase extends AbstractDatabase { .when(c.CONSRC.isNull(), src) .otherwise(arrayAppend(src, c.CONSRC)) ) - .from(table(name("domains"))) + .from(name("domains")) .join(d) .on(field(name("domains", d.TYPBASETYPE.getName())).eq(oid(d))) .leftJoin(c) @@ -514,7 +513,7 @@ public class PostgresDatabase extends AbstractDatabase { b.TYPLEN, src) .from(d) - .join(table(name("domains"))) + .join(name("domains")) .on(field(name("domains", "typbasetype")).eq(0)) .and(field(name("domains", "domain_id")).eq(oid(d))) .join(b) diff --git a/jOOQ/src/main/java/org/jooq/SelectFromStep.java b/jOOQ/src/main/java/org/jooq/SelectFromStep.java index 1af67047ea..e5c1c74272 100644 --- a/jOOQ/src/main/java/org/jooq/SelectFromStep.java +++ b/jOOQ/src/main/java/org/jooq/SelectFromStep.java @@ -166,6 +166,14 @@ public interface SelectFromStep extends SelectWhereStep { @PlainSQL SelectJoinStep from(String sql, QueryPart... parts); + /** + * Add a FROM clause to the query. + * + * @see DSL#table(Name) + */ + @Support + SelectJoinStep from(Name name); + /** * Add an Oracle-style hint to the preceding select clause. *

diff --git a/jOOQ/src/main/java/org/jooq/SelectJoinStep.java b/jOOQ/src/main/java/org/jooq/SelectJoinStep.java index d41f75ded2..d2018afd53 100644 --- a/jOOQ/src/main/java/org/jooq/SelectJoinStep.java +++ b/jOOQ/src/main/java/org/jooq/SelectJoinStep.java @@ -213,6 +213,21 @@ public interface SelectJoinStep extends SelectWhereStep { @PlainSQL SelectOnStep join(String sql, QueryPart... parts); + /** + * Convenience method to INNER JOIN a table to the last table + * added to the FROM clause using + * {@link Table#join(Name)}. + *

+ * A synonym for {@link #innerJoin(Name)}. + * + * @see DSL#table(Name) + * @see Table#join(Name) + * @see #innerJoin(Name) + */ + @Support + @PlainSQL + SelectOnStep join(Name name); + /** * Convenience method to INNER JOIN a table to the last table * added to the FROM clause using {@link Table#join(TableLike)}. @@ -292,6 +307,17 @@ public interface SelectJoinStep extends SelectWhereStep { @PlainSQL SelectOnStep innerJoin(String sql, QueryPart... parts); + /** + * Convenience method to INNER JOIN a table to the last table + * added to the FROM clause using + * {@link Table#join(Name)}. + * + * @see DSL#table(Name) + * @see Table#innerJoin(Name) + */ + @Support + SelectOnStep innerJoin(Name name); + /** * Convenience method to CROSS JOIN a table to the last table * added to the FROM clause using @@ -409,6 +435,24 @@ public interface SelectJoinStep extends SelectWhereStep { @PlainSQL SelectJoinStep crossJoin(String sql, QueryPart... parts); + /** + * Convenience method to CROSS JOIN a table to the last table + * added to the FROM clause using + * {@link Table#crossJoin(Name)} + *

+ * If this syntax is unavailable, it is emulated with a regular + * INNER JOIN. The following two constructs are equivalent: + *

+     * A cross join B
+     * A join B on 1 = 1
+     * 
+ * + * @see DSL#table(Name) + * @see Table#crossJoin(Name) + */ + @Support({ CUBRID, DERBY, FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE }) + SelectJoinStep crossJoin(Name name); + /** * Convenience method to LEFT OUTER JOIN a table to the last * table added to the FROM clause using @@ -506,6 +550,20 @@ public interface SelectJoinStep extends SelectWhereStep { @PlainSQL SelectJoinPartitionByStep leftJoin(String sql, QueryPart... parts); + /** + * Convenience method to LEFT OUTER JOIN a table to the last + * table added to the FROM clause using + * {@link Table#leftOuterJoin(Name)}. + *

+ * A synonym for {@link #leftOuterJoin(Name)}. + * + * @see DSL#table(Name) + * @see Table#leftOuterJoin(Name) + * @see #leftOuterJoin(Name) + */ + @Support + SelectJoinPartitionByStep leftJoin(Name name); + /** * Convenience method to LEFT OUTER JOIN a table to the last * table added to the FROM clause using @@ -588,6 +646,17 @@ public interface SelectJoinStep extends SelectWhereStep { @PlainSQL SelectJoinPartitionByStep leftOuterJoin(String sql, QueryPart... parts); + /** + * Convenience method to LEFT OUTER JOIN a table to the last + * table added to the FROM clause using + * {@link Table#leftOuterJoin(Name)} + * + * @see DSL#table(Name) + * @see Table#leftOuterJoin(Name) + */ + @Support + SelectJoinPartitionByStep leftOuterJoin(Name name); + /** * Convenience method to RIGHT OUTER JOIN a table to the last * table added to the FROM clause using @@ -695,6 +764,22 @@ public interface SelectJoinStep extends SelectWhereStep { @PlainSQL SelectJoinPartitionByStep rightJoin(String sql, QueryPart... parts); + /** + * Convenience method to RIGHT OUTER JOIN a table to the last + * table added to the FROM clause using + * {@link Table#rightOuterJoin(Name)}. + *

+ * A synonym for {@link #rightOuterJoin(Name)}. + *

+ * This is only possible where the underlying RDBMS supports it + * + * @see DSL#table(Name) + * @see Table#rightOuterJoin(Name) + * @see #rightOuterJoin(Name) + */ + @Support({ CUBRID, DERBY, FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES }) + SelectJoinPartitionByStep rightJoin(Name name); + /** * Convenience method to RIGHT OUTER JOIN a table to the last * table added to the FROM clause using @@ -787,6 +872,19 @@ public interface SelectJoinStep extends SelectWhereStep { @PlainSQL SelectJoinPartitionByStep rightOuterJoin(String sql, QueryPart... parts); + /** + * Convenience method to RIGHT OUTER JOIN a table to the last + * table added to the FROM clause using + * {@link Table#rightOuterJoin(Name)} + *

+ * This is only possible where the underlying RDBMS supports it + * + * @see DSL#table(Name) + * @see Table#rightOuterJoin(Name) + */ + @Support({ CUBRID, DERBY, FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES }) + SelectJoinPartitionByStep rightOuterJoin(Name name); + /** * Convenience method to FULL OUTER JOIN a table to the last * table added to the FROM clause using @@ -879,6 +977,19 @@ public interface SelectJoinStep extends SelectWhereStep { @PlainSQL SelectOnStep fullOuterJoin(String sql, QueryPart... parts); + /** + * Convenience method to FULL OUTER JOIN a tableto the last + * table added to the FROM clause using + * {@link Table#fullOuterJoin(Name)} + *

+ * This is only possible where the underlying RDBMS supports it + * + * @see DSL#table(Name) + * @see Table#fullOuterJoin(Name) + */ + @Support({ FIREBIRD, HSQLDB, POSTGRES }) + SelectOnStep fullOuterJoin(Name name); + /** * Convenience method to NATURAL JOIN a table to the last table * added to the FROM clause using @@ -976,6 +1087,20 @@ public interface SelectJoinStep extends SelectWhereStep { @PlainSQL SelectJoinStep naturalJoin(String sql, QueryPart... parts); + /** + * Convenience method to NATURAL JOIN a table to the last table + * added to the FROM clause using + * {@link Table#naturalJoin(Name)} + *

+ * Natural joins are supported by most RDBMS. If they aren't supported, they + * are emulated if jOOQ has enough information. + * + * @see DSL#table(Name) + * @see Table#naturalJoin(Name) + */ + @Support + SelectJoinStep naturalJoin(Name name); + /** * Convenience method to NATURAL LEFT OUTER JOIN a table to the * last table added to the FROM clause using @@ -1073,6 +1198,20 @@ public interface SelectJoinStep extends SelectWhereStep { @PlainSQL SelectJoinStep naturalLeftOuterJoin(String sql, QueryPart... parts); + /** + * Convenience method to NATURAL LEFT OUTER JOIN a table to the + * last table added to the FROM clause using + * {@link Table#naturalLeftOuterJoin(Name)} + *

+ * Natural joins are supported by most RDBMS. If they aren't supported, they + * are emulated if jOOQ has enough information. + * + * @see DSL#table(Name) + * @see Table#naturalLeftOuterJoin(Name) + */ + @Support + SelectJoinStep naturalLeftOuterJoin(Name name); + /** * Convenience method to NATURAL RIGHT OUTER JOIN a table to * the last table added to the FROM clause using @@ -1170,6 +1309,20 @@ public interface SelectJoinStep extends SelectWhereStep { @PlainSQL SelectJoinStep naturalRightOuterJoin(String sql, QueryPart... parts); + /** + * Convenience method to NATURAL RIGHT OUTER JOIN a table to + * the last table added to the FROM clause using + * {@link Table#naturalRightOuterJoin(Name)} + *

+ * Natural joins are supported by most RDBMS. If they aren't supported, they + * are emulated if jOOQ has enough information. + * + * @see DSL#table(Name) + * @see Table#naturalRightOuterJoin(Name) + */ + @Support({ CUBRID, DERBY, FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES }) + SelectJoinStep naturalRightOuterJoin(Name name); + // ------------------------------------------------------------------------- // XXX: SEMI and ANTI JOIN // ------------------------------------------------------------------------- @@ -1296,6 +1449,15 @@ public interface SelectJoinStep extends SelectWhereStep { @PlainSQL SelectJoinStep crossApply(String sql, QueryPart... parts); + /** + * CROSS APPLY a table to this table. + * + * @see DSL#table(Name) + * @see Table#crossApply(Name) + */ + @Support({ POSTGRES_9_3 }) + SelectJoinStep crossApply(Name name); + /** * OUTER APPLY a table to this table. * @@ -1368,6 +1530,15 @@ public interface SelectJoinStep extends SelectWhereStep { @PlainSQL SelectJoinStep outerApply(String sql, QueryPart... parts); + /** + * OUTER APPLY a table to this table. + * + * @see DSL#table(Name) + * @see Table#outerApply(Name) + */ + @Support({ POSTGRES_9_3 }) + SelectJoinStep outerApply(Name name); + /** * STRAIGHT_JOIN a table to this table. * @@ -1403,4 +1574,13 @@ public interface SelectJoinStep extends SelectWhereStep { */ @Support({ MYSQL }) SelectOnStep straightJoin(String sql, QueryPart... parts); + + /** + * STRAIGHT_JOIN a table to this table. + * + * @see DSL#table(Name) + * @see Table#straightJoin(Name) + */ + @Support({ MYSQL }) + SelectOnStep straightJoin(Name name); } diff --git a/jOOQ/src/main/java/org/jooq/Table.java b/jOOQ/src/main/java/org/jooq/Table.java index 8749dfef1e..443ba00a8e 100644 --- a/jOOQ/src/main/java/org/jooq/Table.java +++ b/jOOQ/src/main/java/org/jooq/Table.java @@ -431,6 +431,18 @@ public interface Table extends TableLike { @PlainSQL TableOnStep join(String sql, QueryPart... parts); + /** + * INNER JOIN a table to this table. + *

+ * A synonym for {@link #innerJoin(Name)}. + * + * @see DSL#table(Name) + * @see #innerJoin(Name) + */ + @Support + @PlainSQL + TableOnStep join(Name name); + /** * INNER JOIN a table to this table. */ @@ -497,6 +509,14 @@ public interface Table extends TableLike { @PlainSQL TableOnStep innerJoin(String sql, QueryPart... parts); + /** + * INNER JOIN a table to this table. + * + * @see DSL#table(Name) + */ + @Support + TableOnStep innerJoin(Name name); + /** * LEFT OUTER JOIN a table to this table. *

@@ -579,6 +599,17 @@ public interface Table extends TableLike { @PlainSQL TablePartitionByStep leftJoin(String sql, QueryPart... parts); + /** + * LEFT OUTER JOIN a table to this table. + *

+ * A synonym for {@link #leftOuterJoin(Name)}. + * + * @see DSL#table(Name) + * @see #leftOuterJoin(Name) + */ + @Support + TablePartitionByStep leftJoin(Name name); + /** * LEFT OUTER JOIN a table to this table. */ @@ -645,6 +676,15 @@ public interface Table extends TableLike { @PlainSQL TablePartitionByStep leftOuterJoin(String sql, QueryPart... parts); + /** + * LEFT OUTER JOIN a table to this table. + * + * @see DSL#table(Name) + * @see SQL + */ + @Support + TablePartitionByStep leftOuterJoin(Name name); + /** * RIGHT OUTER JOIN a table to this table. *

@@ -737,6 +777,19 @@ public interface Table extends TableLike { @PlainSQL TablePartitionByStep rightJoin(String sql, QueryPart... parts); + /** + * RIGHT OUTER JOIN a table to this table. + *

+ * A synonym for {@link #rightOuterJoin(Name)}. + *

+ * This is only possible where the underlying RDBMS supports it + * + * @see DSL#table(Name) + * @see #rightOuterJoin(Name) + */ + @Support({ CUBRID, DERBY, FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES }) + TablePartitionByStep rightJoin(Name name); + /** * RIGHT OUTER JOIN a table to this table. *

@@ -813,6 +866,16 @@ public interface Table extends TableLike { @PlainSQL TablePartitionByStep rightOuterJoin(String sql, QueryPart... parts); + /** + * RIGHT OUTER JOIN a table to this table. + *

+ * This is only possible where the underlying RDBMS supports it + * + * @see DSL#table(Name) + */ + @Support({ CUBRID, DERBY, FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES }) + TablePartitionByStep rightOuterJoin(Name name); + /** * FULL OUTER JOIN a table to this table. *

@@ -889,6 +952,16 @@ public interface Table extends TableLike { @PlainSQL TableOnStep fullOuterJoin(String sql, QueryPart... parts); + /** + * FULL OUTER JOIN a table to this table. + *

+ * This is only possible where the underlying RDBMS supports it + * + * @see DSL#table(Name) + */ + @Support({ FIREBIRD, HSQLDB, POSTGRES }) + TableOnStep fullOuterJoin(Name name); + /** * CROSS JOIN a table to this table. *

@@ -990,6 +1063,21 @@ public interface Table extends TableLike { @PlainSQL Table crossJoin(String sql, QueryPart... parts); + /** + * CROSS JOIN a table to this table. + *

+ * If this syntax is unavailable, it is emulated with a regular + * INNER JOIN. The following two constructs are equivalent: + *

+     * A cross join B
+     * A join B on 1 = 1
+     * 
+ * + * @see DSL#table(Name) + */ + @Support({ CUBRID, DERBY, FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE }) + Table crossJoin(Name name); + /** * NATURAL JOIN a table to this table. *

@@ -1053,6 +1141,17 @@ public interface Table extends TableLike { @PlainSQL Table naturalJoin(String sql, Object... bindings); + /** + * NATURAL JOIN a table to this table. + *

+ * If this is not supported by your RDBMS, then jOOQ will try to emulate + * this behaviour using the information provided in this query. + * + * @see DSL#table(Name) + */ + @Support + Table naturalJoin(Name name); + /** * NATURAL JOIN a table to this table. *

@@ -1152,6 +1251,18 @@ public interface Table extends TableLike { @PlainSQL Table naturalLeftOuterJoin(String sql, QueryPart... parts); + /** + * NATURAL LEFT OUTER JOIN a table to this table. + *

+ * If this is not supported by your RDBMS, then jOOQ will try to emulate + * this behaviour using the information provided in this query. + * + * @see DSL#table(Name) + */ + @Support + @PlainSQL + Table naturalLeftOuterJoin(Name name); + /** * NATURAL RIGHT OUTER JOIN a table to this table. *

@@ -1233,6 +1344,17 @@ public interface Table extends TableLike { @PlainSQL Table naturalRightOuterJoin(String sql, QueryPart... parts); + /** + * NATURAL RIGHT OUTER JOIN a table to this table. + *

+ * If this is not supported by your RDBMS, then jOOQ will try to emulate + * this behaviour using the information provided in this query. + * + * @see DSL#table(Name) + */ + @Support({ CUBRID, DERBY, FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES }) + Table naturalRightOuterJoin(Name name); + // ------------------------------------------------------------------------- // XXX: APPLY clauses on tables // ------------------------------------------------------------------------- @@ -1303,6 +1425,14 @@ public interface Table extends TableLike { @PlainSQL Table crossApply(String sql, QueryPart... parts); + /** + * CROSS APPLY a table to this table. + * + * @see DSL#table(Name) + */ + @Support({ POSTGRES_9_3 }) + Table crossApply(Name name); + /** * OUTER APPLY a table to this table. */ @@ -1369,6 +1499,14 @@ public interface Table extends TableLike { @PlainSQL Table outerApply(String sql, QueryPart... parts); + /** + * OUTER APPLY a table to this table. + * + * @see DSL#table(Name) + */ + @Support({ POSTGRES_9_3 }) + Table outerApply(Name name); + /** * STRAIGHT_JOIN a table to this table. */ @@ -1435,6 +1573,15 @@ public interface Table extends TableLike { @PlainSQL TableOnStep straightJoin(String sql, QueryPart... parts); + /** + * STRAIGHT_JOIN a table to this table. + * + * @see DSL#table(Name) + */ + @Support({ MYSQL }) + @PlainSQL + TableOnStep straightJoin(Name name); + // ------------------------------------------------------------------------- // XXX: Exotic and vendor-specific clauses on tables // ------------------------------------------------------------------------- diff --git a/jOOQ/src/main/java/org/jooq/UpdateFromStep.java b/jOOQ/src/main/java/org/jooq/UpdateFromStep.java index 421586b1bb..d5e6a5e588 100644 --- a/jOOQ/src/main/java/org/jooq/UpdateFromStep.java +++ b/jOOQ/src/main/java/org/jooq/UpdateFromStep.java @@ -144,4 +144,12 @@ public interface UpdateFromStep extends UpdateWhereStep { @Support({ POSTGRES }) @PlainSQL UpdateWhereStep from(String sql, QueryPart... parts); + + /** + * Add a FROM clause to the query. + * + * @see DSL#table(Name) + */ + @Support({ POSTGRES }) + UpdateWhereStep from(Name name); } diff --git a/jOOQ/src/main/java/org/jooq/impl/AbstractTable.java b/jOOQ/src/main/java/org/jooq/impl/AbstractTable.java index a1b50571b4..ecae487e04 100644 --- a/jOOQ/src/main/java/org/jooq/impl/AbstractTable.java +++ b/jOOQ/src/main/java/org/jooq/impl/AbstractTable.java @@ -708,6 +708,11 @@ abstract class AbstractTable extends AbstractQueryPart impleme return innerJoin(sql, parts); } + @Override + public final TableOnStep join(Name name) { + return innerJoin(table(name)); + } + @Override public final TableOnStep innerJoin(TableLike table) { return join(table, JOIN); @@ -733,6 +738,11 @@ abstract class AbstractTable extends AbstractQueryPart impleme return innerJoin(table(sql, parts)); } + @Override + public final TableOnStep innerJoin(Name name) { + return innerJoin(table(name)); + } + @Override public final TablePartitionByStep leftJoin(TableLike table) { return leftOuterJoin(table); @@ -758,6 +768,11 @@ abstract class AbstractTable extends AbstractQueryPart impleme return leftOuterJoin(sql, parts); } + @Override + public final TablePartitionByStep leftJoin(Name name) { + return leftOuterJoin(table(name)); + } + @Override public final TablePartitionByStep leftOuterJoin(TableLike table) { return join(table, LEFT_OUTER_JOIN); @@ -783,6 +798,11 @@ abstract class AbstractTable extends AbstractQueryPart impleme return leftOuterJoin(table(sql, parts)); } + @Override + public final TablePartitionByStep leftOuterJoin(Name name) { + return leftOuterJoin(table(name)); + } + @Override public final TablePartitionByStep rightJoin(TableLike table) { return rightOuterJoin(table); @@ -808,6 +828,11 @@ abstract class AbstractTable extends AbstractQueryPart impleme return rightOuterJoin(sql, parts); } + @Override + public final TablePartitionByStep rightJoin(Name name) { + return rightOuterJoin(table(name)); + } + @Override public final TablePartitionByStep rightOuterJoin(TableLike table) { return join(table, RIGHT_OUTER_JOIN); @@ -833,6 +858,11 @@ abstract class AbstractTable extends AbstractQueryPart impleme return rightOuterJoin(table(sql, parts)); } + @Override + public final TablePartitionByStep rightOuterJoin(Name name) { + return rightOuterJoin(table(name)); + } + @Override public final TableOnStep fullOuterJoin(TableLike table) { return join(table, FULL_OUTER_JOIN); @@ -858,6 +888,11 @@ abstract class AbstractTable extends AbstractQueryPart impleme return fullOuterJoin(table(sql, parts)); } + @Override + public final TableOnStep fullOuterJoin(Name name) { + return fullOuterJoin(table(name)); + } + @Override public final Table crossJoin(TableLike table) { return join(table, CROSS_JOIN); @@ -883,6 +918,11 @@ abstract class AbstractTable extends AbstractQueryPart impleme return crossJoin(table(sql, parts)); } + @Override + public final Table crossJoin(Name name) { + return crossJoin(table(name)); + } + @Override public final Table naturalJoin(TableLike table) { return join(table, NATURAL_JOIN); @@ -908,6 +948,11 @@ abstract class AbstractTable extends AbstractQueryPart impleme return naturalJoin(table(sql, parts)); } + @Override + public final Table naturalJoin(Name name) { + return naturalJoin(table(name)); + } + @Override public final Table naturalLeftOuterJoin(TableLike table) { return join(table, NATURAL_LEFT_OUTER_JOIN); @@ -933,6 +978,11 @@ abstract class AbstractTable extends AbstractQueryPart impleme return naturalLeftOuterJoin(table(sql, parts)); } + @Override + public final Table naturalLeftOuterJoin(Name name) { + return naturalLeftOuterJoin(table(name)); + } + @Override public final Table naturalRightOuterJoin(TableLike table) { return join(table, NATURAL_RIGHT_OUTER_JOIN); @@ -958,6 +1008,11 @@ abstract class AbstractTable extends AbstractQueryPart impleme return naturalRightOuterJoin(table(sql, parts)); } + @Override + public final Table naturalRightOuterJoin(Name name) { + return naturalRightOuterJoin(table(name)); + } + @Override public final Table crossApply(TableLike table) { return join(table, CROSS_APPLY); @@ -983,6 +1038,11 @@ abstract class AbstractTable extends AbstractQueryPart impleme return crossApply(table(sql, parts)); } + @Override + public final Table crossApply(Name name) { + return crossApply(table(name)); + } + @Override public final Table outerApply(TableLike table) { return join(table, OUTER_APPLY); @@ -1008,6 +1068,11 @@ abstract class AbstractTable extends AbstractQueryPart impleme return outerApply(table(sql, parts)); } + @Override + public final Table outerApply(Name name) { + return outerApply(table(name)); + } + @Override public final TableOptionalOnStep straightJoin(TableLike table) { return join(table, STRAIGHT_JOIN); @@ -1033,6 +1098,11 @@ abstract class AbstractTable extends AbstractQueryPart impleme return straightJoin(table(sql, parts)); } + @Override + public final TableOptionalOnStep straightJoin(Name name) { + return straightJoin(table(name)); + } + // ------------------------------------------------------------------------ // XXX: Object API // ------------------------------------------------------------------------ diff --git a/jOOQ/src/main/java/org/jooq/impl/SelectImpl.java b/jOOQ/src/main/java/org/jooq/impl/SelectImpl.java index 3c02716663..7350da5cee 100644 --- a/jOOQ/src/main/java/org/jooq/impl/SelectImpl.java +++ b/jOOQ/src/main/java/org/jooq/impl/SelectImpl.java @@ -327,6 +327,11 @@ class SelectImpl from(Name name) { + return from(table(name)); + } + @Override public final SelectImpl where(Condition... conditions) { conditionStep = ConditionStep.WHERE; @@ -2149,7 +2154,7 @@ class SelectImpl fullOuterJoin(TableLike table) { + public final SelectImpl fullOuterJoin(TableLike table) { return join(table, JoinType.FULL_OUTER_JOIN); } @@ -2183,7 +2188,7 @@ class SelectImpl crossJoin(TableLike table) { + public final SelectImpl crossJoin(TableLike table) { return join(table, JoinType.CROSS_JOIN); } @@ -2247,6 +2252,11 @@ class SelectImpl fullOuterJoin(SQL sql) { return fullOuterJoin(table(sql)); @@ -2367,6 +2402,11 @@ class SelectImpl crossJoin(SQL sql) { return crossJoin(table(sql)); @@ -2387,6 +2427,11 @@ class SelectImpl maxRows(int rows) { return getDelegate().maxRows(rows); diff --git a/jOOQ/src/main/java/org/jooq/impl/UpdateImpl.java b/jOOQ/src/main/java/org/jooq/impl/UpdateImpl.java index 5efe8d2dc2..d968f103ed 100644 --- a/jOOQ/src/main/java/org/jooq/impl/UpdateImpl.java +++ b/jOOQ/src/main/java/org/jooq/impl/UpdateImpl.java @@ -54,6 +54,7 @@ import javax.annotation.Generated; import org.jooq.Condition; import org.jooq.Configuration; import org.jooq.Field; +import org.jooq.Name; import org.jooq.Operator; import org.jooq.QueryPart; import org.jooq.Record; @@ -531,6 +532,11 @@ final class UpdateImpl return from(table(sql, parts)); } + @Override + public final UpdateWhereStep from(Name name) { + return from(table(name)); + } + @Override public final UpdateImpl where(Condition... conditions) { getDelegate().addConditions(conditions);