use Relation.maxSize for getNodes and countNodes (untested)
This commit is contained in:
parent
cf4b947efe
commit
39a561ff2b
1 changed files with 6 additions and 9 deletions
|
@ -602,7 +602,6 @@ public final class NodeManager {
|
||||||
String table = rel.otherType.getTableName ();
|
String table = rel.otherType.getTableName ();
|
||||||
|
|
||||||
Statement stmt = null;
|
Statement stmt = null;
|
||||||
// QueryDataSet qds = null;
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
String q = null;
|
String q = null;
|
||||||
|
@ -618,14 +617,11 @@ public final class NodeManager {
|
||||||
if (logSql)
|
if (logSql)
|
||||||
app.logEvent ("### getNodeIDs: "+q);
|
app.logEvent ("### getNodeIDs: "+q);
|
||||||
|
|
||||||
// qds = new QueryDataSet (con, q);
|
|
||||||
stmt = con.createStatement ();
|
stmt = con.createStatement ();
|
||||||
if (rel.maxSize > 0)
|
if (rel.maxSize > 0)
|
||||||
stmt.setMaxRows (rel.maxSize);
|
stmt.setMaxRows (rel.maxSize);
|
||||||
ResultSet result = stmt.executeQuery (q);
|
ResultSet result = stmt.executeQuery (q);
|
||||||
|
|
||||||
// qds.fetchRecords ();
|
|
||||||
|
|
||||||
// problem: how do we derive a SyntheticKey from a not-yet-persistent Node?
|
// problem: how do we derive a SyntheticKey from a not-yet-persistent Node?
|
||||||
Key k = rel.groupby != null ? home.getKey (): null;
|
Key k = rel.groupby != null ? home.getKey (): null;
|
||||||
while (result.next ()) {
|
while (result.next ()) {
|
||||||
|
@ -649,9 +645,6 @@ public final class NodeManager {
|
||||||
|
|
||||||
} finally {
|
} finally {
|
||||||
// tx.timer.endEvent ("getNodeIDs "+home);
|
// tx.timer.endEvent ("getNodeIDs "+home);
|
||||||
// if (qds != null) {
|
|
||||||
// qds.close ();
|
|
||||||
// }
|
|
||||||
if (stmt != null) try {
|
if (stmt != null) try {
|
||||||
stmt.close ();
|
stmt.close ();
|
||||||
} catch (Exception ignore) {}
|
} catch (Exception ignore) {}
|
||||||
|
@ -697,7 +690,11 @@ public final class NodeManager {
|
||||||
if (logSql)
|
if (logSql)
|
||||||
app.logEvent ("### getNodes: "+tds.getSelectString());
|
app.logEvent ("### getNodes: "+tds.getSelectString());
|
||||||
|
|
||||||
tds.fetchRecords ();
|
if (rel.maxSize > 0)
|
||||||
|
tds.fetchRecords (rel.maxSize);
|
||||||
|
else
|
||||||
|
tds.fetchRecords ();
|
||||||
|
|
||||||
for (int i=0; i<tds.size (); i++) {
|
for (int i=0; i<tds.size (); i++) {
|
||||||
// create new Nodes.
|
// create new Nodes.
|
||||||
Record rec = tds.getRecord (i);
|
Record rec = tds.getRecord (i);
|
||||||
|
@ -766,7 +763,7 @@ public final class NodeManager {
|
||||||
qds.close ();
|
qds.close ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return retval;
|
return rel.maxSize > 0 ? Math.min (rel.maxSize, retval) : retval;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue