|
||||||||||
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.UnionSelect
protected class LogicalUnion.UnionSelect
A select that is part of a logical union.
Field Summary | |
---|---|
protected List |
orderIdxs
|
protected int |
orders
|
protected int |
pos
|
protected SelectImpl |
sel
|
Fields inherited from interface org.apache.openjpa.jdbc.sql.Select |
---|
EAGER_INNER, EAGER_OUTER, EAGER_PARALLEL, FROM_SELECT_ALIAS, SUBS_ANY_JOINABLE, SUBS_EXACT, SUBS_JOINABLE, SUBS_NONE, TYPE_JOINLESS, TYPE_TWO_PART |
Constructor Summary | |
---|---|
LogicalUnion.UnionSelect(SelectImpl sel,
int pos)
|
Method Summary | |
---|---|
void |
addJoinClassConditions()
Apply class conditions from relation joins. |
Joins |
and(Joins joins1,
Joins joins2)
AND the given joins together. |
void |
append(SQLBuffer buf,
Joins joins)
Append the given joins to the given buffer. |
void |
clearOrdering()
Clear odering conditions. |
void |
clearSelects()
Clear the existing column selects. |
SelectExecutor |
eagerClone(FieldMapping key,
int eagerType,
boolean toMany,
int sels)
Return a select that will be eagerly executed with this one, or null if the select cannot be created for the given key and join type. |
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. |
SelectExecutor |
fullClone(int sels)
Return a SELECT that is a complete clone of this one. |
boolean |
getAutoDistinct()
Whether to automatically make results distinct when relational joins would otherwise introduce duplicates. |
String |
getColumnAlias(Column col)
Return the alias for the given column. |
String |
getColumnAlias(Column col,
Joins joins)
Return the alias for the given column. |
String |
getColumnAlias(String col,
Table table)
Return the alias for the given column. |
String |
getColumnAlias(String col,
Table table,
Joins joins)
Return the alias for the given column. |
JDBCConfiguration |
getConfiguration()
Return the select configuration. |
int |
getCount(JDBCStore store)
Return the number of instances matching this select. |
SelectImpl |
getDelegate()
Delegate select. |
SelectExecutor |
getEager(FieldMapping key)
Return the eager select for the given key. |
long |
getEndIndex()
The result end index. |
int |
getExpectedResultCount()
The expected result count for the query. |
Select |
getFromSelect()
Another select instance that creates a temporary table from which this select pulls data. |
SQLBuffer |
getGrouping()
Return the grouping SQL for this select. |
SQLBuffer |
getHaving()
Return the HAVING clause, or null if none. |
List |
getIdentifierAliases()
Get the aliases for identifier columns that can be used in COUNT selects to find the number of matches. |
Iterator |
getJoinIterator()
Return the top-level Join elements for this select. |
Joins |
getJoins()
Return the top-level joins for this select. |
int |
getJoinSyntax()
The join syntax for this select, as one of the syntax constants from JoinSyntaxes . |
SQLBuffer |
getOrdering()
Return the ordering SQL for this select. |
Select |
getParent()
Return the parent of this select, if it is a subselect. |
List |
getSelectAliases()
Return the aliases of all selected columns and all selected buffers, in the order they were selected. |
List |
getSelectedOrderIndexes()
Return the indexes of the data in the select clause this query is ordered by. |
long |
getStartIndex()
The result start index. |
String |
getSubselectPath()
Return the subselect path for this select, if it is a subselect. |
List |
getSubselects()
Return this select's subselects, or empty collection if none. |
Collection |
getTableAliases()
Return the set of all used table aliases. |
SQLBuffer |
getWhere()
Return the WHERE clause, minus any necessary end joins. |
void |
groupBy(ClassMapping mapping,
int subclasses,
JDBCStore store,
JDBCFetchConfiguration fetch)
Group by the columns of the given mapping, possibly including subclasses. |
void |
groupBy(ClassMapping mapping,
int subclasses,
JDBCStore store,
JDBCFetchConfiguration fetch,
Joins joins)
Group by the columns of the given mapping, possibly including subclasses. |
void |
groupBy(Column col)
Group by the given column. |
void |
groupBy(Column[] cols)
Group by the given columns. |
void |
groupBy(Column[] cols,
Joins joins)
Group by the given columns. |
void |
groupBy(Column col,
Joins joins)
Group by the given column. |
void |
groupBy(SQLBuffer sql)
Add a GROUP BY clause. |
void |
groupBy(SQLBuffer sql,
Joins joins)
Add a GROUP BY clause. |
void |
groupBy(String sql)
Add a GROUP BY clause. |
void |
groupBy(String sql,
Joins joins)
Add a GROUP BY clause. |
boolean |
hasEagerJoin(boolean toMany)
Whether this select has an eager join of the specified type. |
boolean |
hasJoin(boolean toMany)
Whether this select has a join of the specified type. |
void |
having(SQLBuffer sql)
Add the given having conditions. |
void |
having(SQLBuffer sql,
Joins joins)
Add the given having conditions. |
void |
having(String sql)
Add the given having conditions. |
void |
having(String sql,
Joins joins)
Add the given having conditions. |
int |
indexOf()
The index of this select within the UNION, or 0. |
boolean |
isAggregate()
Return true if this is an aggregate select. |
boolean |
isDistinct()
Whether this is a SELECT DISTINCT / UNION ALL. |
boolean |
isLob()
Return true if this select includes a LOB. |
boolean |
isLRS()
Whether the result of this select should be treated as a large result set. |
boolean |
isSelected(Table table)
Return whether the given table is being used in this select. |
Joins |
newJoins()
Return a new instance to use for joining. |
Joins |
newOuterJoins()
Return a new instance to use for outer joining. |
Joins |
or(Joins joins1,
Joins joins2)
OR the given joins together. |
int |
orderBy(Column[] cols,
boolean asc,
boolean select)
Order by the given columns. |
int |
orderBy(Column[] cols,
boolean asc,
Joins joins,
boolean select)
Order by the given columns. |
boolean |
orderBy(Column col,
boolean asc,
boolean select)
Order by the given column. |
boolean |
orderBy(Column col,
boolean asc,
Joins joins,
boolean select)
Order by the given column. |
boolean |
orderBy(SQLBuffer sql,
boolean asc,
boolean select)
Add an ORDER BY clause. |
boolean |
orderBy(SQLBuffer sql,
boolean asc,
Joins joins,
boolean select)
Add an ORDER BY clause. |
boolean |
orderBy(String sql,
boolean asc,
boolean select)
Add an ORDER BY clause. |
boolean |
orderBy(String sql,
boolean asc,
Joins joins,
boolean select)
Add an ORDER BY clause. |
int |
orderByPrimaryKey(ClassMapping mapping,
boolean asc,
boolean select)
Order on the primary key columns of the given mapping, joining to superclasses as necessary to get all columns needed to construct an object id. |
int |
orderByPrimaryKey(ClassMapping mapping,
boolean asc,
Joins joins,
boolean select)
Select and order on the primary key columns of the given mapping, joining to superclasses as necessary to get all columns needed to construct an object id. |
Joins |
outer(Joins joins)
Return a join set making the given joins outer joins. |
protected void |
recordOrder(Object ord,
boolean asc)
Record that we're ordering by a SQL expression. |
protected void |
recordOrderColumns(Column[] cols,
boolean asc)
Record that we're ordering by the given columns. |
void |
select(ClassMapping mapping,
int subclasses,
JDBCStore store,
JDBCFetchConfiguration fetch,
int eager)
Select the columns of the given mapping, possibly including subclasses. |
void |
select(ClassMapping mapping,
int subclasses,
JDBCStore store,
JDBCFetchConfiguration fetch,
int eager,
Joins joins)
Select the columns of the given mapping, possibly including subclasses. |
boolean |
select(Column col)
Select the given column. |
int |
select(Column[] cols)
Select the given columns. |
int |
select(Column[] cols,
Joins joins)
Select the given columns. |
boolean |
select(Column col,
Joins joins)
Select the given column. |
boolean |
select(SQLBuffer sql,
Object id)
Select the given SQL; the given id object is an identifier to use when retrieving the corresponding value from a Result . |
boolean |
select(SQLBuffer sql,
Object id,
Joins joins)
Select the given SQL; the given id object is an identifier to use when retrieving the corresponding value from a Result . |
boolean |
select(String sql,
Object id)
Select the given SQL; the given id object is an identifier to use when retrieving the corresponding value from a Result . |
boolean |
select(String sql,
Object id,
Joins joins)
Select the given SQL; the given id object is an identifier to use when retrieving the corresponding value from a Result . |
void |
selectIdentifier(ClassMapping mapping,
int subclasses,
JDBCStore store,
JDBCFetchConfiguration fetch,
int eager)
Select the columns of the given mapping, possibly including subclasses. |
void |
selectIdentifier(ClassMapping mapping,
int subclasses,
JDBCStore store,
JDBCFetchConfiguration fetch,
int eager,
Joins joins)
Select the columns of the given mapping, possibly including subclasses. |
boolean |
selectIdentifier(Column col)
Select the given column as one that can be used to get a count of distinct matches. |
int |
selectIdentifier(Column[] cols)
Select the given columns as ones that can be used to get a count of distinct matches. |
int |
selectIdentifier(Column[] cols,
Joins joins)
Select the given columns as ones that can be used to get a count of distinct matches. |
boolean |
selectIdentifier(Column col,
Joins joins)
Select the given column as one that can be used to get a count of distinct matches. |
void |
selectPlaceholder(String sql)
Select the given SQL as a placeholder for a UNION element. |
int |
selectPrimaryKey(ClassMapping mapping)
Select the primary key columns of the given mapping, joining to superclasses as necessary to get all columns needed to construct an object id. |
int |
selectPrimaryKey(ClassMapping mapping,
Joins joins)
Select the primary key columns of the given mapping, joining to superclasses as necessary to get all columns needed to construct an object id. |
void |
setAggregate(boolean agg)
Set to true for aggregate selects. |
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 |
setFromSelect(Select sel)
Another select instance that creates a temporary table from which this select pulls data. |
void |
setJoinSyntax(int joinSyntax)
The join syntax for this select, as one of the syntax constants from JoinSyntaxes . |
void |
setLob(boolean lob)
Set to true for selects that include LOB columns. |
void |
setLRS(boolean lrs)
Whether the result of this select should be treated as a large result set. |
void |
setParent(Select parent,
String path)
Turn this select into a subselect of the given instance. |
void |
setRange(long start,
long end)
Set the result range for this select. |
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()
Implement toString to generate SQL string for profiling/debuggging. |
void |
where(Joins joins)
Add the given where conditions. |
void |
where(SQLBuffer sql)
Add the given where conditions. |
void |
where(SQLBuffer sql,
Joins joins)
Add the given where conditions. |
void |
where(String sql)
Add the given where conditions. |
void |
where(String sql,
Joins joins)
Add the given where conditions. |
SelectExecutor |
whereClone(int sels)
Return a SELECT with the same joins and where conditions as this one. |
void |
whereForeignKey(ForeignKey fk,
Object oid,
ClassMapping mapping,
JDBCStore store)
Add where conditions setting the given foreign key to the given oid values. |
void |
wherePrimaryKey(Object oid,
ClassMapping mapping,
JDBCStore store)
Add where conditions setting the mapping's primary key to the given oid values. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected final SelectImpl sel
protected final int pos
protected int orders
protected List orderIdxs
Constructor Detail |
---|
public LogicalUnion.UnionSelect(SelectImpl sel, int pos)
Method Detail |
---|
public SelectImpl getDelegate()
public List getSelectedOrderIndexes()
public JDBCConfiguration getConfiguration()
SelectExecutor
getConfiguration
in interface SelectExecutor
public int indexOf()
Select
indexOf
in interface Select
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 getJoinSyntax()
SelectExecutor
JoinSyntaxes
.
getJoinSyntax
in interface SelectExecutor
public void setJoinSyntax(int joinSyntax)
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 List getSubselects()
Select
getSubselects
in interface Select
public Select getParent()
Select
getParent
in interface Select
public String getSubselectPath()
Select
getSubselectPath
in interface Select
public void setParent(Select parent, String path)
Select
setParent
in interface Select
public Select getFromSelect()
Select
getFromSelect
in interface Select
public void setFromSelect(Select sel)
Select
setFromSelect
in interface Select
public boolean hasEagerJoin(boolean toMany)
Select
hasEagerJoin
in interface Select
public boolean hasJoin(boolean toMany)
Select
hasJoin
in interface Select
public boolean isSelected(Table table)
Select
isSelected
in interface Select
public Collection getTableAliases()
Select
getTableAliases
in interface Select
public List getSelectAliases()
Select
SQLBuffer
.
getSelectAliases
in interface Select
public List getIdentifierAliases()
Select
getIdentifierAliases
in interface Select
public SQLBuffer getOrdering()
Select
getOrdering
in interface Select
public SQLBuffer getGrouping()
Select
getGrouping
in interface Select
public SQLBuffer getWhere()
Select
getWhere
in interface Select
public SQLBuffer getHaving()
Select
getHaving
in interface Select
public void addJoinClassConditions()
Select
Select.getJoins()
, Select.getJoinIterator()
, and
Select.getWhere()
.
addJoinClassConditions
in interface Select
public Joins getJoins()
Select
getJoins
in interface Select
public Iterator getJoinIterator()
Select
Join
elements for this select.
getJoinIterator
in interface Select
public long getStartIndex()
Select
getStartIndex
in interface Select
public long getEndIndex()
Select
getEndIndex
in interface Select
public void setRange(long start, long end)
Select
setRange
in interface Select
public String getColumnAlias(Column col)
Select
getColumnAlias
in interface Select
public String getColumnAlias(Column col, Joins joins)
Select
getColumnAlias
in interface Select
public String getColumnAlias(String col, Table table)
Select
getColumnAlias
in interface Select
public String getColumnAlias(String col, Table table, Joins joins)
Select
getColumnAlias
in interface Select
public boolean isAggregate()
Select
isAggregate
in interface Select
public void setAggregate(boolean agg)
Select
setAggregate
in interface Select
public boolean isLob()
Select
isLob
in interface Select
public void setLob(boolean lob)
Select
setLob
in interface Select
public void selectPlaceholder(String sql)
Select
selectPlaceholder
in interface Select
public void clearSelects()
Select
clearSelects
in interface Select
public boolean select(SQLBuffer sql, Object id)
Select
Result
.
select
in interface Select
public boolean select(SQLBuffer sql, Object id, Joins joins)
Select
Result
.
select
in interface Select
public boolean select(String sql, Object id)
Select
Result
.
select
in interface Select
public boolean select(String sql, Object id, Joins joins)
Select
Result
.
select
in interface Select
public boolean select(Column col)
Select
select
in interface Select
public boolean select(Column col, Joins joins)
Select
select
in interface Select
public int select(Column[] cols)
Select
select
in interface Select
public int select(Column[] cols, Joins joins)
Select
select
in interface Select
public void select(ClassMapping mapping, int subclasses, JDBCStore store, JDBCFetchConfiguration fetch, int eager)
Select
select
in interface Select
public void select(ClassMapping mapping, int subclasses, JDBCStore store, JDBCFetchConfiguration fetch, int eager, Joins joins)
Select
select
in interface Select
public boolean selectIdentifier(Column col)
Select
count
.
selectIdentifier
in interface Select
public boolean selectIdentifier(Column col, Joins joins)
Select
count
.
selectIdentifier
in interface Select
public int selectIdentifier(Column[] cols)
Select
count
.
selectIdentifier
in interface Select
public int selectIdentifier(Column[] cols, Joins joins)
Select
count
.
selectIdentifier
in interface Select
public void selectIdentifier(ClassMapping mapping, int subclasses, JDBCStore store, JDBCFetchConfiguration fetch, int eager)
Select
count
.
selectIdentifier
in interface Select
public void selectIdentifier(ClassMapping mapping, int subclasses, JDBCStore store, JDBCFetchConfiguration fetch, int eager, Joins joins)
Select
count
.
selectIdentifier
in interface Select
public int selectPrimaryKey(ClassMapping mapping)
Select
selectPrimaryKey
in interface Select
public int selectPrimaryKey(ClassMapping mapping, Joins joins)
Select
selectPrimaryKey
in interface Select
public int orderByPrimaryKey(ClassMapping mapping, boolean asc, boolean select)
Select
orderByPrimaryKey
in interface Select
public int orderByPrimaryKey(ClassMapping mapping, boolean asc, Joins joins, boolean select)
Select
orderByPrimaryKey
in interface Select
protected void recordOrder(Object ord, boolean asc)
protected void recordOrderColumns(Column[] cols, boolean asc)
public boolean orderBy(Column col, boolean asc, boolean select)
Select
orderBy
in interface Select
public boolean orderBy(Column col, boolean asc, Joins joins, boolean select)
Select
orderBy
in interface Select
public int orderBy(Column[] cols, boolean asc, boolean select)
Select
orderBy
in interface Select
public int orderBy(Column[] cols, boolean asc, Joins joins, boolean select)
Select
orderBy
in interface Select
public boolean orderBy(SQLBuffer sql, boolean asc, boolean select)
Select
orderBy
in interface Select
public boolean orderBy(SQLBuffer sql, boolean asc, Joins joins, boolean select)
Select
orderBy
in interface Select
public boolean orderBy(String sql, boolean asc, boolean select)
Select
orderBy
in interface Select
public boolean orderBy(String sql, boolean asc, Joins joins, boolean select)
Select
orderBy
in interface Select
public void clearOrdering()
Select
clearOrdering
in interface Select
public void wherePrimaryKey(Object oid, ClassMapping mapping, JDBCStore store)
Select
wherePrimaryKey
in interface Select
public void whereForeignKey(ForeignKey fk, Object oid, ClassMapping mapping, JDBCStore store)
Select
whereForeignKey
in interface Select
Select.wherePrimaryKey(java.lang.Object, org.apache.openjpa.jdbc.meta.ClassMapping, org.apache.openjpa.jdbc.kernel.JDBCStore)
public void where(Joins joins)
Select
where
in interface Select
public void where(SQLBuffer sql)
Select
where
in interface Select
public void where(SQLBuffer sql, Joins joins)
Select
where
in interface Select
public void where(String sql)
Select
where
in interface Select
public void where(String sql, Joins joins)
Select
where
in interface Select
public void having(SQLBuffer sql)
Select
having
in interface Select
public void having(SQLBuffer sql, Joins joins)
Select
having
in interface Select
public void having(String sql)
Select
having
in interface Select
public void having(String sql, Joins joins)
Select
having
in interface Select
public void groupBy(SQLBuffer sql)
Select
groupBy
in interface Select
public void groupBy(SQLBuffer sql, Joins joins)
Select
groupBy
in interface Select
public void groupBy(String sql)
Select
groupBy
in interface Select
public void groupBy(String sql, Joins joins)
Select
groupBy
in interface Select
public void groupBy(Column col)
Select
groupBy
in interface Select
public void groupBy(Column col, Joins joins)
Select
groupBy
in interface Select
public void groupBy(Column[] cols)
Select
groupBy
in interface Select
public void groupBy(Column[] cols, Joins joins)
Select
groupBy
in interface Select
public void groupBy(ClassMapping mapping, int subclasses, JDBCStore store, JDBCFetchConfiguration fetch)
Select
groupBy
in interface Select
public void groupBy(ClassMapping mapping, int subclasses, JDBCStore store, JDBCFetchConfiguration fetch, Joins joins)
Select
groupBy
in interface Select
public SelectExecutor whereClone(int sels)
Select
whereClone
in interface Select
sels
- number of selects to UNION together; ignored if <= 1public SelectExecutor fullClone(int sels)
Select
fullClone
in interface Select
sels
- number of selects to UNION together; ignored if <= 1public SelectExecutor eagerClone(FieldMapping key, int eagerType, boolean toMany, int sels)
Select
eagerClone
in interface Select
key
- the key for the eager selecteagerType
- one of the EAGER_* constantstoMany
- whether the eager join is to-manysels
- number of selects to UNION together; ignored if <= 1public SelectExecutor getEager(FieldMapping key)
Select
getEager
in interface Select
public Joins newJoins()
Select
newJoins
in interface Select
public Joins newOuterJoins()
Select
newOuterJoins
in interface Select
public void append(SQLBuffer buf, Joins joins)
Select
append
in interface Select
public Joins and(Joins joins1, Joins joins2)
Select
and
in interface Select
public Joins or(Joins joins1, Joins joins2)
Select
or
in interface Select
public Joins outer(Joins joins)
Select
outer
in interface Select
public String toString()
Select
toString
in interface Select
toString
in class Object
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 count
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |