public class LogicalUnion extends Object implements Union
| Modifier and Type | Class and Description |
|---|---|
static interface |
LogicalUnion.Selector
A callback used to create the selects in a SQL union.
|
class |
LogicalUnion.UnionSelect
A select that is part of a logical union.
|
| Modifier and Type | Field and Description |
|---|---|
protected BitSet |
desc |
protected DBDictionary |
dict |
protected ClassMapping[] |
mappings |
protected LogicalUnion.UnionSelect[] |
sels |
| Modifier | Constructor and Description |
|---|---|
|
LogicalUnion(JDBCConfiguration conf,
int sels)
Constructor.
|
protected |
LogicalUnion(JDBCConfiguration conf,
int sels,
Select[] seeds)
Delegate constructor.
|
|
LogicalUnion(JDBCConfiguration conf,
Select[] seeds)
Constructor used to seed the internal selects.
|
| Modifier and Type | Method and Description |
|---|---|
void |
abortUnion()
Force the use of a series of standard selects rather than a true UNION.
|
Result |
execute(JDBCStore store,
JDBCFetchConfiguration fetch)
Execute this select in the context of the given store manager.
|
Result |
execute(JDBCStore store,
JDBCFetchConfiguration fetch,
int lockLevel)
Execute this select in the context of the given store manager.
|
boolean |
getAutoDistinct()
Whether to automatically make results distinct when relational joins
would otherwise introduce duplicates.
|
JDBCConfiguration |
getConfiguration()
Return the select configuration.
|
int |
getCount(JDBCStore store)
Return the number of instances matching this select.
|
DBDictionary |
getDBDictionary() |
int |
getExpectedResultCount()
The expected result count for the query.
|
int |
getJoinSyntax()
The join syntax for this select, as one of the syntax constants from
JoinSyntaxes. |
String |
getOrdering()
Get the union-level ordering, if any.
|
Select[] |
getSelects()
Return the selects that make up this union.
|
SQLBuffer |
getSQL()
Get the buffer if it has been computed by a previous call to
SelectExecutor.toSelect(boolean, JDBCFetchConfiguration), if any. |
boolean |
hasMultipleSelects()
Affirm if this receiver requires more than one selects to fetch its
data.
|
boolean |
isDistinct()
Whether this is a SELECT DISTINCT / UNION ALL.
|
boolean |
isLRS()
Whether the result of this select should be treated as a large
result set.
|
boolean |
isUnion()
Whether this is a true UNION, rather than a logical combination of
independent selects.
|
protected LogicalUnion.UnionSelect |
newUnionSelect(SelectImpl seed,
int pos)
Create a new union select with the given delegate and union position.
|
void |
select(Union.Selector selector)
Select data using the given selector.
|
void |
setAutoDistinct(boolean distinct)
Whether to automatically make results distinct when relational joins
would otherwise introduce duplicates.
|
void |
setDistinct(boolean distinct)
Whether this is a SELECT DISTINCT / UNION ALL.
|
void |
setExpectedResultCount(int expectedResultCount,
boolean force)
The expected result count for the query.
|
void |
setJoinSyntax(int syntax)
The join syntax for this select, as one of the syntax constants from
JoinSyntaxes. |
void |
setLRS(boolean lrs)
Whether the result of this select should be treated as a large
result set.
|
boolean |
supportsLocking()
Whether this select can be executed for update.
|
boolean |
supportsRandomAccess(boolean forUpdate)
Return whether this select can support a random access result set type.
|
SQLBuffer |
toSelect(boolean forUpdate,
JDBCFetchConfiguration fetch)
Return this select as a SQL statement formatted for the current
dictionary.
|
SQLBuffer |
toSelectCount()
Return this select as a COUNT SQL statement formatted for the current
dictionary.
|
String |
toString() |
protected final LogicalUnion.UnionSelect[] sels
protected final DBDictionary dict
protected final ClassMapping[] mappings
protected final BitSet desc
public LogicalUnion(JDBCConfiguration conf, int sels)
conf - system configurationsels - the number of SQL selects to union togetherpublic LogicalUnion(JDBCConfiguration conf, Select[] seeds)
protected LogicalUnion(JDBCConfiguration conf, int sels, Select[] seeds)
protected LogicalUnion.UnionSelect newUnionSelect(SelectImpl seed, int pos)
public Select[] getSelects()
UniongetSelects in interface Unionpublic boolean isUnion()
Unionpublic void abortUnion()
UnionabortUnion in interface Unionpublic String getOrdering()
UniongetOrdering in interface Unionpublic JDBCConfiguration getConfiguration()
SelectExecutorgetConfiguration in interface SelectExecutorpublic DBDictionary getDBDictionary()
public SQLBuffer toSelect(boolean forUpdate, JDBCFetchConfiguration fetch)
SelectExecutortoSelect in interface SelectExecutorpublic SQLBuffer getSQL()
SelectExecutorSelectExecutor.toSelect(boolean, JDBCFetchConfiguration), if any.getSQL in interface SelectExecutorpublic SQLBuffer toSelectCount()
SelectExecutortoSelectCount in interface SelectExecutorpublic boolean getAutoDistinct()
SelectExecutorgetAutoDistinct in interface SelectExecutorpublic void setAutoDistinct(boolean distinct)
SelectExecutorsetAutoDistinct in interface SelectExecutorpublic boolean isDistinct()
SelectExecutorisDistinct in interface SelectExecutorpublic void setDistinct(boolean distinct)
SelectExecutorsetDistinct in interface SelectExecutorpublic boolean isLRS()
SelectExecutorisLRS in interface SelectExecutorpublic void setLRS(boolean lrs)
SelectExecutorsetLRS in interface SelectExecutorpublic int getExpectedResultCount()
SelectExecutorgetExpectedResultCount in interface SelectExecutorpublic void setExpectedResultCount(int expectedResultCount,
boolean force)
SelectExecutorsetExpectedResultCount in interface SelectExecutorforce - if false, the count will be discarded if this select has
any to-many eager joins that would throw off the result countpublic int getJoinSyntax()
SelectExecutorJoinSyntaxes.getJoinSyntax in interface SelectExecutorpublic void setJoinSyntax(int syntax)
SelectExecutorJoinSyntaxes.setJoinSyntax in interface SelectExecutorpublic boolean supportsRandomAccess(boolean forUpdate)
SelectExecutorsupportsRandomAccess in interface SelectExecutorpublic boolean supportsLocking()
SelectExecutorsupportsLocking in interface SelectExecutorpublic boolean hasMultipleSelects()
SelectExecutorhasMultipleSelects in interface SelectExecutorpublic int getCount(JDBCStore store) throws SQLException
SelectExecutorgetCount in interface SelectExecutorSQLExceptionpublic Result execute(JDBCStore store, JDBCFetchConfiguration fetch) throws SQLException
SelectExecutorexecute in interface SelectExecutorSQLExceptionpublic Result execute(JDBCStore store, JDBCFetchConfiguration fetch, int lockLevel) throws SQLException
SelectExecutorexecute in interface SelectExecutorSQLExceptionpublic void select(Union.Selector selector)
UnionCopyright © 2006–2020 Apache Software Foundation. All rights reserved.