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()
Union
getSelects
in interface Union
public boolean isUnion()
Union
public void abortUnion()
Union
abortUnion
in interface Union
public String getOrdering()
Union
getOrdering
in interface Union
public JDBCConfiguration getConfiguration()
SelectExecutor
getConfiguration
in interface SelectExecutor
public DBDictionary getDBDictionary()
public SQLBuffer toSelect(boolean forUpdate, JDBCFetchConfiguration fetch)
SelectExecutor
toSelect
in interface SelectExecutor
public SQLBuffer getSQL()
SelectExecutor
SelectExecutor.toSelect(boolean, JDBCFetchConfiguration)
, if any.getSQL
in interface SelectExecutor
public SQLBuffer toSelectCount()
SelectExecutor
toSelectCount
in interface SelectExecutor
public boolean getAutoDistinct()
SelectExecutor
getAutoDistinct
in interface SelectExecutor
public void setAutoDistinct(boolean distinct)
SelectExecutor
setAutoDistinct
in interface SelectExecutor
public boolean isDistinct()
SelectExecutor
isDistinct
in interface SelectExecutor
public void setDistinct(boolean distinct)
SelectExecutor
setDistinct
in interface SelectExecutor
public boolean isLRS()
SelectExecutor
isLRS
in interface SelectExecutor
public void setLRS(boolean lrs)
SelectExecutor
setLRS
in interface SelectExecutor
public int getExpectedResultCount()
SelectExecutor
getExpectedResultCount
in interface SelectExecutor
public void setExpectedResultCount(int expectedResultCount, boolean force)
SelectExecutor
setExpectedResultCount
in interface SelectExecutor
force
- 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()
SelectExecutor
JoinSyntaxes
.getJoinSyntax
in interface SelectExecutor
public void setJoinSyntax(int syntax)
SelectExecutor
JoinSyntaxes
.setJoinSyntax
in interface SelectExecutor
public boolean supportsRandomAccess(boolean forUpdate)
SelectExecutor
supportsRandomAccess
in interface SelectExecutor
public boolean supportsLocking()
SelectExecutor
supportsLocking
in interface SelectExecutor
public boolean hasMultipleSelects()
SelectExecutor
hasMultipleSelects
in interface SelectExecutor
public int getCount(JDBCStore store) throws SQLException
SelectExecutor
getCount
in interface SelectExecutor
SQLException
public Result execute(JDBCStore store, JDBCFetchConfiguration fetch) throws SQLException
SelectExecutor
execute
in interface SelectExecutor
SQLException
public Result execute(JDBCStore store, JDBCFetchConfiguration fetch, int lockLevel) throws SQLException
SelectExecutor
execute
in interface SelectExecutor
SQLException
public void select(Union.Selector selector)
Union
Copyright © 2006–2020 Apache Software Foundation. All rights reserved.