[#1041] Add <R> Table<R> Factory.table(Select<R>) convenience method for more fluency
This commit is contained in:
parent
8a634efd5d
commit
45176b07cf
@ -2942,10 +2942,11 @@ public abstract class jOOQAbstractTest<
|
||||
return;
|
||||
}
|
||||
|
||||
Table<B> nested = create()
|
||||
Table<B> nested = table(create()
|
||||
.selectFrom(TBook())
|
||||
.orderBy(TBook_ID().desc())
|
||||
.limit(2).asTable("nested");
|
||||
.limit(2))
|
||||
.as("nested");
|
||||
|
||||
Field<Integer> nestedID = nested.getField(TBook_AUTHOR_ID());
|
||||
Record record = create().select(nestedID, count())
|
||||
@ -9297,12 +9298,11 @@ public abstract class jOOQAbstractTest<
|
||||
Field<Integer> lang = TBook_LANGUAGE_ID().cast(Integer.class).as("lang");
|
||||
Result<Record> result3 =
|
||||
create().select()
|
||||
.from(create().select(TBook_AUTHOR_ID(), lang)
|
||||
.from(TBook())
|
||||
.asTable()
|
||||
.pivot(count())
|
||||
.of(lang)
|
||||
.in(1, 2, 3, 4))
|
||||
.from(table(create().select(TBook_AUTHOR_ID(), lang)
|
||||
.from(TBook()))
|
||||
.pivot(count())
|
||||
.of(lang)
|
||||
.in(1, 2, 3, 4))
|
||||
.fetch();
|
||||
|
||||
assertEquals(2, result3.size());
|
||||
|
||||
@ -335,6 +335,16 @@ public class Factory implements FactoryOperations {
|
||||
// Conversion of objects into tables
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* A synonym for {@link Select#asTable()}. It might look a bit more fluent
|
||||
* like this, to some users
|
||||
*
|
||||
* @see Select#asTable()
|
||||
*/
|
||||
public static <R extends Record> Table<R> table(Select<R> select) {
|
||||
return select.asTable();
|
||||
}
|
||||
|
||||
/**
|
||||
* A synonym for {@link #unnest(List)}
|
||||
*
|
||||
|
||||
Loading…
Reference in New Issue
Block a user