|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.openjpa.jdbc.sql.LogicalUnion
public class LogicalUnion
A logical union made up of multiple distinct selects whose results are combined in memory.
Nested Class Summary | |
---|---|
static interface |
LogicalUnion.Selector
A callback used to create the selects in a SQL union. |
protected class |
LogicalUnion.UnionSelect
A select that is part of a logical union. |
Field Summary | |
---|---|
protected BitSet |
desc
|
protected DBDictionary |
dict
|
protected ClassMapping[] |
mappings
|
protected LogicalUnion.UnionSelect[] |
sels
|
Constructor Summary | |
---|---|
|
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. |
Method Summary | |
---|---|
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. |
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()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected final LogicalUnion.UnionSelect[] sels
protected final DBDictionary dict
protected final ClassMapping[] mappings
protected final BitSet desc
Constructor Detail |
---|
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)
Method Detail |
---|
protected LogicalUnion.UnionSelect newUnionSelect(SelectImpl seed, int pos)
public Select[] getSelects()
Union
getSelects
in interface Union
public boolean isUnion()
Union
isUnion
in interface 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 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 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
select
in interface Union
public String toString()
toString
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |