[#7115] Allow usage of derived table as aliased parameter of TableImpl constructor

This commit is contained in:
lukaseder 2018-02-02 16:00:56 +01:00
parent 82a0c85bb9
commit b617440628
3 changed files with 9 additions and 4 deletions

View File

@ -51,6 +51,7 @@ Authors and contributors of jOOQ or parts of jOOQ in alphabetical order:
- Timur Shaidullin
- Thomas Darimont
- Tsukasa Kitachi
- Victor Bronstein
- Victor Z. Peng
- Vladimir Kulev
- Vladimir Vinogradov

View File

@ -154,12 +154,15 @@ public class TableImpl<R extends Record> extends AbstractTable<R> {
this.fields = new Fields<R>();
if (aliased != null) {
// [#7115] Allow for aliased expressions (e.g. derived tables) to be passed to TableImpl
// in order to support "type safe views"
Alias<Table<R>> existingAlias = Tools.alias(aliased);
if (existingAlias != null) {
alias = existingAlias;
} else {
if (existingAlias != null)
alias = new Alias<Table<R>>(existingAlias.wrapped, name, existingAlias.fieldAliases, existingAlias.wrapInParentheses);
else
alias = new Alias<Table<R>>(aliased, name);
}
}
else
alias = null;

View File

@ -51,6 +51,7 @@ Authors and contributors of jOOQ or parts of jOOQ in alphabetical order:
- Timur Shaidullin
- Thomas Darimont
- Tsukasa Kitachi
- Victor Bronstein
- Victor Z. Peng
- Vladimir Kulev
- Vladimir Vinogradov