Top Description Fields Constructors Methods
org.jooq.impl

pack-priv final Class AliasedSelect<R extends org.jooq.Record>

extends AbstractTable<R extends Record>
implements UTransient
Class Inheritance
All Implemented Interfaces
org.jooq.impl.QOM.UTransient, org.jooq.impl.QOM.UEmpty, org.jooq.QueryPart, java.io.Serializable
Static Imports
org.jooq.SQLDialect.DERBY, org.jooq.impl.DSL.selectFrom, .Names.NQ_SELECT, .SubqueryCharacteristics.DERIVED_TABLE, .Tools.selectQueryImpl, .Tools.visitSubquery, .Tools.BooleanDataKey.DATA_FORCE_LIMIT_WITH_ORDER_BY, .Tools.SimpleDataKey.DATA_SELECT_ALIASES

A Select query that re-aliases its projection, or produces a derived table if re-aliasing is not possible (e.g. in the presence of ORDER BY).
Author
Lukas Eder

Field Summary

Modifier and TypeField and Description
private final Name[]
private final boolean
private final boolean
private final Select<R>
private final boolean

Constructor Summary

AccessConstructor and Description
pack-priv
AliasedSelect(Select<R> query, boolean subquery, boolean ignoreOrderBy, boolean forceLimit)

pack-priv
AliasedSelect(Select<R> query, boolean subquery, boolean ignoreOrderBy, boolean forceLimit, Name... aliases)

Method Summary

Modifier and TypeMethod and Description
public final void
accept(Context<?> ctx)

Implements org.jooq.QueryPartInternal.accept.

This QueryPart can accept a Context object in order to render a SQL string or to bind its variables.
private final void
accept0(Context<?> ctx)

public final Table<R>
as(Name
The alias name
alias
)

Overrides org.jooq.impl.AbstractTable.as.

Implements org.jooq.Table.as.

Create an alias for this table.
public final Table<R>
as(Name
The alias name
alias
,
Name...
The field aliases. Excess aliases are ignored, missing aliases will be substituted by this table's field names.
fieldAliases
)

Overrides org.jooq.impl.AbstractTable.as.

Implements org.jooq.Table.as.

Create an alias for this table and its fields.
pack-priv static final boolean
avoidAliasPushdown(Context<?> ctx, Select<?> query)

public final Clause[]
clauses(Context<?> ctx)

Overrides org.jooq.impl.AbstractTable.clauses.

Implements org.jooq.QueryPartInternal.clauses.

Deprecated as a consequence of Clause being deprecated.
The Clauses that are represented by this query part.
pack-priv final FieldsImpl<R>
fields0()

Implements abstract org.jooq.impl.AbstractTable.fields0.

Subclasses should override this method to provide the set of fields contained in the concrete table implementation.
public final Class<? extends R>
getRecordType()

Implements org.jooq.RecordQualifier.getRecordType.

The record type produced by this UDT or Table.
pack-priv final Select<R>
Inherited from org.jooq.impl.AbstractTable:
$alias$aliased$dataType$schemaasasasasasasasasasasasasasasasMultisetasMultisetasMultisetasMultisetasTableasTableasTableasTableasTableasTableasTableasTableasTableasTableasTableasTableasteriskconvertconvertconvertconvertFromconvertFromconvertToconvertTocreateFieldcreateFieldcreateFieldcreateFieldcreateFieldcreateFieldcreateFieldcreateFieldcreateFieldcreateFieldcreateFieldcreateFieldcreateFieldcreateFieldcreateFieldcreateFieldcreateFieldcreateFieldcreateFieldcreateFieldcreateFieldcreateFieldcreateFieldcreateFieldcreateField0createField0createField0createField0crossApplycrossApplycrossApplycrossApplycrossApplycrossApplycrossJoincrossJoincrossJoincrossJoincrossJoincrossJoindivideByeqequalfieldsfieldsRowforceIndexforceIndexForGroupByforceIndexForJoinforceIndexForOrderByfromfullJoinfullJoinfullJoinfullJoinfullJoinfullJoinfullOuterJoinfullOuterJoinfullOuterJoinfullOuterJoinfullOuterJoinfullOuterJoingetBindinggetCataloggetChecksgetConvertergetDataTypegetDataTypegetIdentitygetIndexesgetKeysgetOptionsgetPackagegetPrimaryKeygetRecordTimestampgetRecordVersiongetReferencesgetReferencesFromgetReferencesTogetSchemagetTableTypegetTypegetUniqueKeysignoreIndexignoreIndexForGroupByignoreIndexForJoinignoreIndexForOrderByinnerJoininnerJoininnerJoininnerJoininnerJoininnerJoinjoinjoinjoinjoinjoinjoinjoinleftAntiJoinleftJoinleftJoinleftJoinleftJoinleftJoinleftJoinleftOuterJoinleftOuterJoinleftOuterJoinleftOuterJoinleftOuterJoinleftOuterJoinleftSemiJoinnaturalFullOuterJoinnaturalFullOuterJoinnaturalFullOuterJoinnaturalFullOuterJoinnaturalFullOuterJoinnaturalFullOuterJoinnaturalJoinnaturalJoinnaturalJoinnaturalJoinnaturalJoinnaturalJoinnaturalLeftOuterJoinnaturalLeftOuterJoinnaturalLeftOuterJoinnaturalLeftOuterJoinnaturalLeftOuterJoinnaturalLeftOuterJoinnaturalRightOuterJoinnaturalRightOuterJoinnaturalRightOuterJoinnaturalRightOuterJoinnaturalRightOuterJoinnaturalRightOuterJoinnenewRecordnotEqualouterApplyouterApplyouterApplyouterApplyouterApplyouterApplyrecordTyperightJoinrightJoinrightJoinrightJoinrightJoinrightJoinrightOuterJoinrightOuterJoinrightOuterJoinrightOuterJoinrightOuterJoinrightOuterJoinrowidstraightJoinstraightJoinstraightJoinstraightJoinstraightJoinstraightJointfuseIndexuseIndexForGroupByuseIndexForJoinuseIndexForOrderBywherewherewherewherewherewherewherewherewhereExistswhereNotExistswithOrdinality

Field Detail

aliasesback to summary
private final Name[] aliases
forceLimitback to summary
private final boolean forceLimit
ignoreOrderByback to summary
private final boolean ignoreOrderBy
queryback to summary
private final Select<R> query
subqueryback to summary
private final boolean subquery

Constructor Detail

AliasedSelectback to summary
pack-priv AliasedSelect(Select<R> query, boolean subquery, boolean ignoreOrderBy, boolean forceLimit)
AliasedSelectback to summary
pack-priv AliasedSelect(Select<R> query, boolean subquery, boolean ignoreOrderBy, boolean forceLimit, Name... aliases)

Method Detail

acceptback to summary
public final void accept(Context<?> ctx)

Implements org.jooq.QueryPartInternal.accept.

Doc from org.jooq.QueryPartInternal.accept.

This QueryPart can accept a Context object in order to render a SQL string or to bind its variables.

Annotations
@Override
accept0back to summary
private final void accept0(Context<?> ctx)
asback to summary
public final Table<R> as(Name alias)

Overrides org.jooq.impl.AbstractTable.as.

Implements org.jooq.Table.as.

Doc from org.jooq.Table.as.

Create an alias for this table.

Note that the case-sensitivity of the returned table depends on Settings#getRenderQuotedNames() and the Name. By default, table aliases are quoted, and thus case-sensitive in many SQL dialects - use DSL#unquotedName(String...) for case-insensitive aliases.

If the argument Name#getName() is qualified, then the Name#last() part will be used.

This method works both to alias the table as well as alias the table in its SelectField form via the SelectField#as(String) override. In order to alias only the projected table expression, use DSL#field(SelectField) to wrap this table into a Field

Parameters
alias:Name

The alias name

Returns:Table<R>

The table alias

Annotations
@Override
asback to summary
public final Table<R> as(Name alias, Name... fieldAliases)

Overrides org.jooq.impl.AbstractTable.as.

Implements org.jooq.Table.as.

Doc from org.jooq.Table.as.

Create an alias for this table and its fields.

Note that the case-sensitivity of the returned table depends on Settings#getRenderQuotedNames() and the Name. By default, table aliases are quoted, and thus case-sensitive in many SQL dialects - use DSL#unquotedName(String...) for case-insensitive aliases.

If the argument Name#getName() is qualified, then the Name#last() part will be used.

Derived column lists for table references

Note, not all databases support derived column lists for their table aliases. On the other hand, some databases do support derived column lists, but only for derived tables. jOOQ will try to turn table references into derived tables to make this syntax work. In other words, the following statements are equivalent:


-- Using derived column lists to rename columns (e.g. Postgres)
SELECT t.a, t.b
FROM my_table t(a, b)

-- Nesting table references within derived tables (e.g. SQL Server)
SELECT t.a, t.b
FROM (
  SELECT * FROM my_table
) t(a, b)

Derived column lists for derived tables

Other databases may not support derived column lists at all, but they do support common table expressions. The following statements are equivalent:


-- Using derived column lists to rename columns (e.g. Postgres)
SELECT t.a, t.b
FROM (
  SELECT 1, 2
) AS t(a, b)

-- Using UNION ALL to produce column names (e.g. MySQL)
SELECT t.a, t.b
FROM (
  SELECT null a, null b FROM DUAL WHERE 1 = 0
  UNION ALL
  SELECT 1, 2 FROM DUAL
) t
Parameters
alias:Name

The alias name

fieldAliases:Name[]

The field aliases. Excess aliases are ignored, missing aliases will be substituted by this table's field names.

Returns:Table<R>

The table alias

Annotations
@Override
avoidAliasPushdownback to summary
pack-priv static final boolean avoidAliasPushdown(Context<?> ctx, Select<?> query)
clausesback to summary
public final Clause[] clauses(Context<?> ctx)

Overrides org.jooq.impl.AbstractTable.clauses.

Implements org.jooq.QueryPartInternal.clauses.

Doc from org.jooq.QueryPartInternal.clauses.

Deprecated

as a consequence of Clause being deprecated. See corresponding docs for further information.

The Clauses that are represented by this query part.

QueryParts can specify several Clauses for which an event will be emitted before (in forward order) and after (in reverse order) visiting the the query part through Context#visit(QueryPart)

This method is for JOOQ INTERNAL USE only. Do not reference directly

Returns:Clause[]

The Clauses represented by this query part or null or an empty array if this query part does not represent a clause.

Annotations
@Override
fields0back to summary
pack-priv final FieldsImpl<R> fields0()

Implements abstract org.jooq.impl.AbstractTable.fields0.

Doc from org.jooq.impl.AbstractTable.fields0.

Subclasses should override this method to provide the set of fields contained in the concrete table implementation. For example, a TableAlias contains aliased fields of its AliasProvider table.

Annotations
@Override
getRecordTypeback to summary
public final Class<? extends R> getRecordType()

Implements org.jooq.RecordQualifier.getRecordType.

Doc from org.jooq.RecordQualifier.getRecordType.

The record type produced by this UDT or Table.

Annotations
@Override
queryback to summary
pack-priv final Select<R> query()