| Method from org.apache.openjpa.jdbc.sql.LogicalUnion Detail: |
public void abortUnion() {
}
|
public Result execute(JDBCStore store,
JDBCFetchConfiguration fetch) throws SQLException {
if (fetch == null)
fetch = store.getFetchConfiguration();
return execute(store, fetch, fetch.getReadLockLevel());
}
|
public Result execute(JDBCStore store,
JDBCFetchConfiguration fetch,
int lockLevel) throws SQLException {
if (fetch == null)
fetch = store.getFetchConfiguration();
if (sels.length == 1) {
Result res = sels[0].execute(store, fetch, lockLevel);
((AbstractResult) res).setBaseMapping(mappings[0]);
return res;
}
if (getExpectedResultCount() == 1) {
AbstractResult res;
for (int i = 0; i < sels.length; i++) {
res = (AbstractResult) sels[i].execute(store, fetch,
lockLevel);
res.setBaseMapping(mappings[i]);
res.setIndexOf(i);
// if we get to the last select, just return its result
if (i == sels.length - 1)
return res;
// return the first result that has a row
try {
if (!res.next())
res.close();
else {
res.pushBack();
return res;
}
}
catch (SQLException se) {
res.close();
throw se;
}
}
}
// create a single result from each select in our fake union, merging
// them as needed
AbstractResult[] res = new AbstractResult[sels.length];
List[] orderIdxs = null;
try {
List l;
for (int i = 0; i < res.length; i++) {
res[i] = (AbstractResult) sels[i].execute(store, fetch,
lockLevel);
res[i].setBaseMapping(mappings[i]);
res[i].setIndexOf(i);
l = sels[i].getSelectedOrderIndexes();
if (l != null) {
if (orderIdxs == null)
orderIdxs = new List[sels.length];
orderIdxs[i] = l;
}
}
} catch (SQLException se) {
for (int i = 0; res[i] != null; i++)
res[i].close();
throw se;
}
// if multiple selects have ordering, use a comparator to collate
ResultComparator comp = null;
if (orderIdxs != null)
comp = new ResultComparator(orderIdxs, desc, dict);
return new MergedResult(res, comp);
}
|
public boolean getAutoDistinct() {
return sels[0].getAutoDistinct();
}
|
public JDBCConfiguration getConfiguration() {
return sels[0].getConfiguration();
}
|
public int getCount(JDBCStore store) throws SQLException {
int count = 0;
for (int i = 0; i < sels.length; i++)
count += sels[i].getCount(store);
return count;
}
|
public DBDictionary getDBDictionary() {
return dict;
}
|
public int getExpectedResultCount() {
return sels[0].getExpectedResultCount();
}
|
public int getJoinSyntax() {
return sels[0].getJoinSyntax();
}
|
public String getOrdering() {
return null;
}
|
public Select[] getSelects() {
return sels;
}
|
public boolean isDistinct() {
return _distinct;
}
|
public boolean isLRS() {
return sels[0].isLRS();
}
|
public boolean isUnion() {
return false;
}
|
protected LogicalUnion.UnionSelect newUnionSelect(SelectImpl seed,
int pos) {
return new UnionSelect(seed, pos);
}
Create a new union select with the given delegate and union position. |
public void select(Union.Selector selector) {
for (int i = 0; i < sels.length; i++)
selector.select(sels[i], i);
}
|
public void setAutoDistinct(boolean distinct) {
for (int i = 0; i < sels.length; i++)
sels[i].setAutoDistinct(distinct);
}
|
public void setDistinct(boolean distinct) {
_distinct = distinct;
}
|
public void setExpectedResultCount(int expectedResultCount,
boolean force) {
for (int i = 0; i < sels.length; i++)
sels[i].setExpectedResultCount(expectedResultCount, force);
}
|
public void setJoinSyntax(int syntax) {
for (int i = 0; i < sels.length; i++)
sels[i].setJoinSyntax(syntax);
}
|
public void setLRS(boolean lrs) {
for (int i = 0; i < sels.length; i++)
sels[i].setLRS(lrs);
}
|
public boolean supportsLocking() {
if (sels.length == 1)
return sels[0].supportsLocking();
for (int i = 0; i < sels.length; i++)
if (!sels[i].supportsLocking())
return false;
return true;
}
|
public boolean supportsRandomAccess(boolean forUpdate) {
if (sels.length == 1)
return sels[0].supportsRandomAccess(forUpdate);
return false;
}
|
public SQLBuffer toSelect(boolean forUpdate,
JDBCFetchConfiguration fetch) {
return dict.toSelect(sels[0], forUpdate, fetch);
}
|
public SQLBuffer toSelectCount() {
return dict.toSelectCount(sels[0]);
}
|
public String toString() {
return toSelect(false, null).getSQL();
}
|