@Immutable public class SetQuery extends Object implements QueryCommand, SetQuery
queries
, such as performing UNION, INTERSECT, and EXCEPT
operations.
The two queries
are expected to have the same number and order of columns, and the corresponding columns
types must be compatible.
Modifier and Type | Class and Description |
---|---|
static class |
SetQuery.Operation |
Constructor and Description |
---|
SetQuery(QueryCommand left,
SetQuery.Operation operation,
QueryCommand right,
boolean all)
Create a set query involving the supplied left- and right-hand-side queries.
|
SetQuery(QueryCommand left,
SetQuery.Operation operation,
QueryCommand right,
boolean all,
List<? extends Ordering> orderings,
Limit limit)
Create a set query involving the supplied left- and right-hand-side queries.
|
Modifier and Type | Method and Description |
---|---|
void |
accept(Visitor visitor)
Accept the supplied visitor, which should call back to the visitor to complete the double-dispatch operation.
|
SetQuery |
adding(Ordering... orderings) |
List<? extends Column> |
columns()
Return the columns defining the query results.
|
boolean |
equals(Object obj) |
Column[] |
getColumns()
Gets the columns for this query.
|
QueryCommand |
getLeft()
Get the left-hand query.
|
Limit |
getLimits()
Get the limits associated with this query.
|
String |
getOperation()
Get the set operation for this query.
|
Ordering[] |
getOrderings()
Gets the orderings for this query.
|
QueryCommand |
getRight()
Get the right-hand query.
|
int |
hashCode() |
boolean |
isAll()
Return whether this set query is a 'UNION ALL' or 'INTERSECT ALL' or 'EXCEPT ALL' query.
|
SetQuery.Operation |
operation()
Get the set operation for this query.
|
List<? extends Ordering> |
orderings()
Return the orderings for this query.
|
String |
toString() |
protected static boolean |
unionableColumns(List<? extends Column> left,
List<? extends Column> right) |
SetQuery |
withLimit(int rowLimit)
Create a copy of this query, but one that uses the supplied limit on the number of result rows.
|
SetQuery |
withOffset(int offset)
Create a copy of this query, but one that uses the supplied offset.
|
public SetQuery(QueryCommand left, SetQuery.Operation operation, QueryCommand right, boolean all)
left
- the left-hand-side query being combinedoperation
- the set operationright
- the right-hand-side query being combinedall
- true if all of the results should be includedIllegalArgumentException
- if the left-hand-side query, right-hand-side query, or operation are nullpublic SetQuery(QueryCommand left, SetQuery.Operation operation, QueryCommand right, boolean all, List<? extends Ordering> orderings, Limit limit)
left
- the left-hand-side query being combinedoperation
- the set operationright
- the right-hand-side query being combinedall
- true if all of the results should be includedorderings
- the specification of the order of the result rows, or null if the results need not be orderedlimit
- the limit for the result rows, or null if there are no limitsIllegalArgumentException
- if the left-hand-side query, right-hand-side query, or operation are nullprotected static boolean unionableColumns(List<? extends Column> left, List<? extends Column> right)
public List<? extends Column> columns()
QueryCommand
public Limit getLimits()
QueryCommand
getLimits
in interface QueryCommand
unlimited
public List<? extends Ordering> orderings()
QueryCommand
public QueryCommand getLeft()
SetQuery
public QueryCommand getRight()
SetQuery
public final SetQuery.Operation operation()
public String getOperation()
SetQuery
getOperation
in interface SetQuery
public final boolean isAll()
SetQuery
public Ordering[] getOrderings()
QueryCommand
getOrderings
in interface QueryCommand
public Column[] getColumns()
QueryCommand
getColumns
in interface QueryCommand
public void accept(Visitor visitor)
Visitable
public SetQuery withLimit(int rowLimit)
QueryCommand
rowLimit
- the limit that should be used; must be a positive numberpublic SetQuery withOffset(int offset)
QueryCommand
offset
- the limit that should be used; may not be negativeCopyright © 2008–2016 JBoss, a division of Red Hat. All rights reserved.